Test Failed
Pull Request — master (#1200)
by
unknown
04:08
created
src/Exceptions/FileSizeExceedIniMaximumException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,6 +6,6 @@
 block discarded – undo
6 6
 {
7 7
     public function __construct()
8 8
     {
9
-        $this->message = trans('laravel-filemanager::lfm.error-file-size', ['max' => ini_get('upload_max_filesize')]);
9
+        $this->message = trans('laravel-filemanager::lfm.error-file-size', [ 'max' => ini_get('upload_max_filesize') ]);
10 10
     }
11 11
 }
Please login to merge, or discard this patch.
src/Controllers/LfmController.php 1 patch
Spacing   +6 added lines, -6 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,7 +64,7 @@  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
 
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
      */
79 79
     public function applyIniOverrides()
80 80
     {
81
-        $overrides = config('lfm.php_ini_overrides', []);
81
+        $overrides = config('lfm.php_ini_overrides', [ ]);
82 82
 
83 83
         if ($overrides && is_array($overrides) && count($overrides) === 0) {
84 84
             return;
Please login to merge, or discard this patch.
src/LfmItem.php 1 patch
Spacing   +9 added lines, -10 removed lines patch added patch discarded remove patch
@@ -12,26 +12,25 @@  discard block
 block discarded – undo
12 12
     private $isDirectory;
13 13
     private $mimeType = null;
14 14
 
15
-    private $columns = [];
16
-    public $attributes = [];
15
+    private $columns = [ ];
16
+    public $attributes = [ ];
17 17
 
18 18
     public function __construct(LfmPath $lfm, Lfm $helper, $isDirectory = false)
19 19
     {
20 20
         $this->lfm = $lfm->thumb(false);
21 21
         $this->helper = $helper;
22 22
         $this->isDirectory = $isDirectory;
23
-        $this->columns = $helper->config('item_columns') ?:
24
-            ['name', 'url', 'time', 'icon', 'is_file', 'is_image', 'thumb_url'];
23
+        $this->columns = $helper->config('item_columns') ?: [ 'name', 'url', 'time', 'icon', 'is_file', 'is_image', 'thumb_url' ];
25 24
     }
26 25
 
27 26
     public function __get($var_name)
28 27
     {
29 28
         if (!array_key_exists($var_name, $this->attributes)) {
30 29
             $function_name = Str::camel($var_name);
31
-            $this->attributes[$var_name] = $this->$function_name();
30
+            $this->attributes[ $var_name ] = $this->$function_name();
32 31
         }
33 32
 
34
-        return $this->attributes[$var_name];
33
+        return $this->attributes[ $var_name ];
35 34
     }
36 35
 
37 36
     public function fill()
@@ -60,7 +59,7 @@  discard block
 block discarded – undo
60 59
 
61 60
     public function isFile()
62 61
     {
63
-        return ! $this->isDirectory();
62
+        return !$this->isDirectory();
64 63
     }
65 64
 
66 65
     /**
@@ -175,7 +174,7 @@  discard block
 block discarded – undo
175 174
             return false;
176 175
         }
177 176
 
178
-        if (in_array($this->mimeType(), ['image/gif', 'image/svg+xml'])) {
177
+        if (in_array($this->mimeType(), [ 'image/gif', 'image/svg+xml' ])) {
179 178
             return false;
180 179
         }
181 180
 
@@ -196,9 +195,9 @@  discard block
 block discarded – undo
196 195
      */
197 196
     public function humanFilesize($bytes, $decimals = 2)
198 197
     {
199
-        $size = ['B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
198
+        $size = [ 'B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB' ];
200 199
         $factor = floor((strlen($bytes) - 1) / 3);
201 200
 
202
-        return sprintf("%.{$decimals}f %s", $bytes / pow(1024, $factor), @$size[$factor]);
201
+        return sprintf("%.{$decimals}f %s", $bytes / pow(1024, $factor), @$size[ $factor ]);
203 202
     }
204 203
 }
Please login to merge, or discard this patch.
src/LfmPath.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -96,11 +96,11 @@  discard block
 block discarded – undo
96 96
 
97 97
     public function folders()
98 98
     {
99
-        $all_folders = array_map(function ($directory_path) {
99
+        $all_folders = array_map(function($directory_path) {
100 100
             return $this->pretty($directory_path, true);
101 101
         }, $this->storage->directories());
102 102
 
103
-        $folders = array_filter($all_folders, function ($directory) {
103
+        $folders = array_filter($all_folders, function($directory) {
104 104
             return $directory->name !== $this->helper->getThumbFolderName();
105 105
         });
106 106
 
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 
110 110
     public function files()
111 111
     {
112
-        $files = array_map(function ($file_path) {
112
+        $files = array_map(function($file_path) {
113 113
             return $this->pretty($file_path);
114 114
         }, $this->storage->files());
115 115
 
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
         $working_dir = $this->path('working_dir');
155 155
         $parent_dir = substr($working_dir, 0, strrpos($working_dir, '/'));
156 156
 
157
-        $parent_directories = array_map(function ($directory_path) {
157
+        $parent_directories = array_map(function($directory_path) {
158 158
             return app(static::class)->translateToLfmPath($directory_path);
159 159
         }, app(static::class)->dir($parent_dir)->directories());
160 160
 
@@ -200,20 +200,20 @@  discard block
 block discarded – undo
200 200
     public function sortByColumn($arr_items)
201 201
     {
202 202
         $sort_by = $this->helper->input('sort_type');
203
-        if (in_array($sort_by, ['name', 'time'])) {
203
+        if (in_array($sort_by, [ 'name', 'time' ])) {
204 204
             $key_to_sort = $sort_by;
205 205
         } else {
206 206
             $key_to_sort = 'name';
207 207
         }
208 208
 
209
-        uasort($arr_items, function ($a, $b) use ($key_to_sort) {
209
+        uasort($arr_items, function($a, $b) use ($key_to_sort) {
210 210
             return strcasecmp($a->{$key_to_sort}, $b->{$key_to_sort});
211 211
         });
212 212
 
213 213
         return $arr_items;
214 214
     }
215 215
 
216
-    public function error($error_type, $variables = [])
216
+    public function error($error_type, $variables = [ ])
217 217
     {
218 218
         throw new \Exception($this->helper->error($error_type, $variables));
219 219
     }
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
             $validator->nameIsNotDuplicate($this->getNewName($file), $this);
254 254
         }
255 255
 
256
-        $validator->isNotExcutable(config('lfm.disallowed_mimetypes', ['text/x-php', 'text/html', 'text/plain']));
256
+        $validator->isNotExcutable(config('lfm.disallowed_mimetypes', [ 'text/x-php', 'text/html', 'text/plain' ]));
257 257
 
258 258
         if (config('lfm.should_validate_mime', false)) {
259 259
             $validator->mimeTypeIsValid($this->helper->availableMimeTypes());
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
             $validator->sizeIsLowerThanConfiguredMaximum($this->helper->maxUploadSize());
264 264
         }
265 265
 
266
-        $validator->hasAllowedExtension(config('lfm.allowed_extensions', ['jpg', 'png', 'gif', 'jpeg']));
266
+        $validator->hasAllowedExtension(config('lfm.allowed_extensions', [ 'jpg', 'png', 'gif', 'jpeg' ]));
267 267
 
268 268
         return true;
269 269
     }
Please login to merge, or discard this patch.
src/config/lfm.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -114,13 +114,13 @@
 block discarded – undo
114 114
     'over_write_on_duplicate'  => false,
115 115
 
116 116
     // mimetypes of executables to prevent from uploading
117
-    'disallowed_mimetypes' => ['text/x-php', 'text/html', 'text/plain'],
117
+    'disallowed_mimetypes' => [ 'text/x-php', 'text/html', 'text/plain' ],
118 118
 
119 119
     // allowed file extensions
120
-    'allowed_extensions' => ['jpg', 'png', 'gif'],
120
+    'allowed_extensions' => [ 'jpg', 'png', 'gif' ],
121 121
 
122 122
     // Item Columns
123
-    'item_columns' => ['name', 'url', 'time', 'icon', 'is_file', 'is_image', 'thumb_url'],
123
+    'item_columns' => [ 'name', 'url', 'time', 'icon', 'is_file', 'is_image', 'thumb_url' ],
124 124
 
125 125
     /*
126 126
     |--------------------------------------------------------------------------
Please login to merge, or discard this patch.
src/Controllers/UploadController.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
     public function __construct()
14 14
     {
15 15
         parent::__construct();
16
-        $this->errors = [];
16
+        $this->errors = [ ];
17 17
     }
18 18
 
19 19
     /**
@@ -26,10 +26,10 @@  discard block
 block discarded – undo
26 26
     public function upload()
27 27
     {
28 28
         $uploaded_files = request()->file('upload');
29
-        $error_bag = [];
29
+        $error_bag = [ ];
30 30
         $new_filename = null;
31 31
 
32
-        foreach (is_array($uploaded_files) ? $uploaded_files : [$uploaded_files] as $file) {
32
+        foreach (is_array($uploaded_files) ? $uploaded_files : [ $uploaded_files ] as $file) {
33 33
             try {
34 34
                 $this->lfm->validateUploadedFile($file);
35 35
 
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
         } else { // upload via ckeditor5 expects json responses
50 50
             if (is_null($new_filename)) {
51 51
                 $response = [
52
-                    'error' => ['message' =>  $error_bag[0]]
52
+                    'error' => [ 'message' =>  $error_bag[ 0 ] ]
53 53
                 ];
54 54
             } else {
55 55
                 $url = $this->lfm->setName($new_filename)->url();
Please login to merge, or discard this patch.