@@ -47,7 +47,7 @@ |
||
47 | 47 | } |
48 | 48 | } |
49 | 49 | $mim = MimeTypeHelper::getByExtension($extension); |
50 | - $response->headers->set('Content-Type', $mim .'; charset=UTF-8'); |
|
50 | + $response->headers->set('Content-Type', $mim.'; charset=UTF-8'); |
|
51 | 51 | } |
52 | 52 | } |
53 | 53 | } |
@@ -50,38 +50,38 @@ |
||
50 | 50 | protected function execute(InputInterface $input, OutputInterface $output) |
51 | 51 | { |
52 | 52 | $dir = $this->container->getParameter('kernel.project_dir'); |
53 | - $path = $dir . '/' . $input->getArgument('path'); |
|
53 | + $path = $dir.'/'.$input->getArgument('path'); |
|
54 | 54 | |
55 | 55 | if (!file_exists($path)) { |
56 | - throw new \InvalidArgumentException('File ' . $path . ' doe not exist.'); |
|
56 | + throw new \InvalidArgumentException('File '.$path.' doe not exist.'); |
|
57 | 57 | } |
58 | 58 | |
59 | - $output->writeln('<info>Checking file:</info> ' . $path); |
|
59 | + $output->writeln('<info>Checking file:</info> '.$path); |
|
60 | 60 | |
61 | 61 | $mimType = new FileBinaryMimeTypeGuesser(); |
62 | - $output->writeln('<info>FileBinaryMimeTypeGuesser:</info> ' . $mimType->guessMimeType($path)); |
|
62 | + $output->writeln('<info>FileBinaryMimeTypeGuesser:</info> '.$mimType->guessMimeType($path)); |
|
63 | 63 | |
64 | 64 | $mimType = new FileinfoMimeTypeGuesser(); |
65 | - $output->writeln('<info>FileinfoMimeTypeGuesser:</info> ' . $mimType->guessMimeType($path)); |
|
65 | + $output->writeln('<info>FileinfoMimeTypeGuesser:</info> '.$mimType->guessMimeType($path)); |
|
66 | 66 | |
67 | 67 | $mim = MimeTypes::getDefault()->guessMimeType($path); |
68 | - $output->writeln('<info>Default Symfony MimType:</info> ' . $mim); |
|
68 | + $output->writeln('<info>Default Symfony MimType:</info> '.$mim); |
|
69 | 69 | |
70 | 70 | |
71 | 71 | $mimByExtension = MimeTypes::getDefault()->getMimeTypes($ext = pathinfo($path, PATHINFO_EXTENSION)); |
72 | - $output->writeln('<info>MimType by extension:</info> ' . implode(',', $mimByExtension)); |
|
72 | + $output->writeln('<info>MimType by extension:</info> '.implode(',', $mimByExtension)); |
|
73 | 73 | |
74 | 74 | |
75 | 75 | $mimExtension = MimeTypes::getDefault()->getExtensions($mimByExtension[0]); |
76 | - $output->writeln('<info>Extension of mim types:</info> ' . $mimByExtension[0] . ' <info>is:</info> ' . implode(',', $mimExtension)); |
|
76 | + $output->writeln('<info>Extension of mim types:</info> '.$mimByExtension[0].' <info>is:</info> '.implode(',', $mimExtension)); |
|
77 | 77 | |
78 | 78 | $output->writeln('--------------- My ----------------'); |
79 | 79 | |
80 | - $output->writeln('<info>My MimTypes checker:</info> ' . \SWP\Bundle\CoreBundle\Util\MimeTypeHelper::getByPath($path)); |
|
81 | - $output->writeln('<info>My Extensions by MimTypes checker:</info> ' . \SWP\Bundle\CoreBundle\Util\MimeTypeHelper::getExtensionByMimeType('application/json')); |
|
82 | - $output->writeln('<info>My Extensions by MimTypes checker:</info> ' . \SWP\Bundle\CoreBundle\Util\MimeTypeHelper::getExtensionByMimeType('application/javascript')); |
|
83 | - $output->writeln('<info>My Extensions by MimTypes checker:</info> ' . \SWP\Bundle\CoreBundle\Util\MimeTypeHelper::getExtensionByMimeType('image/png')); |
|
84 | - $output->writeln('<info>My Extensions by MimTypes checker:</info> ' . \SWP\Bundle\CoreBundle\Util\MimeTypeHelper::getExtensionByMimeType('image/jpeg')); |
|
80 | + $output->writeln('<info>My MimTypes checker:</info> '.\SWP\Bundle\CoreBundle\Util\MimeTypeHelper::getByPath($path)); |
|
81 | + $output->writeln('<info>My Extensions by MimTypes checker:</info> '.\SWP\Bundle\CoreBundle\Util\MimeTypeHelper::getExtensionByMimeType('application/json')); |
|
82 | + $output->writeln('<info>My Extensions by MimTypes checker:</info> '.\SWP\Bundle\CoreBundle\Util\MimeTypeHelper::getExtensionByMimeType('application/javascript')); |
|
83 | + $output->writeln('<info>My Extensions by MimTypes checker:</info> '.\SWP\Bundle\CoreBundle\Util\MimeTypeHelper::getExtensionByMimeType('image/png')); |
|
84 | + $output->writeln('<info>My Extensions by MimTypes checker:</info> '.\SWP\Bundle\CoreBundle\Util\MimeTypeHelper::getExtensionByMimeType('image/jpeg')); |
|
85 | 85 | |
86 | 86 | return 0; |
87 | 87 | } |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | * @param bool $all |
21 | 21 | * @return array|string |
22 | 22 | */ |
23 | - public static function getByPath(string $path, bool $all = false): array|string |
|
23 | + public static function getByPath(string $path, bool $all = false): array | string |
|
24 | 24 | { |
25 | 25 | $ext = pathinfo($path, PATHINFO_EXTENSION); |
26 | 26 | return self::getByExtension($ext, $all); |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | * @param bool $all |
32 | 32 | * @return array|string |
33 | 33 | */ |
34 | - public static function getByExtension(string $ext, bool $all = false): array|string |
|
34 | + public static function getByExtension(string $ext, bool $all = false): array | string |
|
35 | 35 | { |
36 | 36 | $mimeType = MimeTypes::getDefault(); |
37 | 37 | $types = $mimeType->getMimeTypes($ext); |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | * @param bool $all |
53 | 53 | * @return array|string |
54 | 54 | */ |
55 | - public static function getExtensionByMimeType(string $mime, bool $all = false): array|string |
|
55 | + public static function getExtensionByMimeType(string $mime, bool $all = false): array | string |
|
56 | 56 | { |
57 | 57 | $mimeType = MimeTypes::getDefault(); |
58 | 58 | $extensions = $mimeType->getExtensions($mime); |