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 { |
||
208 | |||
209 | /** |
||
210 | * Optimize all sources of a Responsive Image |
||
211 | * |
||
212 | * @param ResponsiveImage $responsiveImage |
||
213 | * |
||
214 | * @return ResponsiveImage |
||
215 | */ |
||
216 | private function optimizeResponsiveImage(ResponsiveImage $responsiveImage) : ResponsiveImage { |
||
223 | |||
224 | /** |
||
225 | * @param string $directory |
||
226 | * @param string $path |
||
227 | * |
||
228 | * @return SplFileInfo |
||
229 | */ |
||
230 | private function getImageFile(string $directory, string $path) : ?SplFileInfo { |
||
236 | |||
237 | /** |
||
238 | * @param string $driver |
||
239 | * |
||
240 | * @return ResponsiveFactory |
||
241 | */ |
||
242 | public function setDriver($driver) : ResponsiveFactory { |
||
247 | |||
248 | /** |
||
249 | * @param string $publicPath |
||
250 | * |
||
251 | * @return ResponsiveFactory |
||
252 | */ |
||
253 | public function setPublicPath($publicPath) : ResponsiveFactory { |
||
258 | |||
259 | /** |
||
260 | * @param boolean $enableCache |
||
261 | * |
||
262 | * @return ResponsiveFactory |
||
263 | */ |
||
264 | public function setEnableCache($enableCache) : ResponsiveFactory { |
||
269 | |||
270 | /** |
||
271 | * @param string $sourcePath |
||
272 | * |
||
273 | * @return ResponsiveFactory |
||
274 | */ |
||
275 | public function setSourcePath($sourcePath) : ResponsiveFactory { |
||
280 | |||
281 | /** |
||
282 | * @param Scaler $scaler |
||
283 | * |
||
284 | * @return ResponsiveFactory |
||
285 | */ |
||
286 | public function setScaler($scaler) : ResponsiveFactory { |
||
291 | |||
292 | /** |
||
293 | * @param bool $optimize |
||
294 | * |
||
295 | * @return ResponsiveFactory |
||
296 | */ |
||
297 | public function setOptimize(bool $optimize) : ResponsiveFactory { |
||
302 | |||
303 | /** |
||
304 | * @return string |
||
305 | */ |
||
306 | public function getPublicPath() : string { |
||
309 | |||
310 | /** |
||
311 | * @param mixed $optimizerOptions |
||
312 | * |
||
313 | * @return ResponsiveFactory |
||
314 | */ |
||
315 | public function setOptimizerOptions($optimizerOptions) : ResponsiveFactory { |
||
320 | |||
321 | /** |
||
322 | * @param bool $rebase |
||
323 | * |
||
324 | * @return ResponsiveFactory |
||
325 | */ |
||
326 | public function setRebase(bool $rebase) : ResponsiveFactory { |
||
331 | |||
332 | } |
||
333 |
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..