@@ -102,8 +102,7 @@ discard block |
||
102 | 102 | /** |
103 | 103 | * @param array $_files represents the $_FILES array passed as dependency |
104 | 104 | */ |
105 | - public function __construct(array $_files = array()) |
|
106 | - { |
|
105 | + public function __construct(array $_files = array()) { |
|
107 | 106 | /* check if php_exif is enabled */ |
108 | 107 | if (!function_exists('exif_imagetype')) { |
109 | 108 | $this->error = 'Function \'exif_imagetype\' Not found. Please enable \'php_exif\' in your PHP.ini'; |
@@ -120,8 +119,7 @@ discard block |
||
120 | 119 | * |
121 | 120 | * @return null|string |
122 | 121 | */ |
123 | - protected function getImageMime($tmp_name) |
|
124 | - { |
|
122 | + protected function getImageMime($tmp_name) { |
|
125 | 123 | $mime = @$this->imageMimes[exif_imagetype($tmp_name)]; |
126 | 124 | |
127 | 125 | if (!$mime) { |
@@ -135,23 +133,20 @@ discard block |
||
135 | 133 | * @param mixed $offset |
136 | 134 | * @param mixed $value |
137 | 135 | */ |
138 | - public function offsetSet($offset, $value) |
|
139 | - { |
|
136 | + public function offsetSet($offset, $value) { |
|
140 | 137 | } |
141 | 138 | |
142 | 139 | /** |
143 | 140 | * @param mixed $offset |
144 | 141 | * @return null |
145 | 142 | */ |
146 | - public function offsetExists($offset) |
|
147 | - { |
|
143 | + public function offsetExists($offset) { |
|
148 | 144 | } |
149 | 145 | |
150 | 146 | /** |
151 | 147 | * @param mixed $offset |
152 | 148 | */ |
153 | - public function offsetUnset($offset) |
|
154 | - { |
|
149 | + public function offsetUnset($offset) { |
|
155 | 150 | } |
156 | 151 | |
157 | 152 | /** |
@@ -161,8 +156,7 @@ discard block |
||
161 | 156 | * |
162 | 157 | * @return bool |
163 | 158 | */ |
164 | - public function offsetGet($offset) |
|
165 | - { |
|
159 | + public function offsetGet($offset) { |
|
166 | 160 | if ($offset == 'error') { |
167 | 161 | return $this->error; |
168 | 162 | } |
@@ -196,8 +190,7 @@ discard block |
||
196 | 190 | * @param null $isNameProvided |
197 | 191 | * @return $this |
198 | 192 | */ |
199 | - public function setName($isNameProvided = null) |
|
200 | - { |
|
193 | + public function setName($isNameProvided = null) { |
|
201 | 194 | if ($isNameProvided) { |
202 | 195 | $this->name = filter_var($isNameProvided, FILTER_SANITIZE_STRING); |
203 | 196 | } |
@@ -212,8 +205,7 @@ discard block |
||
212 | 205 | * |
213 | 206 | * @return $this |
214 | 207 | */ |
215 | - public function setMime(array $fileTypes) |
|
216 | - { |
|
208 | + public function setMime(array $fileTypes) { |
|
217 | 209 | $this->mimeTypes = $fileTypes; |
218 | 210 | return $this; |
219 | 211 | } |
@@ -226,8 +218,7 @@ discard block |
||
226 | 218 | * |
227 | 219 | * @return $this |
228 | 220 | */ |
229 | - public function setSize($min, $max) |
|
230 | - { |
|
221 | + public function setSize($min, $max) { |
|
231 | 222 | $this->size = array($min, $max); |
232 | 223 | return $this; |
233 | 224 | } |
@@ -240,8 +231,7 @@ discard block |
||
240 | 231 | * |
241 | 232 | * @return $this |
242 | 233 | */ |
243 | - public function setLocation($dir = 'bulletproof', $permission = 0666) |
|
244 | - { |
|
234 | + public function setLocation($dir = 'bulletproof', $permission = 0666) { |
|
245 | 235 | |
246 | 236 | if (!file_exists($dir) && !is_dir($dir) && !$this->location) { |
247 | 237 | $createFolder = @mkdir('' . $dir, (int)$permission, true); |
@@ -269,8 +259,7 @@ discard block |
||
269 | 259 | * |
270 | 260 | * @return $this |
271 | 261 | */ |
272 | - public function setDimension($maxWidth, $maxHeight) |
|
273 | - { |
|
262 | + public function setDimension($maxWidth, $maxHeight) { |
|
274 | 263 | $this->dimensions = array($maxWidth, $maxHeight); |
275 | 264 | return $this; |
276 | 265 | } |
@@ -280,8 +269,7 @@ discard block |
||
280 | 269 | * |
281 | 270 | * @return string |
282 | 271 | */ |
283 | - public function getName() |
|
284 | - { |
|
272 | + public function getName() { |
|
285 | 273 | if (!$this->name) { |
286 | 274 | return uniqid('', true) . '_' . str_shuffle(implode(range('e', 'q'))); |
287 | 275 | } |
@@ -294,8 +282,7 @@ discard block |
||
294 | 282 | * |
295 | 283 | * @return string |
296 | 284 | */ |
297 | - public function getFullPath() |
|
298 | - { |
|
285 | + public function getFullPath() { |
|
299 | 286 | $this->fullPath = $this->location . '/' . $this->name . '.' . $this->mime; |
300 | 287 | return $this->fullPath; |
301 | 288 | } |
@@ -305,8 +292,7 @@ discard block |
||
305 | 292 | * |
306 | 293 | * @return int |
307 | 294 | */ |
308 | - public function getSize() |
|
309 | - { |
|
295 | + public function getSize() { |
|
310 | 296 | return (int)$this->_files['size']; |
311 | 297 | } |
312 | 298 | |
@@ -315,8 +301,7 @@ discard block |
||
315 | 301 | * |
316 | 302 | * @return int |
317 | 303 | */ |
318 | - public function getHeight() |
|
319 | - { |
|
304 | + public function getHeight() { |
|
320 | 305 | if ($this->height != null) { |
321 | 306 | return $this->height; |
322 | 307 | } |
@@ -330,8 +315,7 @@ discard block |
||
330 | 315 | * |
331 | 316 | * @return int |
332 | 317 | */ |
333 | - public function getWidth() |
|
334 | - { |
|
318 | + public function getWidth() { |
|
335 | 319 | if ($this->width != null) { |
336 | 320 | return $this->width; |
337 | 321 | } |
@@ -345,8 +329,7 @@ discard block |
||
345 | 329 | * |
346 | 330 | * @return string |
347 | 331 | */ |
348 | - public function getLocation() |
|
349 | - { |
|
332 | + public function getLocation() { |
|
350 | 333 | if (!$this->location) { |
351 | 334 | $this->setLocation(); |
352 | 335 | } |
@@ -359,8 +342,7 @@ discard block |
||
359 | 342 | * |
360 | 343 | * @return string |
361 | 344 | */ |
362 | - public function getJson() |
|
363 | - { |
|
345 | + public function getJson() { |
|
364 | 346 | return json_encode($this->serialize); |
365 | 347 | } |
366 | 348 | |
@@ -369,8 +351,7 @@ discard block |
||
369 | 351 | * |
370 | 352 | * @return string |
371 | 353 | */ |
372 | - public function getMime() |
|
373 | - { |
|
354 | + public function getMime() { |
|
374 | 355 | if (!$this->mime) { |
375 | 356 | return $this->getImageMime($this->_files['tmp_name']); |
376 | 357 | } |
@@ -382,8 +363,7 @@ discard block |
||
382 | 363 | * |
383 | 364 | * @return string|bool |
384 | 365 | */ |
385 | - public function getError() |
|
386 | - { |
|
366 | + public function getError() { |
|
387 | 367 | return $this->error != '' ? $this->error : false; |
388 | 368 | } |
389 | 369 | |
@@ -394,8 +374,7 @@ discard block |
||
394 | 374 | * |
395 | 375 | * @return string |
396 | 376 | */ |
397 | - protected function commonUploadErrors($errors) |
|
398 | - { |
|
377 | + protected function commonUploadErrors($errors) { |
|
399 | 378 | return $this->common_upload_errors[$errors]; |
400 | 379 | } |
401 | 380 | |
@@ -403,8 +382,7 @@ discard block |
||
403 | 382 | * This methods validates and uploads the image |
404 | 383 | * @return false|Image |
405 | 384 | */ |
406 | - public function upload() |
|
407 | - { |
|
385 | + public function upload() { |
|
408 | 386 | /* modify variable names for convenience */ |
409 | 387 | $image = $this; |
410 | 388 | $files = $this->_files; |
@@ -483,8 +461,7 @@ discard block |
||
483 | 461 | * |
484 | 462 | * @return bool |
485 | 463 | */ |
486 | - public function moveUploadedFile($tmp_name, $destination) |
|
487 | - { |
|
464 | + public function moveUploadedFile($tmp_name, $destination) { |
|
488 | 465 | return move_uploaded_file($tmp_name, $destination); |
489 | 466 | } |
490 | 467 | } |