@@ -12,8 +12,8 @@ discard block |
||
| 12 | 12 | private $isDirectory; |
| 13 | 13 | private $mimeType = null; |
| 14 | 14 | |
| 15 | - private $columns = ['name', 'url', 'time', 'icon', 'is_file', 'is_image', 'thumb_url']; |
|
| 16 | - public $attributes = []; |
|
| 15 | + private $columns = [ 'name', 'url', 'time', 'icon', 'is_file', 'is_image', 'thumb_url' ]; |
|
| 16 | + public $attributes = [ ]; |
|
| 17 | 17 | |
| 18 | 18 | public function __construct(LfmPath $lfm, Lfm $helper, $isDirectory = false) |
| 19 | 19 | { |
@@ -26,10 +26,10 @@ discard block |
||
| 26 | 26 | { |
| 27 | 27 | if (!array_key_exists($var_name, $this->attributes)) { |
| 28 | 28 | $function_name = Str::camel($var_name); |
| 29 | - $this->attributes[$var_name] = $this->$function_name(); |
|
| 29 | + $this->attributes[ $var_name ] = $this->$function_name(); |
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | - return $this->attributes[$var_name]; |
|
| 32 | + return $this->attributes[ $var_name ]; |
|
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | public function fill() |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | |
| 59 | 59 | public function isFile() |
| 60 | 60 | { |
| 61 | - return ! $this->isDirectory(); |
|
| 61 | + return !$this->isDirectory(); |
|
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | /** |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | return false; |
| 178 | 178 | } |
| 179 | 179 | |
| 180 | - if (in_array($this->mimeType(), ['image/gif', 'image/svg+xml'])) { |
|
| 180 | + if (in_array($this->mimeType(), [ 'image/gif', 'image/svg+xml' ])) { |
|
| 181 | 181 | return false; |
| 182 | 182 | } |
| 183 | 183 | |
@@ -198,9 +198,9 @@ discard block |
||
| 198 | 198 | */ |
| 199 | 199 | public function humanFilesize($bytes, $decimals = 2) |
| 200 | 200 | { |
| 201 | - $size = ['B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']; |
|
| 201 | + $size = [ 'B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB' ]; |
|
| 202 | 202 | $factor = floor((strlen($bytes) - 1) / 3); |
| 203 | 203 | |
| 204 | - return sprintf("%.{$decimals}f %s", $bytes / pow(1024, $factor), @$size[$factor]); |
|
| 204 | + return sprintf("%.{$decimals}f %s", $bytes / pow(1024, $factor), @$size[ $factor ]); |
|
| 205 | 205 | } |
| 206 | 206 | } |
@@ -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 | return $this->pretty($file_path); |
| 108 | 108 | }, $this->storage->files()); |
| 109 | 109 | |
@@ -148,7 +148,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 | } |