Test Failed
Pull Request — master (#1260)
by
unknown
05:37
created
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/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
     // extensions of executables to prevent from uploading
120
-    'disallowed_extensions' => ['php', 'html'],
120
+    'disallowed_extensions' => [ 'php', 'html' ],
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/Lfm.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
             $path_parts = pathinfo($path);
62 62
         }
63 63
 
64
-        return substr($path_parts[$part_name], 1);
64
+        return substr($path_parts[ $part_name ], 1);
65 65
     }
66 66
 
67 67
     public function allowFolderType($type)
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
         $lfm_type = 'file';
91 91
 
92 92
         $request_type = lcfirst(Str::singular($this->input('type') ?: ''));
93
-        $available_types = array_keys($this->config->get('lfm.folder_categories') ?: []);
93
+        $available_types = array_keys($this->config->get('lfm.folder_categories') ?: [ ]);
94 94
 
95 95
         if (in_array($request_type, $available_types)) {
96 96
             $lfm_type = $request_type;
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
         $view_type = 'grid';
108 108
         $target_display_type = $this->input('show_list') ?: $startup_view;
109 109
 
110
-        if (in_array($target_display_type, ['list', 'grid'])) {
110
+        if (in_array($target_display_type, [ 'list', 'grid' ])) {
111 111
             $view_type = $target_display_type;
112 112
         }
113 113
 
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
      */
213 213
     public function allowShareFolder()
214 214
     {
215
-        if (! $this->allowMultiUser()) {
215
+        if (!$this->allowMultiUser()) {
216 216
             return true;
217 217
         }
218 218
 
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
      * @param  mixed  $variables   Variables the message needs.
273 273
      * @return string
274 274
      */
275
-    public function error($error_type, $variables = [])
275
+    public function error($error_type, $variables = [ ])
276 276
     {
277 277
         throw new \Exception(trans(self::PACKAGE_NAME . '::lfm.error-' . $error_type, $variables));
278 278
     }
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
         $as = 'unisharp.lfm.';
289 289
         $namespace = '\\UniSharp\\LaravelFilemanager\\Controllers\\';
290 290
 
291
-        Route::group(compact('middleware', 'as', 'namespace'), function () {
291
+        Route::group(compact('middleware', 'as', 'namespace'), function() {
292 292
             // display main layout
293 293
             Route::get('/', [
294 294
                 'uses' => 'LfmController@show',
Please login to merge, or discard this patch.
src/Controllers/ResizeController.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -58,9 +58,9 @@
 block discarded – undo
58 58
         $image_path = $this->lfm->setName(request('img'))->path('absolute');
59 59
         $resize_path = $image_path;
60 60
 
61
-        if (! $overWrite) {
61
+        if (!$overWrite) {
62 62
             $fileParts = explode('.', $image_name);
63
-            $fileParts[count($fileParts) - 2] = $fileParts[count($fileParts) - 2] . '_resized_' . time();
63
+            $fileParts[ count($fileParts) - 2 ] = $fileParts[ count($fileParts) - 2 ] . '_resized_' . time();
64 64
             $resize_path = $this->lfm->setName(implode('.', $fileParts))->path('absolute');
65 65
         }
66 66
 
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,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
     private 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;
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
     }
93 93
 
94 94
     // TODO: remove this after refactoring RenameController and DeleteController
95
-    protected function error($error_type, $variables = [])
95
+    protected function error($error_type, $variables = [ ])
96 96
     {
97 97
         return trans(Lfm::PACKAGE_NAME . '::lfm.error-' . $error_type, $variables);
98 98
     }
Please login to merge, or discard this patch.
src/Controllers/RenameController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@
 block discarded – undo
43 43
             return response()->json(parent::error('rename'), 400);
44 44
         }
45 45
 
46
-        if (! $is_directory) {
46
+        if (!$is_directory) {
47 47
             $extension = $old_file->extension();
48 48
             if ($extension) {
49 49
                 $new_name = str_replace('.' . $extension, '', $new_name) . '.' . $extension;
Please login to merge, or discard this patch.
src/LfmUploadValidator.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@
 block discarded – undo
77 77
     {
78 78
         $extension = strtolower($this->file->getClientOriginalExtension());
79 79
 
80
-        $excutable_extensions = ['php', 'html'];
80
+        $excutable_extensions = [ 'php', 'html' ];
81 81
 
82 82
         if (in_array($extension, $excutable_extensions)) {
83 83
             throw new ExcutableFileException();
Please login to merge, or discard this patch.
src/LfmPath.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -97,11 +97,11 @@  discard block
 block discarded – undo
97 97
 
98 98
     public function folders()
99 99
     {
100
-        $all_folders = array_map(function ($directory_path) {
100
+        $all_folders = array_map(function($directory_path) {
101 101
             return $this->pretty($directory_path, true);
102 102
         }, $this->storage->directories());
103 103
 
104
-        $folders = array_filter($all_folders, function ($directory) {
104
+        $folders = array_filter($all_folders, function($directory) {
105 105
             return $directory->name !== $this->helper->getThumbFolderName();
106 106
         });
107 107
 
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 
111 111
     public function files()
112 112
     {
113
-        $files = array_map(function ($file_path) {
113
+        $files = array_map(function($file_path) {
114 114
             return $this->pretty($file_path);
115 115
         }, $this->storage->files());
116 116
 
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
         $working_dir = $this->path('working_dir');
156 156
         $parent_dir = substr($working_dir, 0, strrpos($working_dir, '/'));
157 157
 
158
-        $parent_directories = array_map(function ($directory_path) {
158
+        $parent_directories = array_map(function($directory_path) {
159 159
             return app(static::class)->translateToLfmPath($directory_path);
160 160
         }, app(static::class)->dir($parent_dir)->directories());
161 161
 
@@ -201,20 +201,20 @@  discard block
 block discarded – undo
201 201
     public function sortByColumn($arr_items)
202 202
     {
203 203
         $sort_by = $this->helper->input('sort_type');
204
-        if (in_array($sort_by, ['name', 'time'])) {
204
+        if (in_array($sort_by, [ 'name', 'time' ])) {
205 205
             $key_to_sort = $sort_by;
206 206
         } else {
207 207
             $key_to_sort = 'name';
208 208
         }
209 209
 
210
-        uasort($arr_items, function ($a, $b) use ($key_to_sort) {
210
+        uasort($arr_items, function($a, $b) use ($key_to_sort) {
211 211
             return strcasecmp($a->{$key_to_sort}, $b->{$key_to_sort});
212 212
         });
213 213
 
214 214
         return $arr_items;
215 215
     }
216 216
 
217
-    public function error($error_type, $variables = [])
217
+    public function error($error_type, $variables = [ ])
218 218
     {
219 219
         throw new \Exception($this->helper->error($error_type, $variables));
220 220
     }
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
             $validator->nameIsNotDuplicate($this->getNewName($file), $this);
254 254
         }
255 255
 
256
-        $validator->mimetypeIsNotExcutable(config('lfm.disallowed_mimetypes', ['text/x-php', 'text/html', 'text/plain']));
256
+        $validator->mimetypeIsNotExcutable(config('lfm.disallowed_mimetypes', [ 'text/x-php', 'text/html', 'text/plain' ]));
257 257
 
258 258
         $validator->extensionIsNotExcutable();
259 259
 
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
             $validator->mimeTypeIsValid($this->helper->availableMimeTypes());
262 262
         }
263 263
 
264
-        $validator->extensionIsValid(config('lfm.disallowed_extensions', []));
264
+        $validator->extensionIsValid(config('lfm.disallowed_extensions', [ ]));
265 265
 
266 266
         if (config('lfm.should_validate_size', false)) {
267 267
             $validator->sizeIsLowerThanConfiguredMaximum($this->helper->maxUploadSize());
@@ -293,11 +293,11 @@  discard block
 block discarded – undo
293 293
             $file_name_without_extentions = $new_file_name;
294 294
             while ($this->setName(($extension) ? $new_file_name_with_extention : $new_file_name)->exists()) {
295 295
                 if (config('lfm.alphanumeric_filename') === true) {
296
-                    $suffix = '_'.$counter;
296
+                    $suffix = '_' . $counter;
297 297
                 } else {
298 298
                     $suffix = " ({$counter})";
299 299
                 }
300
-                $new_file_name = $file_name_without_extentions.$suffix;
300
+                $new_file_name = $file_name_without_extentions . $suffix;
301 301
 
302 302
                 if ($extension) {
303 303
                     $new_file_name_with_extention = $new_file_name . '.' . $extension;
Please login to merge, or discard this patch.