Passed
Pull Request — master (#995)
by
unknown
07:55
created
src/LfmPath.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -90,11 +90,11 @@  discard block
 block discarded – undo
90 90
 
91 91
     public function folders()
92 92
     {
93
-        $all_folders = array_map(function ($directory_path) {
93
+        $all_folders = array_map(function($directory_path) {
94 94
             return $this->pretty($directory_path, true);
95 95
         }, $this->storage->directories());
96 96
 
97
-        $folders = array_filter($all_folders, function ($directory) {
97
+        $folders = array_filter($all_folders, function($directory) {
98 98
             return $directory->name !== $this->helper->getThumbFolderName();
99 99
         });
100 100
 
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 
104 104
     public function files()
105 105
     {
106
-        $files = array_map(function ($file_path) {
106
+        $files = array_map(function($file_path) {
107 107
             return $this->pretty($file_path);
108 108
         }, $this->storage->files());
109 109
 
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
         $working_dir = $this->path('working_dir');
149 149
         $parent_dir = substr($working_dir, 0, strrpos($working_dir, '/'));
150 150
 
151
-        $parent_directories = array_map(function ($directory_path) {
151
+        $parent_directories = array_map(function($directory_path) {
152 152
             return app(static::class)->translateToLfmPath($directory_path);
153 153
         }, app(static::class)->dir($parent_dir)->directories());
154 154
 
@@ -194,20 +194,20 @@  discard block
 block discarded – undo
194 194
     public function sortByColumn($arr_items)
195 195
     {
196 196
         $sort_by = $this->helper->input('sort_type');
197
-        if (in_array($sort_by, ['name', 'time'])) {
197
+        if (in_array($sort_by, [ 'name', 'time' ])) {
198 198
             $key_to_sort = $sort_by;
199 199
         } else {
200 200
             $key_to_sort = 'name';
201 201
         }
202 202
 
203
-        uasort($arr_items, function ($a, $b) use ($key_to_sort) {
203
+        uasort($arr_items, function($a, $b) use ($key_to_sort) {
204 204
             return strcmp($a->{$key_to_sort}, $b->{$key_to_sort});
205 205
         });
206 206
 
207 207
         return $arr_items;
208 208
     }
209 209
 
210
-    public function error($error_type, $variables = [])
210
+    public function error($error_type, $variables = [ ])
211 211
     {
212 212
         return $this->helper->error($error_type, $variables);
213 213
     }
@@ -236,10 +236,10 @@  discard block
 block discarded – undo
236 236
     {
237 237
         if (empty($file)) {
238 238
             return $this->error('file-empty');
239
-        } elseif (! $file instanceof UploadedFile) {
239
+        } elseif (!$file instanceof UploadedFile) {
240 240
             return $this->error('instance');
241 241
         } elseif ($file->getError() == UPLOAD_ERR_INI_SIZE) {
242
-            return $this->error('file-size', ['max' => ini_get('upload_max_filesize')]);
242
+            return $this->error('file-size', [ 'max' => ini_get('upload_max_filesize') ]);
243 243
         } elseif ($file->getError() != UPLOAD_ERR_OK) {
244 244
             throw new \Exception('File failed to upload. Error code: ' . $file->getError());
245 245
         }
@@ -290,11 +290,11 @@  discard block
 block discarded – undo
290 290
             $file_name_without_extentions = $new_file_name;
291 291
             while ($this->setName(($extension) ? $new_file_name_with_extention : $new_file_name)->exists()) {
292 292
                 if (config('lfm.alphanumeric_filename') === true) {
293
-                    $suffix = '_'.$counter;
293
+                    $suffix = '_' . $counter;
294 294
                 } else {
295 295
                     $suffix = " ({$counter})";
296 296
                 }
297
-                $new_file_name = $file_name_without_extentions.$suffix;
297
+                $new_file_name = $file_name_without_extentions . $suffix;
298 298
 
299 299
                 if ($extension) {
300 300
                     $new_file_name_with_extention = $new_file_name . '.' . $extension;
Please login to merge, or discard this patch.
src/Controllers/LfmController.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -46,17 +46,17 @@  discard block
 block discarded – undo
46 46
      */
47 47
     public function getErrors()
48 48
     {
49
-        $arr_errors = [];
49
+        $arr_errors = [ ];
50 50
 
51
-        if (! extension_loaded('gd') && ! extension_loaded('imagick')) {
51
+        if (!extension_loaded('gd') && !extension_loaded('imagick')) {
52 52
             array_push($arr_errors, trans('laravel-filemanager::lfm.message-extension_not_found'));
53 53
         }
54 54
 
55
-        if (! extension_loaded('exif')) {
55
+        if (!extension_loaded('exif')) {
56 56
             array_push($arr_errors, 'EXIF extension not found.');
57 57
         }
58 58
 
59
-        if (! extension_loaded('fileinfo')) {
59
+        if (!extension_loaded('fileinfo')) {
60 60
             array_push($arr_errors, 'Fileinfo extension not found.');
61 61
         }
62 62
 
@@ -64,14 +64,14 @@  discard block
 block discarded – undo
64 64
             . $this->helper->currentLfmType()
65 65
             . '.valid_mime';
66 66
 
67
-        if (! is_array(config($mine_config_key))) {
67
+        if (!is_array(config($mine_config_key))) {
68 68
             array_push($arr_errors, 'Config : ' . $mine_config_key . ' is not a valid array.');
69 69
         }
70 70
 
71 71
         return $arr_errors;
72 72
     }
73 73
 
74
-    public function error($error_type, $variables = [])
74
+    public function error($error_type, $variables = [ ])
75 75
     {
76 76
         return $this->helper->error($error_type, $variables);
77 77
     }
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
      */
84 84
     public function applyIniOverrides()
85 85
     {
86
-        $overrides = config('lfm.php_ini_overrides', []);
86
+        $overrides = config('lfm.php_ini_overrides', [ ]);
87 87
         
88 88
         if ($overrides && is_array($overrides) && count($overrides) === 0) {
89 89
             return;
Please login to merge, or discard this patch.
src/LaravelFilemanagerServiceProvider.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -17,28 +17,28 @@  discard block
 block discarded – undo
17 17
      */
18 18
     public function boot()
19 19
     {
20
-        $this->loadTranslationsFrom(__DIR__.'/lang', 'laravel-filemanager');
20
+        $this->loadTranslationsFrom(__DIR__ . '/lang', 'laravel-filemanager');
21 21
 
22
-        $this->loadViewsFrom(__DIR__.'/views', 'laravel-filemanager');
22
+        $this->loadViewsFrom(__DIR__ . '/views', 'laravel-filemanager');
23 23
 
24 24
         $this->publishes([
25 25
             __DIR__ . '/config/lfm.php' => base_path('config/lfm.php'),
26 26
         ], 'lfm_config');
27 27
 
28 28
         $this->publishes([
29
-            __DIR__.'/../public' => public_path('vendor/laravel-filemanager'),
29
+            __DIR__ . '/../public' => public_path('vendor/laravel-filemanager'),
30 30
         ], 'lfm_public');
31 31
 
32 32
         $this->publishes([
33
-            __DIR__.'/views'  => base_path('resources/views/vendor/laravel-filemanager'),
33
+            __DIR__ . '/views'  => base_path('resources/views/vendor/laravel-filemanager'),
34 34
         ], 'lfm_view');
35 35
 
36 36
         $this->publishes([
37
-            __DIR__.'/Handlers/LfmConfigHandler.php' => base_path('app/Handlers/LfmConfigHandler.php'),
37
+            __DIR__ . '/Handlers/LfmConfigHandler.php' => base_path('app/Handlers/LfmConfigHandler.php'),
38 38
         ], 'lfm_handler');
39 39
 
40 40
         if (config('lfm.use_package_routes')) {
41
-            Route::group(['prefix' => 'filemanager', 'middleware' => ['web', 'auth']], function () {
41
+            Route::group([ 'prefix' => 'filemanager', 'middleware' => [ 'web', 'auth' ] ], function() {
42 42
                 \UniSharp\LaravelFilemanager\Lfm::routes();
43 43
             });
44 44
         }
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
     {
54 54
         $this->mergeConfigFrom(__DIR__ . '/config/lfm.php', 'lfm-config');
55 55
 
56
-        $this->app->singleton('laravel-filemanager', function () {
56
+        $this->app->singleton('laravel-filemanager', function() {
57 57
             return true;
58 58
         });
59 59
     }
Please login to merge, or discard this patch.
src/Controllers/ItemsController.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -23,14 +23,14 @@  discard block
 block discarded – undo
23 23
         $perPage = $this->helper->getPaginationPerPage();
24 24
         $items = array_merge($this->lfm->folders(), $this->lfm->files());
25 25
 
26
-        $items = array_map(function ($item) {
26
+        $items = array_map(function($item) {
27 27
             return $item->fill()->attributes;
28 28
         }, $items);
29 29
         
30 30
         $keyword = $request->keyword;
31 31
         if (!empty($keyword)) {
32
-            $items = array_values(array_filter($items, function ($item) use ($keyword) {
33
-                if ($this->like_match("%".$keyword."%", $item['name'])) {
32
+            $items = array_values(array_filter($items, function($item) use ($keyword) {
33
+                if ($this->like_match("%" . $keyword . "%", $item[ 'name' ])) {
34 34
                     return true;
35 35
                 } else {
36 36
                     return false;
@@ -60,19 +60,19 @@  discard block
 block discarded – undo
60 60
     public function move()
61 61
     {
62 62
         $items = request('items');
63
-        $folder_types = array_filter(['user', 'share'], function ($type) {
63
+        $folder_types = array_filter([ 'user', 'share' ], function($type) {
64 64
             return $this->helper->allowFolderType($type);
65 65
         });
66 66
         return view('laravel-filemanager::move')
67 67
             ->with([
68
-                'root_folders' => array_map(function ($type) use ($folder_types) {
68
+                'root_folders' => array_map(function($type) use ($folder_types) {
69 69
                     $path = $this->lfm->dir($this->helper->getRootFolder($type));
70 70
 
71 71
                     return (object) [
72 72
                         'name' => trans('laravel-filemanager::lfm.title-' . $type),
73 73
                         'url' => $path->path('working_dir'),
74 74
                         'children' => $path->folders(),
75
-                        'has_next' => ! ($type == end($folder_types)),
75
+                        'has_next' => !($type == end($folder_types)),
76 76
                     ];
77 77
                 }, $folder_types),
78 78
             ])
Please login to merge, or discard this patch.