1 | <?php |
||
19 | class ResponsiveFactory |
||
20 | { |
||
21 | |||
22 | /** |
||
23 | * The image driver to use. |
||
24 | * Available drivers: 'gd' and 'imagick'. |
||
25 | * |
||
26 | * @var string |
||
27 | */ |
||
28 | protected $driver; |
||
29 | |||
30 | /** |
||
31 | * The source path to load images from. |
||
32 | * |
||
33 | * @var string |
||
34 | */ |
||
35 | protected $sourcePath; |
||
36 | |||
37 | /** |
||
38 | * The public path to save rendered images. |
||
39 | * |
||
40 | * @var string |
||
41 | */ |
||
42 | protected $publicPath; |
||
43 | |||
44 | /** |
||
45 | * Enabled cache will stop generated images from being overwritten. |
||
46 | * |
||
47 | * @var bool |
||
48 | */ |
||
49 | private $enableCache; |
||
50 | |||
51 | /** |
||
52 | * Enable optimizers will run several image optimizers on the saved files. |
||
53 | * |
||
54 | * @var bool |
||
55 | */ |
||
56 | private $optimize; |
||
57 | |||
58 | /** |
||
59 | * @var bool |
||
60 | */ |
||
61 | private $async; |
||
62 | |||
63 | /** |
||
64 | * |
||
65 | */ |
||
66 | private $optimizerOptions = []; |
||
67 | |||
68 | /** |
||
69 | * The Intervention image engine. |
||
70 | * |
||
71 | * @var ImageManager |
||
72 | */ |
||
73 | protected $engine; |
||
74 | |||
75 | /** |
||
76 | * @var Filesystem |
||
77 | */ |
||
78 | protected $fs; |
||
79 | |||
80 | /** |
||
81 | * @var Scaler |
||
82 | */ |
||
83 | protected $scaler; |
||
84 | |||
85 | /** |
||
86 | * @var Optimizer |
||
87 | */ |
||
88 | protected $optimizer; |
||
89 | |||
90 | /** |
||
91 | * @var Promise[] |
||
92 | */ |
||
93 | protected $promises; |
||
94 | |||
95 | /** |
||
96 | * ResponsiveFactory constructor. |
||
97 | * |
||
98 | * @param ResponsiveFactoryConfigurator $configurator |
||
99 | */ |
||
100 | public function __construct(ResponsiveFactoryConfigurator $configurator = null) { |
||
118 | |||
119 | /** |
||
120 | * @param string $src |
||
121 | * |
||
122 | * @return ResponsiveImage |
||
123 | * @throws FileNotFoundException |
||
124 | */ |
||
125 | public function create($src) { |
||
176 | |||
177 | /** |
||
178 | * Create scaled image files and add them as sources to a Responsive Image, based on an array of file sizes: |
||
179 | * [ |
||
180 | * width => height, |
||
181 | * ... |
||
182 | * ] |
||
183 | * |
||
184 | * @param SplFileInfo $sourceImage |
||
185 | * @param ResponsiveImage $responsiveImage |
||
186 | * |
||
187 | * @return ResponsiveImage |
||
188 | */ |
||
189 | public function createScaledImages(SplFileInfo $sourceImage, ResponsiveImage $responsiveImage) : ResponsiveImage { |
||
218 | |||
219 | /** |
||
220 | * @param SplFileInfo $sourceImage |
||
221 | * @param ResponsiveImage $responsiveImage |
||
222 | */ |
||
223 | public function scaleProcess(SplFileInfo $sourceImage, ResponsiveImage $responsiveImage) { |
||
245 | |||
246 | /** |
||
247 | * Optimize all sources of a Responsive Image |
||
248 | * |
||
249 | * @param ResponsiveImage $responsiveImage |
||
250 | * |
||
251 | * @return ResponsiveImage |
||
252 | */ |
||
253 | public function optimizeResponsiveImage(ResponsiveImage $responsiveImage) : ResponsiveImage { |
||
260 | |||
261 | /** |
||
262 | * @param string $directory |
||
263 | * @param string $path |
||
264 | * |
||
265 | * @return SplFileInfo |
||
266 | */ |
||
267 | private function getImageFile(string $directory, string $path) : SplFileInfo { |
||
273 | |||
274 | /** |
||
275 | * @param string $driver |
||
276 | * |
||
277 | * @return ResponsiveFactory |
||
278 | */ |
||
279 | public function setDriver($driver) : ResponsiveFactory { |
||
284 | |||
285 | /** |
||
286 | * @param string $publicPath |
||
287 | * |
||
288 | * @return ResponsiveFactory |
||
289 | */ |
||
290 | public function setPublicPath($publicPath) : ResponsiveFactory { |
||
295 | |||
296 | /** |
||
297 | * @param boolean $enableCache |
||
298 | * |
||
299 | * @return ResponsiveFactory |
||
300 | */ |
||
301 | public function setEnableCache($enableCache) : ResponsiveFactory { |
||
306 | |||
307 | /** |
||
308 | * @param string $sourcePath |
||
309 | * |
||
310 | * @return ResponsiveFactory |
||
311 | */ |
||
312 | public function setSourcePath($sourcePath) : ResponsiveFactory { |
||
317 | |||
318 | /** |
||
319 | * @param Scaler $scaler |
||
320 | * |
||
321 | * @return ResponsiveFactory |
||
322 | */ |
||
323 | public function setScaler($scaler) : ResponsiveFactory { |
||
328 | |||
329 | /** |
||
330 | * @param bool $optimize |
||
331 | * |
||
332 | * @return ResponsiveFactory |
||
333 | */ |
||
334 | public function setOptimize(bool $optimize) : ResponsiveFactory { |
||
339 | |||
340 | /** |
||
341 | * @param bool $async |
||
342 | * |
||
343 | * @return ResponsiveFactory |
||
344 | */ |
||
345 | public function setAsync(bool $async) : ResponsiveFactory { |
||
350 | |||
351 | /** |
||
352 | * @return string |
||
353 | */ |
||
354 | public function getPublicPath() : string { |
||
357 | |||
358 | /** |
||
359 | * @param mixed $optimizerOptions |
||
360 | * |
||
361 | * @return ResponsiveFactory |
||
362 | */ |
||
363 | public function setOptimizerOptions($optimizerOptions) : ResponsiveFactory { |
||
368 | |||
369 | } |
||
370 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: