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 | * The Intervention image engine. |
||
65 | * |
||
66 | * @var ImageManager |
||
67 | */ |
||
68 | protected $engine; |
||
69 | |||
70 | /** |
||
71 | * @var Filesystem |
||
72 | */ |
||
73 | protected $fs; |
||
74 | |||
75 | /** |
||
76 | * @var Scaler |
||
77 | */ |
||
78 | protected $scaler; |
||
79 | |||
80 | /** |
||
81 | * @var Optimizer |
||
82 | */ |
||
83 | protected $optimizer; |
||
84 | |||
85 | /** |
||
86 | * @var Promise[] |
||
87 | */ |
||
88 | protected $promises; |
||
89 | |||
90 | /** |
||
91 | * ResponsiveFactory constructor. |
||
92 | * |
||
93 | * @param ResponsiveFactoryConfigurator $configurator |
||
94 | */ |
||
95 | public function __construct(ResponsiveFactoryConfigurator $configurator = null) { |
||
112 | |||
113 | /** |
||
114 | * @param string $src |
||
115 | * |
||
116 | * @return ResponsiveImage |
||
117 | * @throws FileNotFoundException |
||
118 | */ |
||
119 | public function create($src) { |
||
170 | |||
171 | /** |
||
172 | * Create scaled image files and add them as sources to a Responsive Image, based on an array of file sizes: |
||
173 | * [ |
||
174 | * width => height, |
||
175 | * ... |
||
176 | * ] |
||
177 | * |
||
178 | * @param SplFileInfo $sourceImage |
||
179 | * @param ResponsiveImage $responsiveImage |
||
180 | * |
||
181 | * @return ResponsiveImage |
||
182 | */ |
||
183 | public function createScaledImages(SplFileInfo $sourceImage, ResponsiveImage $responsiveImage) : ResponsiveImage { |
||
212 | |||
213 | /** |
||
214 | * @param SplFileInfo $sourceImage |
||
215 | * @param ResponsiveImage $responsiveImage |
||
216 | */ |
||
217 | public function scaleProcess(SplFileInfo $sourceImage, ResponsiveImage $responsiveImage) { |
||
239 | |||
240 | /** |
||
241 | * Optimize all sources of a Responsive Image |
||
242 | * |
||
243 | * @param ResponsiveImage $responsiveImage |
||
244 | * |
||
245 | * @return ResponsiveImage |
||
246 | */ |
||
247 | public function optimizeResponsiveImage(ResponsiveImage $responsiveImage) : ResponsiveImage { |
||
254 | |||
255 | /** |
||
256 | * @param string $directory |
||
257 | * @param string $path |
||
258 | * |
||
259 | * @return SplFileInfo |
||
260 | */ |
||
261 | private function getImageFile(string $directory, string $path) : SplFileInfo { |
||
267 | |||
268 | /** |
||
269 | * @param string $driver |
||
270 | * |
||
271 | * @return ResponsiveFactory |
||
272 | */ |
||
273 | public function setDriver($driver) : ResponsiveFactory { |
||
278 | |||
279 | /** |
||
280 | * @param string $publicPath |
||
281 | * |
||
282 | * @return ResponsiveFactory |
||
283 | */ |
||
284 | public function setPublicPath($publicPath) : ResponsiveFactory { |
||
289 | |||
290 | /** |
||
291 | * @param boolean $enableCache |
||
292 | * |
||
293 | * @return ResponsiveFactory |
||
294 | */ |
||
295 | public function setEnableCache($enableCache) : ResponsiveFactory { |
||
300 | |||
301 | /** |
||
302 | * @param string $sourcePath |
||
303 | * |
||
304 | * @return ResponsiveFactory |
||
305 | */ |
||
306 | public function setSourcePath($sourcePath) : ResponsiveFactory { |
||
311 | |||
312 | /** |
||
313 | * @param Scaler $scaler |
||
314 | * |
||
315 | * @return ResponsiveFactory |
||
316 | */ |
||
317 | public function setScaler($scaler) : ResponsiveFactory { |
||
322 | |||
323 | /** |
||
324 | * @param bool $optimize |
||
325 | * |
||
326 | * @return ResponsiveFactory |
||
327 | */ |
||
328 | public function setOptimize(bool $optimize) : ResponsiveFactory { |
||
333 | |||
334 | /** |
||
335 | * @param bool $async |
||
336 | * |
||
337 | * @return ResponsiveFactory |
||
338 | */ |
||
339 | public function setAsync(bool $async) : ResponsiveFactory { |
||
344 | |||
345 | /** |
||
346 | * @return string |
||
347 | */ |
||
348 | public function getPublicPath() : string { |
||
351 | |||
352 | } |
||
353 |
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: