@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | public function getDelete() |
| 17 | 17 | { |
| 18 | 18 | $item_names = request('items'); |
| 19 | - $errors = []; |
|
| 19 | + $errors = [ ]; |
|
| 20 | 20 | |
| 21 | 21 | foreach ($item_names as $name_to_delete) { |
| 22 | 22 | $file = $this->lfm->setName($name_to_delete); |
@@ -35,13 +35,13 @@ discard block |
||
| 35 | 35 | continue; |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | - if (! $this->lfm->setName($name_to_delete)->exists()) { |
|
| 39 | - array_push($errors, parent::error('folder-not-found', ['folder' => $file_path])); |
|
| 38 | + if (!$this->lfm->setName($name_to_delete)->exists()) { |
|
| 39 | + array_push($errors, parent::error('folder-not-found', [ 'folder' => $file_path ])); |
|
| 40 | 40 | continue; |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | if ($this->lfm->setName($name_to_delete)->isDirectory()) { |
| 44 | - if (! $this->lfm->setName($name_to_delete)->directoryIsEmpty()) { |
|
| 44 | + if (!$this->lfm->setName($name_to_delete)->directoryIsEmpty()) { |
|
| 45 | 45 | array_push($errors, parent::error('delete-folder')); |
| 46 | 46 | continue; |
| 47 | 47 | } |
@@ -61,7 +61,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 | |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | */ |
| 192 | 192 | public function allowShareFolder() |
| 193 | 193 | { |
| 194 | - if (! $this->allowMultiUser()) { |
|
| 194 | + if (!$this->allowMultiUser()) { |
|
| 195 | 195 | return true; |
| 196 | 196 | } |
| 197 | 197 | |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | * @param mixed $variables Variables the message needs. |
| 246 | 246 | * @return string |
| 247 | 247 | */ |
| 248 | - public function error($error_type, $variables = []) |
|
| 248 | + public function error($error_type, $variables = [ ]) |
|
| 249 | 249 | { |
| 250 | 250 | throw new \Exception(trans(self::PACKAGE_NAME . '::lfm.error-' . $error_type, $variables)); |
| 251 | 251 | } |
@@ -261,7 +261,7 @@ discard block |
||
| 261 | 261 | $as = 'unisharp.lfm.'; |
| 262 | 262 | $namespace = '\\UniSharp\\LaravelFilemanager\\Controllers\\'; |
| 263 | 263 | |
| 264 | - Route::group(compact('middleware', 'as', 'namespace'), function () { |
|
| 264 | + Route::group(compact('middleware', 'as', 'namespace'), function() { |
|
| 265 | 265 | |
| 266 | 266 | // display main layout |
| 267 | 267 | Route::get('/', [ |
@@ -6,6 +6,6 @@ |
||
| 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 | } |
@@ -65,7 +65,7 @@ |
||
| 65 | 65 | { |
| 66 | 66 | $mimetype = $this->file->getMimeType(); |
| 67 | 67 | |
| 68 | - $excutable = ['text/x-php']; |
|
| 68 | + $excutable = [ 'text/x-php' ]; |
|
| 69 | 69 | |
| 70 | 70 | if (in_array($mimetype, $excutable)) { |
| 71 | 71 | throw new ExcutableFileException(); |
@@ -46,17 +46,17 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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; |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | public function __construct() |
| 16 | 16 | { |
| 17 | 17 | parent::__construct(); |
| 18 | - $this->errors = []; |
|
| 18 | + $this->errors = [ ]; |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | /** |
@@ -28,10 +28,10 @@ discard block |
||
| 28 | 28 | public function upload() |
| 29 | 29 | { |
| 30 | 30 | $uploaded_files = request()->file('upload'); |
| 31 | - $error_bag = []; |
|
| 31 | + $error_bag = [ ]; |
|
| 32 | 32 | $new_filename = null; |
| 33 | 33 | |
| 34 | - foreach (is_array($uploaded_files) ? $uploaded_files : [$uploaded_files] as $file) { |
|
| 34 | + foreach (is_array($uploaded_files) ? $uploaded_files : [ $uploaded_files ] as $file) { |
|
| 35 | 35 | try { |
| 36 | 36 | $this->lfm->validateUploadedFile($file); |
| 37 | 37 | |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | } else { // upload via ckeditor5 expects json responses |
| 52 | 52 | if (is_null($new_filename)) { |
| 53 | 53 | $response = [ |
| 54 | - 'error' => [ 'message' => $error_bag[0] ] |
|
| 54 | + 'error' => [ 'message' => $error_bag[ 0 ] ] |
|
| 55 | 55 | ]; |
| 56 | 56 | } else { |
| 57 | 57 | $url = $this->lfm->setName($new_filename)->url(); |
@@ -91,11 +91,11 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | } |
@@ -282,11 +282,11 @@ discard block |
||
| 282 | 282 | $file_name_without_extentions = $new_file_name; |
| 283 | 283 | while ($this->setName(($extension) ? $new_file_name_with_extention : $new_file_name)->exists()) { |
| 284 | 284 | if (config('lfm.alphanumeric_filename') === true) { |
| 285 | - $suffix = '_'.$counter; |
|
| 285 | + $suffix = '_' . $counter; |
|
| 286 | 286 | } else { |
| 287 | 287 | $suffix = " ({$counter})"; |
| 288 | 288 | } |
| 289 | - $new_file_name = $file_name_without_extentions.$suffix; |
|
| 289 | + $new_file_name = $file_name_without_extentions . $suffix; |
|
| 290 | 290 | |
| 291 | 291 | if ($extension) { |
| 292 | 292 | $new_file_name_with_extention = $new_file_name . '.' . $extension; |