Completed
Pull Request — master (#1065)
by
unknown
06:17
created
src/LfmPath.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -91,11 +91,11 @@  discard block
 block discarded – undo
91 91
 
92 92
     public function folders()
93 93
     {
94
-        $all_folders = array_map(function ($directory_path) {
94
+        $all_folders = array_map(function($directory_path) {
95 95
             return $this->pretty($directory_path, true);
96 96
         }, $this->storage->directories());
97 97
 
98
-        $folders = array_filter($all_folders, function ($directory) {
98
+        $folders = array_filter($all_folders, function($directory) {
99 99
             return $directory->name !== $this->helper->getThumbFolderName();
100 100
         });
101 101
 
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 
105 105
     public function files()
106 106
     {
107
-        $files = array_map(function ($file_path) {
107
+        $files = array_map(function($file_path) {
108 108
             return $this->pretty($file_path);
109 109
         }, $this->storage->files());
110 110
 
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
         $working_dir = $this->path('working_dir');
150 150
         $parent_dir = substr($working_dir, 0, strrpos($working_dir, '/'));
151 151
 
152
-        $parent_directories = array_map(function ($directory_path) {
152
+        $parent_directories = array_map(function($directory_path) {
153 153
             return app(static::class)->translateToLfmPath($directory_path);
154 154
         }, app(static::class)->dir($parent_dir)->directories());
155 155
 
@@ -195,20 +195,20 @@  discard block
 block discarded – undo
195 195
     public function sortByColumn($arr_items)
196 196
     {
197 197
         $sort_by = $this->helper->input('sort_type');
198
-        if (in_array($sort_by, ['name', 'time'])) {
198
+        if (in_array($sort_by, [ 'name', 'time' ])) {
199 199
             $key_to_sort = $sort_by;
200 200
         } else {
201 201
             $key_to_sort = 'name';
202 202
         }
203 203
 
204
-        uasort($arr_items, function ($a, $b) use ($key_to_sort) {
204
+        uasort($arr_items, function($a, $b) use ($key_to_sort) {
205 205
             return strcasecmp($a->{$key_to_sort}, $b->{$key_to_sort});
206 206
         });
207 207
 
208 208
         return $arr_items;
209 209
     }
210 210
 
211
-    public function error($error_type, $variables = [])
211
+    public function error($error_type, $variables = [ ])
212 212
     {
213 213
         throw new \Exception($this->helper->error($error_type, $variables));
214 214
     }
@@ -237,10 +237,10 @@  discard block
 block discarded – undo
237 237
     {
238 238
         if (empty($file)) {
239 239
             return $this->error('file-empty');
240
-        } elseif (! $file instanceof UploadedFile) {
240
+        } elseif (!$file instanceof UploadedFile) {
241 241
             return $this->error('instance');
242 242
         } elseif ($file->getError() == UPLOAD_ERR_INI_SIZE) {
243
-            return $this->error('file-size', ['max' => ini_get('upload_max_filesize')]);
243
+            return $this->error('file-size', [ 'max' => ini_get('upload_max_filesize') ]);
244 244
         } elseif ($file->getError() != UPLOAD_ERR_OK) {
245 245
             throw new \Exception('File failed to upload. Error code: ' . $file->getError());
246 246
         }
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
 
254 254
         $mimetype = $file->getMimeType();
255 255
 
256
-        $excutable = ['text/x-php'];
256
+        $excutable = [ 'text/x-php' ];
257 257
 
258 258
         if (in_array($mimetype, $excutable)) {
259 259
             throw new \Exception('Invalid file detected');
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
             $new_file_name = uniqid();
289 289
         } elseif (config('lfm.alphanumeric_filename') === true) {
290 290
             $new_file_name = preg_replace('/[^A-Za-z0-9\-\']/', '_', $new_file_name);
291
-        } elseif (config('lfm.slug_filename') === true){
291
+        } elseif (config('lfm.slug_filename') === true) {
292 292
             $new_file_name = Str::slug($new_file_name, '_');
293 293
         }
294 294
 
@@ -301,11 +301,11 @@  discard block
 block discarded – undo
301 301
             $file_name_without_extentions = $new_file_name;
302 302
             while ($this->setName(($extension) ? $new_file_name_with_extention : $new_file_name)->exists()) {
303 303
                 if (config('lfm.alphanumeric_filename') === true) {
304
-                    $suffix = '_'.$counter;
304
+                    $suffix = '_' . $counter;
305 305
                 } else {
306 306
                     $suffix = " ({$counter})";
307 307
                 }
308
-                $new_file_name = $file_name_without_extentions.$suffix;
308
+                $new_file_name = $file_name_without_extentions . $suffix;
309 309
 
310 310
                 if ($extension) {
311 311
                     $new_file_name_with_extention = $new_file_name . '.' . $extension;
Please login to merge, or discard this patch.