Mark V
1: <?php
2: namespace MOC\V\Core\FileSystem\Component\Bridge;
3:
4: use MOC\V\Core\AutoLoader\AutoLoader;
5: use MOC\V\Core\FileSystem\Component\IBridgeInterface;
6: use Symfony\Component\HttpFoundation\File\MimeType\MimeTypeGuesser;
7:
8: /**
9: * Class Bridge
10: *
11: * @package MOC\V\Core\FileSystem\Component\Bridge
12: */
13: abstract class Bridge implements IBridgeInterface
14: {
15:
16: /**
17: * Bridge constructor.
18: */
19: public function __construct()
20: {
21:
22: AutoLoader::getNamespaceAutoLoader(
23: 'Symfony\Component\HttpFoundation\File', __DIR__.'/../../../HttpKernel/Vendor/'
24: );
25: }
26:
27: /**
28: * @return null|false|string returns null if not detected, false on error (enable the php_fileinfo extension)
29: */
30: public function getMimeType()
31: {
32:
33: try {
34: return MimeTypeGuesser::getInstance()->guess($this->getRealPath());
35: } catch (\Exception $Exception) {
36: return false;
37: }
38: }
39: }
40: