@@ -114,21 +114,21 @@ discard block |
||
114 | 114 | * |
115 | 115 | * @return null |
116 | 116 | */ |
117 | - public function offsetSet($offset, $value){} |
|
117 | + public function offsetSet($offset, $value) {} |
|
118 | 118 | |
119 | 119 | /** |
120 | 120 | * @param mixed $offset |
121 | 121 | * |
122 | 122 | * @return null |
123 | 123 | */ |
124 | - public function offsetExists($offset){} |
|
124 | + public function offsetExists($offset) {} |
|
125 | 125 | |
126 | 126 | /** |
127 | 127 | * @param mixed $offset |
128 | 128 | * |
129 | 129 | * @return null |
130 | 130 | */ |
131 | - public function offsetUnset($offset){} |
|
131 | + public function offsetUnset($offset) {} |
|
132 | 132 | |
133 | 133 | /** |
134 | 134 | * Gets array value \ArrayAccess |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | $this->_files = $this->_files[$offset]; |
149 | 149 | |
150 | 150 | // check for common upload errors |
151 | - if(isset($this->_files['error'])){ |
|
151 | + if (isset($this->_files['error'])) { |
|
152 | 152 | $this->error = $this->commonUploadErrors[$this->_files['error']]; |
153 | 153 | } |
154 | 154 | |
@@ -165,9 +165,9 @@ discard block |
||
165 | 165 | */ |
166 | 166 | public function setDimension($maxWidth, $maxHeight) |
167 | 167 | { |
168 | - if((int) $maxWidth && (int) $maxHeight){ |
|
168 | + if ((int) $maxWidth && (int) $maxHeight) { |
|
169 | 169 | $this->dimensions = array($maxWidth, $maxHeight); |
170 | - }else{ |
|
170 | + } else { |
|
171 | 171 | $this->error = 'Invalid dimention! Values must be integers'; |
172 | 172 | } |
173 | 173 | |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | */ |
182 | 182 | public function getFullPath() |
183 | 183 | { |
184 | - return $this->fullPath = $this->getLocation() . '/' . $this->getName() . '.' . $this->getMime(); |
|
184 | + return $this->fullPath = $this->getLocation().'/'.$this->getName().'.'.$this->getMime(); |
|
185 | 185 | } |
186 | 186 | |
187 | 187 | /** |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | */ |
216 | 216 | public function getJson() |
217 | 217 | { |
218 | - return json_encode ( |
|
218 | + return json_encode( |
|
219 | 219 | array( |
220 | 220 | 'name' => $this->name, |
221 | 221 | 'mime' => $this->mime, |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | */ |
236 | 236 | public function getMime() |
237 | 237 | { |
238 | - if(!$this->mime){ |
|
238 | + if (!$this->mime) { |
|
239 | 239 | $this->mime = $this->getImageMime($this->_files['tmp_name']); |
240 | 240 | } |
241 | 241 | |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | public function getName() |
291 | 291 | { |
292 | 292 | if (!$this->name) { |
293 | - $this->name = uniqid('', true) . '_' . str_shuffle(implode(range('e', 'q'))); |
|
293 | + $this->name = uniqid('', true).'_'.str_shuffle(implode(range('e', 'q'))); |
|
294 | 294 | } |
295 | 295 | |
296 | 296 | return $this->name; |
@@ -377,15 +377,15 @@ discard block |
||
377 | 377 | { |
378 | 378 | $isDirectoryValid = $this->isDirectoryValid($dir); |
379 | 379 | |
380 | - if(!$isDirectoryValid){ |
|
381 | - $this->error = 'Can not create a directory \'' . $dir . '\', please check your dir permission'; |
|
380 | + if (!$isDirectoryValid) { |
|
381 | + $this->error = 'Can not create a directory \''.$dir.'\', please check your dir permission'; |
|
382 | 382 | return false; |
383 | 383 | } |
384 | 384 | |
385 | - $create = !is_dir($dir) ? @mkdir('' . $dir, (int) $permission, true) : true; |
|
385 | + $create = !is_dir($dir) ? @mkdir(''.$dir, (int) $permission, true) : true; |
|
386 | 386 | |
387 | 387 | if (!$create) { |
388 | - $this->error = 'Error! directory \'' . $dir . '\' could not be created'; |
|
388 | + $this->error = 'Error! directory \''.$dir.'\' could not be created'; |
|
389 | 389 | return false; |
390 | 390 | } |
391 | 391 | |
@@ -426,17 +426,17 @@ discard block |
||
426 | 426 | |
427 | 427 | /* check image size based on the settings */ |
428 | 428 | if ($files['size'] < $minSize || $files['size'] > $maxSize) { |
429 | - $min = $minSize . ' bytes ('.intval($minSize / 1000) .' kb)'; |
|
430 | - $max = $maxSize . ' bytes ('.intval($maxSize / 1000) .' kb)'; |
|
431 | - $image->error = 'Image size should be minumum ' . $min . ', upto maximum ' . $max; |
|
429 | + $min = $minSize.' bytes ('.intval($minSize / 1000).' kb)'; |
|
430 | + $max = $maxSize.' bytes ('.intval($maxSize / 1000).' kb)'; |
|
431 | + $image->error = 'Image size should be minumum '.$min.', upto maximum '.$max; |
|
432 | 432 | return false; |
433 | 433 | } |
434 | 434 | |
435 | 435 | /* check image dimension */ |
436 | 436 | list($allowedWidth, $allowedHeight) = $image->dimensions; |
437 | 437 | |
438 | - if ($image->height > $allowedHeight || $image->width > $allowedWidth ) { |
|
439 | - $image->error = 'Image height/width should be less than ' . $allowedHeight . '/' . $allowedWidth . ' pixels'; |
|
438 | + if ($image->height > $allowedHeight || $image->width > $allowedWidth) { |
|
439 | + $image->error = 'Image height/width should be less than '.$allowedHeight.'/'.$allowedWidth.' pixels'; |
|
440 | 440 | return false; |
441 | 441 | } |
442 | 442 |