@@ -90,11 +90,11 @@ discard block |
||
| 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 |
||
| 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 | $file = $this->pretty($file_path); |
| 108 | 108 | $file_mime = mime_content_type($this->storage->rootPath() . $file_path); |
| 109 | 109 | if ($this->helper->availableMimeTypes() == "*" || (is_array($this->helper->availableMimeTypes()) && in_array($file_mime, $this->helper->availableMimeTypes()))) |
@@ -155,7 +155,7 @@ discard block |
||
| 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 |
||
| 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 strcmp($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 | } |
@@ -243,10 +243,10 @@ discard block |
||
| 243 | 243 | { |
| 244 | 244 | if (empty($file)) { |
| 245 | 245 | return $this->error('file-empty'); |
| 246 | - } elseif (! $file instanceof UploadedFile) { |
|
| 246 | + } elseif (!$file instanceof UploadedFile) { |
|
| 247 | 247 | return $this->error('instance'); |
| 248 | 248 | } elseif ($file->getError() == UPLOAD_ERR_INI_SIZE) { |
| 249 | - return $this->error('file-size', ['max' => ini_get('upload_max_filesize')]); |
|
| 249 | + return $this->error('file-size', [ 'max' => ini_get('upload_max_filesize') ]); |
|
| 250 | 250 | } elseif ($file->getError() != UPLOAD_ERR_OK) { |
| 251 | 251 | throw new \Exception('File failed to upload. Error code: ' . $file->getError()); |
| 252 | 252 | } |
@@ -259,7 +259,7 @@ discard block |
||
| 259 | 259 | |
| 260 | 260 | $mimetype = $file->getMimeType(); |
| 261 | 261 | |
| 262 | - $excutable = ['text/x-php']; |
|
| 262 | + $excutable = [ 'text/x-php' ]; |
|
| 263 | 263 | |
| 264 | 264 | if (in_array($mimetype, $excutable)) { |
| 265 | 265 | throw new \Exception('Invalid file detected'); |
@@ -304,11 +304,11 @@ discard block |
||
| 304 | 304 | $file_name_without_extentions = $new_file_name; |
| 305 | 305 | while ($this->setName(($extension) ? $new_file_name_with_extention : $new_file_name)->exists()) { |
| 306 | 306 | if (config('lfm.alphanumeric_filename') === true) { |
| 307 | - $suffix = '_'.$counter; |
|
| 307 | + $suffix = '_' . $counter; |
|
| 308 | 308 | } else { |
| 309 | 309 | $suffix = " ({$counter})"; |
| 310 | 310 | } |
| 311 | - $new_file_name = $file_name_without_extentions.$suffix; |
|
| 311 | + $new_file_name = $file_name_without_extentions . $suffix; |
|
| 312 | 312 | |
| 313 | 313 | if ($extension) { |
| 314 | 314 | $new_file_name_with_extention = $new_file_name . '.' . $extension; |
@@ -106,10 +106,11 @@ |
||
| 106 | 106 | $files = array_map(function ($file_path) { |
| 107 | 107 | $file = $this->pretty($file_path); |
| 108 | 108 | $file_mime = mime_content_type($this->storage->rootPath() . $file_path); |
| 109 | - if ($this->helper->availableMimeTypes() == "*" || (is_array($this->helper->availableMimeTypes()) && in_array($file_mime, $this->helper->availableMimeTypes()))) |
|
| 110 | - return $file; |
|
| 111 | - else |
|
| 112 | - return null; |
|
| 109 | + if ($this->helper->availableMimeTypes() == "*" || (is_array($this->helper->availableMimeTypes()) && in_array($file_mime, $this->helper->availableMimeTypes()))) { |
|
| 110 | + return $file; |
|
| 111 | + } else { |
|
| 112 | + return null; |
|
| 113 | + } |
|
| 113 | 114 | return $file; |
| 114 | 115 | }, $this->storage->files()); |
| 115 | 116 | |