@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | |
192 | 192 | /** |
193 | 193 | * @param $fileName |
194 | - * @return mixed |
|
194 | + * @return boolean |
|
195 | 195 | */ |
196 | 196 | public function fileExists($fileName) |
197 | 197 | { |
@@ -203,8 +203,8 @@ discard block |
||
203 | 203 | /** |
204 | 204 | * Deletes a directory and its contents or a file. |
205 | 205 | * |
206 | - * @param $target |
|
207 | - * @return bool |
|
206 | + * @param string $target |
|
207 | + * @return boolean|null |
|
208 | 208 | */ |
209 | 209 | public function deleteDirectory($target) |
210 | 210 | { |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | |
232 | 232 | /** |
233 | 233 | * @param $path |
234 | - * @return bool |
|
234 | + * @return boolean|null |
|
235 | 235 | */ |
236 | 236 | public function deleteFile($path) |
237 | 237 | { |
@@ -389,7 +389,7 @@ discard block |
||
389 | 389 | /** |
390 | 390 | * Ensures that a string has a trailing slash or not. |
391 | 391 | * |
392 | - * @param $path |
|
392 | + * @param boolean|string $path |
|
393 | 393 | * @param bool $slash |
394 | 394 | * @return string |
395 | 395 | */ |
@@ -115,7 +115,7 @@ |
||
115 | 115 | * |
116 | 116 | * @param $source |
117 | 117 | * @param $destination |
118 | - * @param array $style |
|
118 | + * @param boolean $style |
|
119 | 119 | * @param null $cropFocusCoords |
120 | 120 | * @return string |
121 | 121 | */ |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | |
97 | 97 | protected function scaleImage($width, $height) |
98 | 98 | { |
99 | - $this->img->resize($width, $height, function ($constraint) { |
|
99 | + $this->img->resize($width, $height, function($constraint) { |
|
100 | 100 | $constraint->aspectRatio(); |
101 | 101 | }); |
102 | 102 | } |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | } |
161 | 161 | } |
162 | 162 | |
163 | - $this->img->fit($this->styleData['width'], $this->styleData['height'], function ($constraint) { |
|
163 | + $this->img->fit($this->styleData['width'], $this->styleData['height'], function($constraint) { |
|
164 | 164 | $constraint->upsize(); |
165 | 165 | }); |
166 | 166 |
@@ -82,9 +82,9 @@ discard block |
||
82 | 82 | * Creates styled images for an image object. |
83 | 83 | * Handles generation from the controller or the form. |
84 | 84 | * |
85 | - * @param $imageObject |
|
85 | + * @param ResponsiveImageInterface $imageObject |
|
86 | 86 | * @param $styleName |
87 | - * @return mixed |
|
87 | + * @return string |
|
88 | 88 | */ |
89 | 89 | private function createImageDerivative($imageObject, $styleName = NULL) |
90 | 90 | { |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | * |
117 | 117 | * @param ResponsiveImageInterface $image |
118 | 118 | * @paran string $stylename |
119 | - * @return image |
|
119 | + * @return string |
|
120 | 120 | */ |
121 | 121 | public function createStyledImages(ResponsiveImageInterface $image, $stylename = NULL) |
122 | 122 | { |
@@ -227,13 +227,13 @@ discard block |
||
227 | 227 | |
228 | 228 | // Check if the file exists on the server. |
229 | 229 | if (!$this->system->fileExists($filename)) { |
230 | - $fetchFromS3 = TRUE; |
|
230 | + $fetchFromS3 = TRUE; |
|
231 | 231 | } |
232 | 232 | $tree = $this->system->getUploadsDirectory() . '/' . $filename; |
233 | 233 | // If the policy was set to keep no files locally, then original should be downloaded from s3. |
234 | 234 | if (!empty($fetchFromS3)) { |
235 | - $s3key = empty($this->config['aws_s3']['directory']) ? $tree : $this->config['aws_s3']['directory'] . '/' . $tree; |
|
236 | - $this->system->directoryExists($directory , TRUE); |
|
235 | + $s3key = empty($this->config['aws_s3']['directory']) ? $tree : $this->config['aws_s3']['directory'] . '/' . $tree; |
|
236 | + $this->system->directoryExists($directory, TRUE); |
|
237 | 237 | $this->s3->fetchS3Object($path, $s3key); |
238 | 238 | } |
239 | 239 | |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | $enabled = $this->s3enabled(); |
267 | 267 | if ($enabled) { |
268 | 268 | $aws_config = $this->config['aws_s3']; |
269 | - $remoteFilePolicy = empty($aws_config['remote_file_policy']) ? 'ALL': $aws_config['remote_file_policy']; |
|
269 | + $remoteFilePolicy = empty($aws_config['remote_file_policy']) ? 'ALL' : $aws_config['remote_file_policy']; |
|
270 | 270 | |
271 | 271 | // If AWS is enabled. |
272 | 272 | if ($enabled) { |
@@ -96,8 +96,7 @@ discard block |
||
96 | 96 | if (!empty($styleName)) { |
97 | 97 | // $paths = []; |
98 | 98 | $paths = [$styleName => $paths[$styleName]]; |
99 | - } |
|
100 | - else { |
|
99 | + } else { |
|
101 | 100 | unset($paths[0]); |
102 | 101 | } |
103 | 102 | |
@@ -175,8 +174,7 @@ discard block |
||
175 | 174 | // @TODO: at yet implemented. |
176 | 175 | if (empty($styles)) { |
177 | 176 | // Delete all styled files. |
178 | - } |
|
179 | - else { |
|
177 | + } else { |
|
180 | 178 | // Delete files for the given style. |
181 | 179 | } |
182 | 180 | } |
@@ -219,8 +217,7 @@ discard block |
||
219 | 217 | $fetchFromS3 = FALSE; |
220 | 218 | if (!empty($this->images[0])) { |
221 | 219 | return $this->images[0][0]; |
222 | - } |
|
223 | - else { |
|
220 | + } else { |
|
224 | 221 | // The original file is in difference places depending on the local file policy. |
225 | 222 | $directory = $this->system->getStorageDirectory('original'); |
226 | 223 | $path = $directory . $filename; |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | /** |
38 | 38 | * StyleManager constructor. |
39 | 39 | * |
40 | - * @param \ResponsiveImageBundle\FileManager $system |
|
40 | + * @param FileManager $system |
|
41 | 41 | * @param array $parameters |
42 | 42 | */ |
43 | 43 | public function __construct(FileManager $system, array $parameters) |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | /** |
164 | 164 | * Prefixes url string with the displayPathPrefix string, if the style and the config require it. |
165 | 165 | * |
166 | - * @param $url |
|
166 | + * @param string $url |
|
167 | 167 | * @param $style |
168 | 168 | * @return string |
169 | 169 | */ |
@@ -67,6 +67,9 @@ discard block |
||
67 | 67 | return $this->path; |
68 | 68 | } |
69 | 69 | |
70 | + /** |
|
71 | + * @param string $path |
|
72 | + */ |
|
70 | 73 | public function setPath($path) |
71 | 74 | { |
72 | 75 | $this->path = $path; |
@@ -156,7 +159,6 @@ discard block |
||
156 | 159 | /** |
157 | 160 | * Generates an <img> tag for a given style. |
158 | 161 | * |
159 | - * @param null $style |
|
160 | 162 | * @return string |
161 | 163 | */ |
162 | 164 | public function img() |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | * Sanitizes and cleans up filename |
68 | 68 | * |
69 | 69 | * @param $str |
70 | - * @return mixed |
|
70 | + * @return string |
|
71 | 71 | */ |
72 | 72 | private function createFilename($str) |
73 | 73 | { |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | /** |
91 | 91 | * Convert MB/K/G to bytesize |
92 | 92 | * |
93 | - * @param $uploadMaxSize |
|
93 | + * @param string $uploadMaxSize |
|
94 | 94 | * @return int |
95 | 95 | */ |
96 | 96 | public function mToBytes($uploadMaxSize) |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | /** |
119 | 119 | * Checks to see if a file name is unique in the storage directory. |
120 | 120 | * |
121 | - * @param $name |
|
121 | + * @param string $name |
|
122 | 122 | * @return bool |
123 | 123 | */ |
124 | 124 | private function isUniqueFilename($name) |
@@ -28,7 +28,7 @@ |
||
28 | 28 | ->add('title') |
29 | 29 | ->add('alt'); |
30 | 30 | |
31 | - $builder->addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $event) { |
|
31 | + $builder->addEventListener(FormEvents::PRE_SET_DATA, function(FormEvent $event) { |
|
32 | 32 | $image = $event->getData(); |
33 | 33 | $form = $event->getForm(); |
34 | 34 | // Conditionally add form elements. |
@@ -101,9 +101,9 @@ |
||
101 | 101 | $focusY2 = $this->focusCoordinates[3]; |
102 | 102 | |
103 | 103 | if ($type == 'near') { |
104 | - $point = ${'focus' . $axis . '1'} - ${'crop' . $axis . '1'}; |
|
104 | + $point = ${'focus' . $axis . '1'} -${'crop' . $axis . '1'}; |
|
105 | 105 | } else { |
106 | - $point = ${'focus' . $axis . '2'} - ${'crop' . $axis . '1'}; |
|
106 | + $point = ${'focus' . $axis . '2'} -${'crop' . $axis . '1'}; |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | return $point; |
@@ -104,8 +104,8 @@ |
||
104 | 104 | // ->values(['KEEP_ALL', 'KEEP_NONE', 'KEEP_ORIGINAL']) |
105 | 105 | // ->end() |
106 | 106 | ->enumNode('remote_file_policy') |
107 | - ->defaultValue('ALL') |
|
108 | - ->values(['ALL', 'STYLED_ONLY']) |
|
107 | + ->defaultValue('ALL') |
|
108 | + ->values(['ALL', 'STYLED_ONLY']) |
|
109 | 109 | ->end() |
110 | 110 | ->scalarNode('temp_directory') |
111 | 111 | ->defaultValue(null) |