1 | <?php |
||
8 | class OptimizerChain |
||
9 | { |
||
10 | /* @var \Spatie\ImageOptimizer\Optimizer[] */ |
||
11 | protected $optimizers = []; |
||
12 | |||
13 | /** @var \Psr\Log\LoggerInterface */ |
||
14 | protected $logger; |
||
15 | |||
16 | /** @var int */ |
||
17 | protected $timeout = 60; |
||
18 | |||
19 | public function __construct() |
||
23 | |||
24 | public function getOptimizers(): array |
||
28 | |||
29 | public function addOptimizer(Optimizer $optimizer) |
||
35 | |||
36 | public function setOptimizers(array $optimizers) |
||
46 | |||
47 | /* |
||
48 | * Set the amount of seconds each separate optimizer may use. |
||
49 | */ |
||
50 | public function setTimeout(int $timeoutInSeconds) |
||
56 | |||
57 | public function useLogger(LoggerInterface $log) |
||
63 | |||
64 | /** |
||
65 | * Get logger. |
||
66 | * @return LoggerInterface |
||
67 | */ |
||
68 | public function getLogger() |
||
72 | |||
73 | public function optimize(string $pathToImage, string $pathToOutput = null) |
||
89 | |||
90 | protected function applyOptimizer(Optimizer $optimizer, Image $image) |
||
114 | |||
115 | protected function logResult(Process $process) |
||
125 | } |
||
126 |
In PHP, under loose comparison (like
==
, or!=
, orswitch
conditions), values of different types might be equal.For
string
values, the empty string''
is a special case, in particular the following results might be unexpected: