Completed
Pull Request — master (#48)
by
unknown
03:10
created
src/bulletproof.php 1 patch
Braces   +20 added lines, -39 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 dependancy
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
         }
@@ -137,8 +135,7 @@  discard block
 block discarded – undo
137 135
      *
138 136
      * @return bool|mixed
139 137
      */
140
-    public function offsetGet($offset)
141
-    {
138
+    public function offsetGet($offset) {
142 139
         if ($offset == "error") {
143 140
             return $this->error;
144 141
         }
@@ -158,8 +155,7 @@  discard block
 block discarded – undo
158 155
      *
159 156
      * @return $this
160 157
      */
161
-    public function setName($isNameProvided = null)
162
-    {
158
+    public function setName($isNameProvided = null) {
163 159
         if ($isNameProvided) {
164 160
             $this->name = filter_var($isNameProvided, FILTER_SANITIZE_STRING);
165 161
         }
@@ -174,8 +170,7 @@  discard block
 block discarded – undo
174 170
      *
175 171
      * @return $this
176 172
      */
177
-    public function setMime(array $fileTypes)
178
-    {
173
+    public function setMime(array $fileTypes) {
179 174
         $this->mimeTypes = $fileTypes;
180 175
         return $this;
181 176
     }
@@ -188,8 +183,7 @@  discard block
 block discarded – undo
188 183
      *
189 184
      * @return $this
190 185
      */
191
-    public function setSize($min, $max)
192
-    {
186
+    public function setSize($min, $max) {
193 187
         $this->size = array($min, $max);
194 188
         return $this;
195 189
     }
@@ -202,8 +196,7 @@  discard block
 block discarded – undo
202 196
      *
203 197
      * @return $this
204 198
      */
205
-    public function setLocation($dir = "bulletproof", $permission = 0666)
206
-    {
199
+    public function setLocation($dir = "bulletproof", $permission = 0666) {
207 200
         if (!file_exists($dir) && !is_dir($dir) && !$this->location) {
208 201
             $createFolder = @mkdir("" . $dir, (int) $permission, true);
209 202
             if (!$createFolder) {
@@ -224,8 +217,7 @@  discard block
 block discarded – undo
224 217
      *
225 218
      * @return $this
226 219
      */
227
-    public function setDimension($maxWidth, $maxHeight)
228
-    {
220
+    public function setDimension($maxWidth, $maxHeight) {
229 221
         $this->dimensions = array($maxWidth, $maxHeight);
230 222
         return $this;
231 223
     }
@@ -235,8 +227,7 @@  discard block
 block discarded – undo
235 227
      *
236 228
      * @return string
237 229
      */
238
-    public function getName()
239
-    {
230
+    public function getName() {
240 231
         if (!$this->name) {
241 232
            return  uniqid(true) . "_" . str_shuffle(implode(range("e", "q")));
242 233
         }
@@ -249,8 +240,7 @@  discard block
 block discarded – undo
249 240
      *
250 241
      * @return string
251 242
      */
252
-    public function getFullPath()
253
-    {
243
+    public function getFullPath() {
254 244
         $this->fullPath = $this->location . "/" . $this->name . "." . $this->mime;
255 245
         return $this->fullPath;
256 246
     }
@@ -260,8 +250,7 @@  discard block
 block discarded – undo
260 250
      *
261 251
      * @return int
262 252
      */
263
-    public function getSize()
264
-    {
253
+    public function getSize() {
265 254
         return (int) $this->_files["size"];
266 255
     }
267 256
 
@@ -270,8 +259,7 @@  discard block
 block discarded – undo
270 259
      *
271 260
      * @return int
272 261
      */
273
-    public function getHeight()
274
-    {
262
+    public function getHeight() {
275 263
         if ($this->height != null) {
276 264
             return $this->height;
277 265
         }
@@ -285,8 +273,7 @@  discard block
 block discarded – undo
285 273
      *
286 274
      * @return int
287 275
      */
288
-    public function getWidth()
289
-    {
276
+    public function getWidth() {
290 277
         if ($this->width != null) {
291 278
             return $this->width;
292 279
         }
@@ -300,8 +287,7 @@  discard block
 block discarded – undo
300 287
      *
301 288
      * @return string
302 289
      */
303
-    public function getLocation()
304
-    {
290
+    public function getLocation() {
305 291
         if(!$this->location){
306 292
             $this->setLocation(); 
307 293
         }
@@ -314,8 +300,7 @@  discard block
 block discarded – undo
314 300
      *
315 301
      * @return string
316 302
      */
317
-    public function getJson()
318
-    {
303
+    public function getJson() {
319 304
         return json_encode($this->serialize);
320 305
     }
321 306
 
@@ -324,8 +309,7 @@  discard block
 block discarded – undo
324 309
      *
325 310
      * @return string
326 311
      */
327
-    public function getMime()
328
-    {
312
+    public function getMime() {
329 313
         return $this->mime;
330 314
     }
331 315
 
@@ -334,7 +318,7 @@  discard block
 block discarded – undo
334 318
      *
335 319
      * @return string|bool
336 320
      */
337
-    public function getError(){
321
+    public function getError() {
338 322
         return $this->error;
339 323
     }
340 324
 
@@ -343,8 +327,7 @@  discard block
 block discarded – undo
343 327
      *
344 328
      * @param $e int error constant
345 329
      */
346
-    protected function uploadErrors($e)
347
-    {
330
+    protected function uploadErrors($e) {
348 331
         $errors = array(
349 332
             UPLOAD_ERR_OK           => 0,
350 333
             UPLOAD_ERR_INI_SIZE     => Image::IMAGE_ERR_INI_SIZE,
@@ -364,8 +347,7 @@  discard block
 block discarded – undo
364 347
      *
365 348
      * @return $this|bool
366 349
      */
367
-    public function upload()
368
-    {
350
+    public function upload() {
369 351
         /* modify variable names for convenience */
370 352
         $image = $this; 
371 353
         $files = $this->_files;
@@ -448,8 +430,7 @@  discard block
 block discarded – undo
448 430
      *
449 431
      * @return bool
450 432
      */
451
-    public function moveUploadedFile($tmp_name, $destination)
452
-    {
433
+    public function moveUploadedFile($tmp_name, $destination) {
453 434
         return move_uploaded_file($tmp_name, $destination);
454 435
     }
455 436
 }
Please login to merge, or discard this patch.
src/utils/func.image-crop.php 1 patch
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@
 block discarded – undo
9 9
  */
10 10
 namespace Bulletproof;
11 11
 
12
- function crop($image, $mimeType, $imgWidth, $imgHeight, $newWidth, $newHeight){
12
+ function crop($image, $mimeType, $imgWidth, $imgHeight, $newWidth, $newHeight) {
13 13
 
14 14
     switch ($mimeType) {
15 15
         case "jpg":
Please login to merge, or discard this patch.
src/utils/func.image-resize.php 1 patch
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@
 block discarded – undo
9 9
  */
10 10
 namespace Bulletproof;
11 11
 
12
-function resize($image, $mimeType, $imgWidth, $imgHeight, $newWidth, $newHeight, $ratio = FALSE, $upsize = TRUE){           
12
+function resize($image, $mimeType, $imgWidth, $imgHeight, $newWidth, $newHeight, $ratio = FALSE, $upsize = TRUE) {
13 13
     
14 14
     // First, calculate the height.
15 15
     $height = intval($newWidth / $imgWidth * $imgHeight);
Please login to merge, or discard this patch.
src/utils/func.image-watermark.php 1 patch
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@
 block discarded – undo
9 9
  */
10 10
 namespace Bulletproof;
11 11
 
12
- function watermark($image, $mimeType, $imgWidth, $imgHeight, $watermark, $watermarkHeight, $watermarkWidth, $position = "center"){
12
+ function watermark($image, $mimeType, $imgWidth, $imgHeight, $watermark, $watermarkHeight, $watermarkWidth, $position = "center") {
13 13
 
14 14
     // Calculate the watermark position
15 15
     switch ($position) {
Please login to merge, or discard this patch.