Completed
Pull Request — master (#64)
by
unknown
01:46
created
src/bulletproof.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -127,25 +127,25 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
      * If it returns false, the file is mostly certainly, not an image.
390 390
      * @return bool
391 391
      */
392
-    protected function validateImageSize(){
392
+    protected function validateImageSize() {
393 393
         if (@getimagesize($this->_files["tmp_name"])) {
394 394
             return true;
395 395
         } else {
@@ -409,13 +409,13 @@  discard block
 block discarded – undo
409 409
         $files = $this->_files;
410 410
 
411 411
         /* check if php_exif is enabled */
412
-        if(!function_exists('exif_imagetype')){
412
+        if (!function_exists('exif_imagetype')) {
413 413
             $image->error = "Function 'exif_imagetype' Not found. Please enable \"php_exif\" in your PHP.ini";
414 414
             return null;
415 415
         }
416 416
 
417 417
         /* Check if the image size is ascertainable */
418
-        if ($this->validateImageSize() === false){
418
+        if ($this->validateImageSize() === false) {
419 419
             $ext = implode(", ", $image->mimeTypes);
420 420
             $image->error = sprintf($this->error_messages['mime_type'], $ext);
421 421
             return null;
@@ -431,7 +431,7 @@  discard block
 block discarded – undo
431 431
         list($minSize, $maxSize) = $image->size;
432 432
 
433 433
         /* check for common upload errors */
434
-        if($image->error = $image->uploadErrors($files["error"])){
434
+        if ($image->error = $image->uploadErrors($files["error"])) {
435 435
             return null;
436 436
         }
437 437
 
@@ -461,13 +461,13 @@  discard block
 block discarded – undo
461 461
             return null;
462 462
         }
463 463
 
464
-        if($image->height < 4 || $image->width < 4){
464
+        if ($image->height < 4 || $image->width < 4) {
465 465
             $image->error = $this->error_messages['too_small'];
466 466
             return null;
467 467
         }
468 468
  
469 469
         /* set and get folder name */
470
-        $image->fullPath = $image->location. "/" . $image->name . "." . $image->mime;
470
+        $image->fullPath = $image->location."/".$image->name.".".$image->mime;
471 471
 
472 472
         /* gather image info for json storage */ 
473 473
         $image->serialize = array(
@@ -487,7 +487,7 @@  discard block
 block discarded – undo
487 487
             }
488 488
         }
489 489
 
490
-        $image->error =  $this->error_messages['unknown'];
490
+        $image->error = $this->error_messages['unknown'];
491 491
         return false;
492 492
     }
493 493
 
Please login to merge, or discard this patch.