1 | <?php |
||
16 | class ResponsiveFactory |
||
17 | { |
||
18 | |||
19 | /** |
||
20 | * The image driver to use. |
||
21 | * Available drivers: 'gd' and 'imagick'. |
||
22 | * |
||
23 | * @var string |
||
24 | */ |
||
25 | protected $driver; |
||
26 | |||
27 | /** |
||
28 | * The source path to load images from. |
||
29 | * |
||
30 | * @var string |
||
31 | */ |
||
32 | protected $sourcePath; |
||
33 | |||
34 | /** |
||
35 | * The public path to save rendered images. |
||
36 | * |
||
37 | * @var string |
||
38 | */ |
||
39 | protected $publicPath; |
||
40 | |||
41 | /** |
||
42 | * Enabled cache will stop generated images from being overwritten. |
||
43 | * |
||
44 | * @var bool |
||
45 | */ |
||
46 | private $enableCache; |
||
47 | |||
48 | /** |
||
49 | * Enable optimizers will run several image optimizers on the saved files. |
||
50 | * |
||
51 | * @var bool |
||
52 | */ |
||
53 | private $optimize; |
||
54 | |||
55 | /** |
||
56 | * @var bool |
||
57 | */ |
||
58 | private $rebase; |
||
59 | |||
60 | /** |
||
61 | * @var array |
||
62 | */ |
||
63 | private $optimizerOptions = []; |
||
64 | |||
65 | /** |
||
66 | * The Intervention image engine. |
||
67 | * |
||
68 | * @var ImageManager |
||
69 | */ |
||
70 | protected $engine; |
||
71 | |||
72 | /** |
||
73 | * @var Filesystem |
||
74 | */ |
||
75 | protected $fs; |
||
76 | |||
77 | /** |
||
78 | * @var Scaler |
||
79 | */ |
||
80 | protected $scaler; |
||
81 | |||
82 | /** |
||
83 | * @var Optimizer |
||
84 | */ |
||
85 | protected $optimizer; |
||
86 | |||
87 | /** |
||
88 | * ResponsiveFactory constructor. |
||
89 | * |
||
90 | * @param ResponsiveFactoryConfigurator $configurator |
||
91 | */ |
||
92 | public function __construct(ResponsiveFactoryConfigurator $configurator = null) { |
||
110 | |||
111 | /** |
||
112 | * @param string $src |
||
113 | * |
||
114 | * @return ResponsiveImage |
||
115 | * @throws FileNotFoundException |
||
116 | */ |
||
117 | 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 { |
||
197 | |||
198 | /** |
||
199 | * @param SplFileInfo $sourceImage |
||
200 | * @param ResponsiveImage $responsiveImage |
||
201 | */ |
||
202 | public function scaleProcess(SplFileInfo $sourceImage, ResponsiveImage $responsiveImage) { |
||
224 | |||
225 | /** |
||
226 | * Optimize all sources of a Responsive Image |
||
227 | * |
||
228 | * @param ResponsiveImage $responsiveImage |
||
229 | * |
||
230 | * @return ResponsiveImage |
||
231 | */ |
||
232 | public function optimizeResponsiveImage(ResponsiveImage $responsiveImage) : ResponsiveImage { |
||
239 | |||
240 | /** |
||
241 | * @param string $directory |
||
242 | * @param string $path |
||
243 | * |
||
244 | * @return SplFileInfo |
||
245 | */ |
||
246 | private function getImageFile(string $directory, string $path) : ?SplFileInfo { |
||
252 | |||
253 | /** |
||
254 | * @param string $driver |
||
255 | * |
||
256 | * @return ResponsiveFactory |
||
257 | */ |
||
258 | public function setDriver($driver) : ResponsiveFactory { |
||
263 | |||
264 | /** |
||
265 | * @param string $publicPath |
||
266 | * |
||
267 | * @return ResponsiveFactory |
||
268 | */ |
||
269 | public function setPublicPath($publicPath) : ResponsiveFactory { |
||
274 | |||
275 | /** |
||
276 | * @param boolean $enableCache |
||
277 | * |
||
278 | * @return ResponsiveFactory |
||
279 | */ |
||
280 | public function setEnableCache($enableCache) : ResponsiveFactory { |
||
285 | |||
286 | /** |
||
287 | * @param string $sourcePath |
||
288 | * |
||
289 | * @return ResponsiveFactory |
||
290 | */ |
||
291 | public function setSourcePath($sourcePath) : ResponsiveFactory { |
||
296 | |||
297 | /** |
||
298 | * @param Scaler $scaler |
||
299 | * |
||
300 | * @return ResponsiveFactory |
||
301 | */ |
||
302 | public function setScaler($scaler) : ResponsiveFactory { |
||
307 | |||
308 | /** |
||
309 | * @param bool $optimize |
||
310 | * |
||
311 | * @return ResponsiveFactory |
||
312 | */ |
||
313 | public function setOptimize(bool $optimize) : ResponsiveFactory { |
||
318 | |||
319 | /** |
||
320 | * @return string |
||
321 | */ |
||
322 | public function getPublicPath() : string { |
||
325 | |||
326 | /** |
||
327 | * @param mixed $optimizerOptions |
||
328 | * |
||
329 | * @return ResponsiveFactory |
||
330 | */ |
||
331 | public function setOptimizerOptions($optimizerOptions) : ResponsiveFactory { |
||
336 | |||
337 | /** |
||
338 | * @param bool $rebase |
||
339 | * |
||
340 | * @return ResponsiveFactory |
||
341 | */ |
||
342 | public function setRebase(bool $rebase) : ResponsiveFactory { |
||
347 | |||
348 | } |
||
349 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..