Total Complexity | 5 |
Total Lines | 41 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
9 | class ImageOptimiser extends AbstractFilter |
||
10 | { |
||
11 | /** |
||
12 | * @var ImageOptimiserService |
||
13 | */ |
||
14 | protected $imageOptimiserService; |
||
15 | |||
16 | public function __construct(ImageOptimiserService $imageOptimiserService) |
||
19 | } |
||
20 | |||
21 | public function filter($value) |
||
22 | { |
||
23 | try { |
||
24 | $this->getImageOptimiserService()->optimize($value['tmp_name']); |
||
25 | } catch (Exception $exception) { |
||
26 | throw $exception; |
||
27 | } |
||
28 | |||
29 | return $value; |
||
30 | } |
||
31 | |||
32 | /** |
||
33 | * @return ImageOptimiserService |
||
34 | */ |
||
35 | public function getImageOptimiserService() : ImageOptimiserService |
||
36 | { |
||
37 | return $this->imageOptimiserService; |
||
38 | } |
||
39 | |||
40 | /** |
||
41 | * @param ImageOptimiserService $imageOptimiserService |
||
42 | * |
||
43 | * @return ImageOptimiser |
||
44 | */ |
||
45 | public function setImageOptimiserService(ImageOptimiserService $imageOptimiserService) : ImageOptimiser |
||
50 | } |
||
51 | } |