@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | * |
| 153 | 153 | * @param mixed $offset |
| 154 | 154 | * |
| 155 | - * @return bool|mixed |
|
| 155 | + * @return string|boolean |
|
| 156 | 156 | */ |
| 157 | 157 | public function offsetGet($offset) |
| 158 | 158 | {
|
@@ -364,7 +364,7 @@ discard block |
||
| 364 | 364 | /** |
| 365 | 365 | * Returns error string or false if no errors occurred |
| 366 | 366 | * |
| 367 | - * @return string|bool |
|
| 367 | + * @return string|false |
|
| 368 | 368 | */ |
| 369 | 369 | public function getError(){
|
| 370 | 370 | return $this->error != "" ? $this->error : false; |
@@ -473,7 +473,7 @@ discard block |
||
| 473 | 473 | * Final upload method to be called, isolated for testing purposes |
| 474 | 474 | * |
| 475 | 475 | * @param $tmp_name int the temporary location of the image file |
| 476 | - * @param $destination int upload destination |
|
| 476 | + * @param string $destination int upload destination |
|
| 477 | 477 | * |
| 478 | 478 | * @return bool |
| 479 | 479 | */ |
@@ -127,25 +127,25 @@ discard block |
||
| 127 | 127 | if (isset($this->imageMimes[exif_imagetype($tmp_name)])) {
|
| 128 | 128 | return $this->imageMimes [exif_imagetype($tmp_name)]; |
| 129 | 129 | } |
| 130 | - return ; |
|
| 130 | + return; |
|
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | /** |
| 134 | 134 | * @param mixed $offset |
| 135 | 135 | * @param mixed $value |
| 136 | 136 | */ |
| 137 | - public function offsetSet($offset, $value){}
|
|
| 137 | + public function offsetSet($offset, $value) {}
|
|
| 138 | 138 | |
| 139 | 139 | /** |
| 140 | 140 | * @param mixed $offset |
| 141 | 141 | * @return null |
| 142 | 142 | */ |
| 143 | - public function offsetExists($offset){}
|
|
| 143 | + public function offsetExists($offset) {}
|
|
| 144 | 144 | |
| 145 | 145 | /** |
| 146 | 146 | * @param mixed $offset |
| 147 | 147 | */ |
| 148 | - public function offsetUnset($offset){}
|
|
| 148 | + public function offsetUnset($offset) {}
|
|
| 149 | 149 | |
| 150 | 150 | /** |
| 151 | 151 | * Gets array value \ArrayAccess |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | public function setLocation($dir = "bulletproof", $permission = 0666) |
| 223 | 223 | {
|
| 224 | 224 | if (!file_exists($dir) && !is_dir($dir) && !$this->location) {
|
| 225 | - $createFolder = @mkdir("" . $dir, (int) $permission, true);
|
|
| 225 | + $createFolder = @mkdir("".$dir, (int) $permission, true);
|
|
| 226 | 226 | if (!$createFolder) {
|
| 227 | 227 | $this->error = sprintf($this->error_messages['location'], $dir); |
| 228 | 228 | return; |
@@ -256,7 +256,7 @@ discard block |
||
| 256 | 256 | */ |
| 257 | 257 | public function setErrorMessages($new_error_messages) |
| 258 | 258 | {
|
| 259 | - if($new_array = array_replace_recursive($this->error_messages, $new_error_messages)) {
|
|
| 259 | + if ($new_array = array_replace_recursive($this->error_messages, $new_error_messages)) {
|
|
| 260 | 260 | $this->error_messages = $new_array; |
| 261 | 261 | }; |
| 262 | 262 | return $this; |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | public function getName() |
| 271 | 271 | {
|
| 272 | 272 | if (!$this->name) {
|
| 273 | - return uniqid(true) . "_" . str_shuffle(implode(range("e", "q")));
|
|
| 273 | + return uniqid(true)."_".str_shuffle(implode(range("e", "q")));
|
|
| 274 | 274 | } |
| 275 | 275 | |
| 276 | 276 | return $this->name; |
@@ -283,7 +283,7 @@ discard block |
||
| 283 | 283 | */ |
| 284 | 284 | public function getFullPath() |
| 285 | 285 | {
|
| 286 | - $this->fullPath = $this->location . "/" . $this->name . "." . $this->mime; |
|
| 286 | + $this->fullPath = $this->location."/".$this->name.".".$this->mime; |
|
| 287 | 287 | return $this->fullPath; |
| 288 | 288 | } |
| 289 | 289 | |
@@ -334,7 +334,7 @@ discard block |
||
| 334 | 334 | */ |
| 335 | 335 | public function getLocation() |
| 336 | 336 | {
|
| 337 | - if(!$this->location){
|
|
| 337 | + if (!$this->location) {
|
|
| 338 | 338 | $this->setLocation(); |
| 339 | 339 | } |
| 340 | 340 | |
@@ -358,7 +358,7 @@ discard block |
||
| 358 | 358 | */ |
| 359 | 359 | public function getMime() |
| 360 | 360 | {
|
| 361 | - if(!$this->mime){
|
|
| 361 | + if (!$this->mime) {
|
|
| 362 | 362 | return $this->getImageMime($this->_files["tmp_name"]); |
| 363 | 363 | } |
| 364 | 364 | return $this->mime; |
@@ -369,7 +369,7 @@ discard block |
||
| 369 | 369 | * |
| 370 | 370 | * @return string|bool |
| 371 | 371 | */ |
| 372 | - public function getError(){
|
|
| 372 | + public function getError() {
|
|
| 373 | 373 | return $this->error != "" ? $this->error : false; |
| 374 | 374 | } |
| 375 | 375 | |
@@ -397,7 +397,7 @@ discard block |
||
| 397 | 397 | $files = $this->_files; |
| 398 | 398 | |
| 399 | 399 | /* check if php_exif is enabled */ |
| 400 | - if(!function_exists('exif_imagetype')){
|
|
| 400 | + if (!function_exists('exif_imagetype')) {
|
|
| 401 | 401 | $image->error = "Function 'exif_imagetype' Not found. Please enable \"php_exif\" in your PHP.ini"; |
| 402 | 402 | return null; |
| 403 | 403 | } |
@@ -412,7 +412,7 @@ discard block |
||
| 412 | 412 | list($minSize, $maxSize) = $image->size; |
| 413 | 413 | |
| 414 | 414 | /* check for common upload errors */ |
| 415 | - if($image->error = $image->uploadErrors($files["error"])){
|
|
| 415 | + if ($image->error = $image->uploadErrors($files["error"])) {
|
|
| 416 | 416 | return null; |
| 417 | 417 | } |
| 418 | 418 | |
@@ -442,13 +442,13 @@ discard block |
||
| 442 | 442 | return null; |
| 443 | 443 | } |
| 444 | 444 | |
| 445 | - if($image->height < 4 || $image->width < 4){
|
|
| 445 | + if ($image->height < 4 || $image->width < 4) {
|
|
| 446 | 446 | $image->error = $this->error_messages['too_small']; |
| 447 | 447 | return null; |
| 448 | 448 | } |
| 449 | 449 | |
| 450 | 450 | /* set and get folder name */ |
| 451 | - $image->fullPath = $image->location. "/" . $image->name . "." . $image->mime; |
|
| 451 | + $image->fullPath = $image->location."/".$image->name.".".$image->mime; |
|
| 452 | 452 | |
| 453 | 453 | /* gather image info for json storage */ |
| 454 | 454 | $image->serialize = array( |
@@ -468,7 +468,7 @@ discard block |
||
| 468 | 468 | } |
| 469 | 469 | } |
| 470 | 470 | |
| 471 | - $image->error = $this->error_messages['unknown']; |
|
| 471 | + $image->error = $this->error_messages['unknown']; |
|
| 472 | 472 | return false; |
| 473 | 473 | } |
| 474 | 474 | |