Conditions | 6 |
Paths | 6 |
Total Lines | 25 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
32 | protected function execute(InputInterface $input, OutputInterface $output) |
||
33 | { |
||
34 | $listing = new Asset\Listing(); |
||
35 | |||
36 | foreach ($listing as $item) { |
||
37 | |||
38 | if($item instanceof Asset\Image) { |
||
39 | if(file_exists($item->getFileSystemPath())) { |
||
40 | |||
41 | if (!in_array($item->getMimetype(), $this->mimeTypes)) { |
||
42 | return false; |
||
43 | } |
||
44 | |||
45 | try { |
||
46 | (new TinyPngService())->minimize($item); |
||
47 | } catch (\Exception $e) { |
||
48 | (ApplicationLogger::getInstance())->error($e->getMessage(), [ |
||
49 | 'relatedObject' => $item, |
||
50 | 'component' => 'TinyPNG' |
||
51 | ]); |
||
52 | } |
||
53 | |||
54 | $this->dump("Optimized: " . $item->getKey()); |
||
55 | |||
56 | return true; |
||
57 | |||
63 |