Completed
Push — master ( 179439...2e9035 )
by samayo
02:51 queued 51s
created
src/bulletproof.php 1 patch
Braces   +18 added lines, -36 removed lines patch added patch discarded remove patch
@@ -102,8 +102,7 @@  discard block
 block discarded – undo
102 102
      * 
103 103
      * @param array $_files represents the $_FILES array passed as dependency
104 104
      */
105
-    public function __construct(array $_files = [])
106
-    {
105
+    public function __construct(array $_files = []) {
107 106
         $this->_files = $_files;
108 107
     }
109 108
 
@@ -114,8 +113,7 @@  discard block
 block discarded – undo
114 113
      *
115 114
      * @return bool|string
116 115
      */
117
-    protected function getImageMime($tmp_name)
118
-    {
116
+    protected function getImageMime($tmp_name) {
119 117
         if (isset($this->imageMimes[exif_imagetype($tmp_name)])) {
120 118
             return $this->imageMimes [exif_imagetype($tmp_name)];
121 119
         }
@@ -147,8 +145,7 @@  discard block
 block discarded – undo
147 145
      *
148 146
      * @return bool|mixed
149 147
      */
150
-    public function offsetGet($offset)
151
-    {
148
+    public function offsetGet($offset) {
152 149
         if (isset($this->_files[$offset]) && file_exists($this->_files[$offset]["tmp_name"])) {
153 150
             $this->_files = $this->_files[$offset];
154 151
             return true;
@@ -164,8 +161,7 @@  discard block
 block discarded – undo
164 161
      * @param null $name
165 162
      * @return $this
166 163
      */
167
-    public function setName($name = null)
168
-    {
164
+    public function setName($name = null) {
169 165
         if ($name) {
170 166
             $this->name = filter_var($name, FILTER_SANITIZE_STRING);
171 167
         }
@@ -180,8 +176,7 @@  discard block
 block discarded – undo
180 176
      *
181 177
      * @return $this
182 178
      */
183
-    public function setMime(array $fileTypes)
184
-    {
179
+    public function setMime(array $fileTypes) {
185 180
         $this->mimeTypes = $fileTypes;
186 181
         return $this;
187 182
     }
@@ -194,8 +189,7 @@  discard block
 block discarded – undo
194 189
      *
195 190
      * @return $this
196 191
      */
197
-    public function setSize($min, $max)
198
-    {
192
+    public function setSize($min, $max) {
199 193
         $this->size = array($min, $max);
200 194
         return $this;
201 195
     }
@@ -208,8 +202,7 @@  discard block
 block discarded – undo
208 202
      *
209 203
      * @return $this
210 204
      */
211
-    public function setLocation($dir = "Uploads", $permission = 0666)
212
-    {
205
+    public function setLocation($dir = "Uploads", $permission = 0666) {
213 206
         if (!file_exists($dir) && !is_dir($dir) && !$this->location) {
214 207
             $createFolder = @mkdir("" . $dir, (int) $permission, true);
215 208
             if (!$createFolder) {
@@ -230,8 +223,7 @@  discard block
 block discarded – undo
230 223
      *
231 224
      * @return $this
232 225
      */
233
-    public function setDimension($maxWidth, $maxHeight)
234
-    {
226
+    public function setDimension($maxWidth, $maxHeight) {
235 227
         $this->dimensions = array($maxWidth, $maxHeight);
236 228
         return $this;
237 229
     }
@@ -241,8 +233,7 @@  discard block
 block discarded – undo
241 233
      *
242 234
      * @return string
243 235
      */
244
-    public function getName()
245
-    {
236
+    public function getName() {
246 237
         if (!$this->name) {
247 238
            return  uniqid(true) . "_" . str_shuffle(implode(range("e", "q")));
248 239
         }
@@ -255,8 +246,7 @@  discard block
 block discarded – undo
255 246
      *
256 247
      * @return string
257 248
      */
258
-    public function getFullPath()
259
-    {
249
+    public function getFullPath() {
260 250
         $this->fullPath = $this->location . "/" . $this->name . "." . $this->mime;
261 251
         return $this->fullPath;
262 252
     }
@@ -266,8 +256,7 @@  discard block
 block discarded – undo
266 256
      *
267 257
      * @return int
268 258
      */
269
-    public function getSize()
270
-    {
259
+    public function getSize() {
271 260
         return (int) $this->_files["size"];
272 261
     }
273 262
 
@@ -276,8 +265,7 @@  discard block
 block discarded – undo
276 265
      *
277 266
      * @return int
278 267
      */
279
-    public function getHeight()
280
-    {
268
+    public function getHeight() {
281 269
         if ($this->height != null) {
282 270
             return $this->height;
283 271
         }
@@ -291,8 +279,7 @@  discard block
 block discarded – undo
291 279
      *
292 280
      * @return int
293 281
      */
294
-    public function getWidth()
295
-    {
282
+    public function getWidth() {
296 283
         if ($this->width != null) {
297 284
             return $this->width;
298 285
         }
@@ -306,8 +293,7 @@  discard block
 block discarded – undo
306 293
      *
307 294
      * @return string
308 295
      */
309
-    public function getLocation()
310
-    {
296
+    public function getLocation() {
311 297
         if(!$this->location){
312 298
             $this->setLocation(); 
313 299
         }
@@ -320,8 +306,7 @@  discard block
 block discarded – undo
320 306
      *
321 307
      * @return string
322 308
      */
323
-    public function getJson()
324
-    {
309
+    public function getJson() {
325 310
         return json_encode($this->serialize);
326 311
     }
327 312
 
@@ -330,8 +315,7 @@  discard block
 block discarded – undo
330 315
      *
331 316
      * @return string
332 317
      */
333
-    public function getMime()
334
-    {
318
+    public function getMime() {
335 319
         return $this->mime;
336 320
     }
337 321
 
@@ -342,8 +326,7 @@  discard block
 block discarded – undo
342 326
      *
343 327
      * @throws BulletproofException
344 328
      */
345
-    public function upload()
346
-    {
329
+    public function upload() {
347 330
         /* modify variable names for convenience */
348 331
         $image = $this;
349 332
         $files = $this->_files;
@@ -425,8 +408,7 @@  discard block
 block discarded – undo
425 408
      *
426 409
      * @return bool
427 410
      */
428
-    public function moveUploadedFile($tmp_name, $destination)
429
-    {
411
+    public function moveUploadedFile($tmp_name, $destination) {
430 412
         return move_uploaded_file($tmp_name, $destination);
431 413
     }
432 414
 }
Please login to merge, or discard this patch.