1 | <?php |
||
22 | class FilterService |
||
23 | { |
||
24 | /** |
||
25 | * @var DataManager |
||
26 | */ |
||
27 | private $dataManager; |
||
28 | |||
29 | /** |
||
30 | * @var FilterManager |
||
31 | */ |
||
32 | private $filterManager; |
||
33 | |||
34 | /** |
||
35 | * @var CacheManager |
||
36 | */ |
||
37 | private $cacheManager; |
||
38 | |||
39 | /** |
||
40 | * @var LoggerInterface |
||
41 | */ |
||
42 | private $logger; |
||
43 | |||
44 | /** |
||
45 | * @var bool |
||
46 | */ |
||
47 | private $webpGenerate; |
||
48 | |||
49 | /** |
||
50 | * @var mixed[] |
||
51 | */ |
||
52 | private $webpOptions; |
||
53 | |||
54 | public function __construct( |
||
69 | |||
70 | /** |
||
71 | * @param string $path |
||
72 | * @param string $filter |
||
73 | * |
||
74 | * @return bool Returns true if the cache is busted |
||
75 | */ |
||
76 | public function bustCache($path, $filter) |
||
90 | |||
91 | /** |
||
92 | * @param bool $forced Force warm up cache |
||
93 | * |
||
94 | * @return bool Returns true if the cache is warmed up |
||
95 | */ |
||
96 | public function warmsUpCache( |
||
112 | |||
113 | /** |
||
114 | * @param string $path |
||
115 | * @param string $filter |
||
116 | * @param string|null $resolver |
||
117 | * |
||
118 | * @return string |
||
119 | */ |
||
120 | public function getUrlOfFilteredImage($path, $filter, $resolver = null, bool $webpSupported = false) |
||
128 | |||
129 | /** |
||
130 | * @param string $path |
||
131 | * @param string $filter |
||
132 | * @param string|null $resolver |
||
133 | * |
||
134 | * @return string |
||
135 | */ |
||
136 | public function getUrlOfFilteredImageWithRuntimeFilters( |
||
159 | |||
160 | /** |
||
161 | * @param mixed[] $options |
||
162 | * |
||
163 | * @return FilterPathContainer[] |
||
164 | */ |
||
165 | private function buildFilterPathContainers(string $source, string $target = '', array $options = []): array |
||
166 | { |
||
167 | $basePathContainer = new FilterPathContainer($source, $target, $options); |
||
168 | $filterPathContainers = [$basePathContainer]; |
||
169 | |||
170 | if ($this->webpGenerate) { |
||
171 | $filterPathContainers[] = $basePathContainer->createWebp($this->webpOptions); |
||
172 | } |
||
173 | |||
174 | return $filterPathContainers; |
||
175 | } |
||
176 | |||
177 | private function resolveFilterPathContainer( |
||
191 | |||
192 | /** |
||
193 | * @param bool $forced Force warm up cache |
||
194 | * |
||
195 | * @return bool Returns true if the cache is warmed up |
||
196 | */ |
||
197 | private function warmsUpCacheFilterPathContainer( |
||
216 | |||
217 | /** |
||
218 | * @throws NonExistingFilterException |
||
219 | */ |
||
220 | private function createFilteredBinary(FilterPathContainer $filterPathContainer, string $filter): BinaryInterface |
||
237 | } |
||
238 |