Completed
Push — master ( 647094...69506e )
by samayo
01:22
created
src/bulletproof.php 1 patch
Braces   +23 added lines, -46 removed lines patch added patch discarded remove patch
@@ -99,8 +99,7 @@  discard block
 block discarded – undo
99 99
     /**
100 100
      * @param array $_files represents the $_FILES array passed as dependency
101 101
      */
102
-    public function __construct(array $_files = array())
103
-    {
102
+    public function __construct(array $_files = array()) {
104 103
         /* check if php_exif is enabled */
105 104
         if (!function_exists('exif_imagetype')) {
106 105
             $this->error = 'Function \'exif_imagetype\' Not found. Please enable \'php_exif\' in your PHP.ini';
@@ -114,23 +113,20 @@  discard block
 block discarded – undo
114 113
      * @param mixed $offset
115 114
      * @param mixed $value
116 115
      */
117
-    public function offsetSet($offset, $value)
118
-    {
116
+    public function offsetSet($offset, $value) {
119 117
     }
120 118
 
121 119
     /**
122 120
      * @param mixed $offset
123 121
      * @return null
124 122
      */
125
-    public function offsetExists($offset)
126
-    {
123
+    public function offsetExists($offset) {
127 124
     }
128 125
 
129 126
     /**
130 127
      * @param mixed $offset
131 128
      */
132
-    public function offsetUnset($offset)
133
-    {
129
+    public function offsetUnset($offset) {
134 130
     }
135 131
 
136 132
     /**
@@ -140,8 +136,7 @@  discard block
 block discarded – undo
140 136
      *
141 137
      * @return bool
142 138
      */
143
-    public function offsetGet($offset)
144
-    {   
139
+    public function offsetGet($offset) {
145 140
         /* return error if requested */
146 141
         if ($offset == 'error') {
147 142
             return $this->error;
@@ -169,8 +164,7 @@  discard block
 block discarded – undo
169 164
      *
170 165
      * @return string
171 166
      */
172
-    protected function commonUploadErrors($errors)
173
-    {
167
+    protected function commonUploadErrors($errors) {
174 168
         return $this->common_upload_errors[$errors];
175 169
     }
176 170
 
@@ -182,8 +176,7 @@  discard block
 block discarded – undo
182 176
      *
183 177
      * @return $this
184 178
      */
185
-    public function setDimension($maxWidth, $maxHeight)
186
-    {
179
+    public function setDimension($maxWidth, $maxHeight) {
187 180
         $this->dimensions = array($maxWidth, $maxHeight);
188 181
         return $this;
189 182
     }
@@ -193,8 +186,7 @@  discard block
 block discarded – undo
193 186
      *
194 187
      * @return string
195 188
      */
196
-    public function getFullPath()
197
-    {
189
+    public function getFullPath() {
198 190
         $this->fullPath = $this->location . '/' . $this->name . '.' . $this->mime;
199 191
         return $this->fullPath;
200 192
     }
@@ -204,8 +196,7 @@  discard block
 block discarded – undo
204 196
      *
205 197
      * @return int
206 198
      */
207
-    public function getSize()
208
-    {
199
+    public function getSize() {
209 200
         return (int)$this->_files['size'];
210 201
     }
211 202
 
@@ -217,8 +208,7 @@  discard block
 block discarded – undo
217 208
      *
218 209
      * @return $this
219 210
      */
220
-    public function setSize($min, $max)
221
-    {
211
+    public function setSize($min, $max) {
222 212
         $this->size = array($min, $max);
223 213
         return $this;
224 214
     }
@@ -228,8 +218,7 @@  discard block
 block discarded – undo
228 218
      *
229 219
      * @return string
230 220
      */
231
-    public function getJson()
232
-    {
221
+    public function getJson() {
233 222
         return json_encode($this->serialize);
234 223
     }
235 224
 
@@ -238,8 +227,7 @@  discard block
 block discarded – undo
238 227
      *
239 228
      * @return string
240 229
      */
241
-    public function getMime()
242
-    {
230
+    public function getMime() {
243 231
         if (!$this->mime) {
244 232
             return $this->getImageMime($this->_files['tmp_name']);
245 233
         }
@@ -253,8 +241,7 @@  discard block
 block discarded – undo
253 241
      *
254 242
      * @return $this
255 243
      */
256
-    public function setMime(array $fileTypes)
257
-    {
244
+    public function setMime(array $fileTypes) {
258 245
         $this->mimeTypes = $fileTypes;
259 246
         return $this;
260 247
     }
@@ -266,8 +253,7 @@  discard block
 block discarded – undo
266 253
      *
267 254
      * @return null|string
268 255
      */
269
-    protected function getImageMime($tmp_name)
270
-    {
256
+    protected function getImageMime($tmp_name) {
271 257
         $mime = @$this->imageMimes[exif_imagetype($tmp_name)];
272 258
 
273 259
         if (!$mime) {
@@ -282,8 +268,7 @@  discard block
 block discarded – undo
282 268
      *
283 269
      * @return string|bool
284 270
      */
285
-    public function getError()
286
-    {
271
+    public function getError() {
287 272
         return $this->error != '' ? $this->error : false;
288 273
     }
289 274
 
@@ -291,8 +276,7 @@  discard block
 block discarded – undo
291 276
      * This methods validates and uploads the image
292 277
      * @return false|Image
293 278
      */
294
-    public function upload()
295
-    {
279
+    public function upload() {
296 280
         /* modify variable names for convenience */
297 281
         $image = $this;
298 282
         $files = $this->_files;
@@ -374,8 +358,7 @@  discard block
 block discarded – undo
374 358
      *
375 359
      * @return string
376 360
      */
377
-    public function getName()
378
-    {
361
+    public function getName() {
379 362
         if (!$this->name) {
380 363
             return uniqid('', true) . '_' . str_shuffle(implode(range('e', 'q')));
381 364
         }
@@ -389,8 +372,7 @@  discard block
 block discarded – undo
389 372
      * @param null $isNameProvided
390 373
      * @return $this
391 374
      */
392
-    public function setName($isNameProvided = null)
393
-    {
375
+    public function setName($isNameProvided = null) {
394 376
         if ($isNameProvided) {
395 377
             $this->name = filter_var($isNameProvided, FILTER_SANITIZE_STRING);
396 378
         }
@@ -403,8 +385,7 @@  discard block
 block discarded – undo
403 385
      *
404 386
      * @return int
405 387
      */
406
-    public function getWidth()
407
-    {
388
+    public function getWidth() {
408 389
         if ($this->width != null) {
409 390
             return $this->width;
410 391
         }
@@ -418,8 +399,7 @@  discard block
 block discarded – undo
418 399
      *
419 400
      * @return int
420 401
      */
421
-    public function getHeight()
422
-    {
402
+    public function getHeight() {
423 403
         if ($this->height != null) {
424 404
             return $this->height;
425 405
         }
@@ -433,8 +413,7 @@  discard block
 block discarded – undo
433 413
      *
434 414
      * @return string
435 415
      */
436
-    public function getLocation()
437
-    {
416
+    public function getLocation() {
438 417
         if (!$this->location) {
439 418
             $this->setLocation();
440 419
         }
@@ -450,8 +429,7 @@  discard block
 block discarded – undo
450 429
      *
451 430
      * @return $this
452 431
      */
453
-    public function setLocation($dir = 'bulletproof', $permission = 0666)
454
-    {
432
+    public function setLocation($dir = 'bulletproof', $permission = 0666) {
455 433
 
456 434
         if (!file_exists($dir) && !is_dir($dir) && !$this->location) {
457 435
             $createFolder = @mkdir('' . $dir, (int)$permission, true);
@@ -479,8 +457,7 @@  discard block
 block discarded – undo
479 457
      *
480 458
      * @return bool
481 459
      */
482
-    public function moveUploadedFile($tmp_name, $destination)
483
-    {
460
+    public function moveUploadedFile($tmp_name, $destination) {
484 461
         return move_uploaded_file($tmp_name, $destination);
485 462
     }
486 463
 }
Please login to merge, or discard this patch.