@@ -27,7 +27,7 @@ |
||
27 | 27 | |
28 | 28 | private function checkDefaultFolderExists($type = 'share') |
29 | 29 | { |
30 | - if (! $this->helper->allowFolderType($type)) { |
|
30 | + if (!$this->helper->allowFolderType($type)) { |
|
31 | 31 | return; |
32 | 32 | } |
33 | 33 |
@@ -22,7 +22,7 @@ |
||
22 | 22 | |
23 | 23 | if ($previous_dir == null) { |
24 | 24 | $request->merge(compact('working_dir')); |
25 | - } elseif (! $this->validDir($previous_dir)) { |
|
25 | + } elseif (!$this->validDir($previous_dir)) { |
|
26 | 26 | $request->replace(compact('working_dir')); |
27 | 27 | } |
28 | 28 | } |
@@ -10,7 +10,7 @@ |
||
10 | 10 | { |
11 | 11 | $storage = Storage::disk($this->helper->config('disk')); |
12 | 12 | |
13 | - if (! $storage->exists($file_path)) { |
|
13 | + if (!$storage->exists($file_path)) { |
|
14 | 14 | abort(404); |
15 | 15 | } |
16 | 16 |
@@ -31,9 +31,9 @@ |
||
31 | 31 | $image_path = $this->lfm->setName($image_name)->path('absolute'); |
32 | 32 | $crop_path = $image_path; |
33 | 33 | |
34 | - if (! $overWrite) { |
|
34 | + if (!$overWrite) { |
|
35 | 35 | $fileParts = explode('.', $image_name); |
36 | - $fileParts[count($fileParts) - 2] = $fileParts[count($fileParts) - 2] . '_cropped_' . time(); |
|
36 | + $fileParts[ count($fileParts) - 2 ] = $fileParts[ count($fileParts) - 2 ] . '_cropped_' . time(); |
|
37 | 37 | $crop_path = $this->lfm->setName(implode('.', $fileParts))->path('absolute'); |
38 | 38 | } |
39 | 39 |
@@ -33,7 +33,7 @@ |
||
33 | 33 | return parent::error('rename'); |
34 | 34 | } |
35 | 35 | |
36 | - if (! $is_directory) { |
|
36 | + if (!$is_directory) { |
|
37 | 37 | $extension = $old_file->extension(); |
38 | 38 | if ($extension) { |
39 | 39 | $new_name = str_replace('.' . $extension, '', $new_name) . '.' . $extension; |
@@ -11,20 +11,20 @@ |
||
11 | 11 | */ |
12 | 12 | public function getFolders() |
13 | 13 | { |
14 | - $folder_types = array_filter(['user', 'share'], function ($type) { |
|
14 | + $folder_types = array_filter([ 'user', 'share' ], function($type) { |
|
15 | 15 | return $this->helper->allowFolderType($type); |
16 | 16 | }); |
17 | 17 | |
18 | 18 | return view('laravel-filemanager::tree') |
19 | 19 | ->with([ |
20 | - 'root_folders' => array_map(function ($type) use ($folder_types) { |
|
20 | + 'root_folders' => array_map(function($type) use ($folder_types) { |
|
21 | 21 | $path = $this->lfm->dir($this->helper->getRootFolder($type)); |
22 | 22 | |
23 | 23 | return (object) [ |
24 | 24 | 'name' => trans('laravel-filemanager::lfm.title-' . $type), |
25 | 25 | 'url' => $path->path('working_dir'), |
26 | 26 | 'children' => $path->folders(), |
27 | - 'has_next' => ! ($type == end($folder_types)), |
|
27 | + 'has_next' => !($type == end($folder_types)), |
|
28 | 28 | ]; |
29 | 29 | }, $folder_types), |
30 | 30 | ]); |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | $items = array_merge($this->lfm->folders(), $this->lfm->files()); |
23 | 23 | |
24 | 24 | return [ |
25 | - 'items' => array_map(function ($item) { |
|
25 | + 'items' => array_map(function($item) { |
|
26 | 26 | return $item->fill()->attributes; |
27 | 27 | }, array_slice($items, ($currentPage - 1) * $perPage, $perPage)), |
28 | 28 | 'paginator' => [ |
@@ -38,19 +38,19 @@ discard block |
||
38 | 38 | public function move() |
39 | 39 | { |
40 | 40 | $items = request('items'); |
41 | - $folder_types = array_filter(['user', 'share'], function ($type) { |
|
41 | + $folder_types = array_filter([ 'user', 'share' ], function($type) { |
|
42 | 42 | return $this->helper->allowFolderType($type); |
43 | 43 | }); |
44 | 44 | return view('laravel-filemanager::move') |
45 | 45 | ->with([ |
46 | - 'root_folders' => array_map(function ($type) use ($folder_types) { |
|
46 | + 'root_folders' => array_map(function($type) use ($folder_types) { |
|
47 | 47 | $path = $this->lfm->dir($this->helper->getRootFolder($type)); |
48 | 48 | |
49 | 49 | return (object) [ |
50 | 50 | 'name' => trans('laravel-filemanager::lfm.title-' . $type), |
51 | 51 | 'url' => $path->path('working_dir'), |
52 | 52 | 'children' => $path->folders(), |
53 | - 'has_next' => ! ($type == end($folder_types)), |
|
53 | + 'has_next' => !($type == end($folder_types)), |
|
54 | 54 | ]; |
55 | 55 | }, $folder_types), |
56 | 56 | ]) |
@@ -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,14 +64,14 @@ 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 | |
71 | 71 | return $arr_errors; |
72 | 72 | } |
73 | 73 | |
74 | - public function error($error_type, $variables = []) |
|
74 | + public function error($error_type, $variables = [ ]) |
|
75 | 75 | { |
76 | 76 | return $this->helper->error($error_type, $variables); |
77 | 77 | } |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | */ |
84 | 84 | public function applyIniOverrides() |
85 | 85 | { |
86 | - $overrides = config('lfm.php_ini_overrides', []); |
|
86 | + $overrides = config('lfm.php_ini_overrides', [ ]); |
|
87 | 87 | |
88 | 88 | if ($overrides && is_array($overrides) && count($overrides) === 0) { |
89 | 89 | return; |
@@ -12,25 +12,25 @@ discard block |
||
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')??['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' ]; |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | public function __get($var_name) |
27 | 27 | { |
28 | 28 | if (!array_key_exists($var_name, $this->attributes)) { |
29 | 29 | $function_name = Str::camel($var_name); |
30 | - $this->attributes[$var_name] = $this->$function_name(); |
|
30 | + $this->attributes[ $var_name ] = $this->$function_name(); |
|
31 | 31 | } |
32 | 32 | |
33 | - return $this->attributes[$var_name]; |
|
33 | + return $this->attributes[ $var_name ]; |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | public function fill() |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | |
60 | 60 | public function isFile() |
61 | 61 | { |
62 | - return ! $this->isDirectory(); |
|
62 | + return !$this->isDirectory(); |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | /** |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | return false; |
175 | 175 | } |
176 | 176 | |
177 | - if (in_array($this->mimeType(), ['image/gif', 'image/svg+xml'])) { |
|
177 | + if (in_array($this->mimeType(), [ 'image/gif', 'image/svg+xml' ])) { |
|
178 | 178 | return false; |
179 | 179 | } |
180 | 180 | |
@@ -195,9 +195,9 @@ discard block |
||
195 | 195 | */ |
196 | 196 | public function humanFilesize($bytes, $decimals = 2) |
197 | 197 | { |
198 | - $size = ['B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']; |
|
198 | + $size = [ 'B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB' ]; |
|
199 | 199 | $factor = floor((strlen($bytes) - 1) / 3); |
200 | 200 | |
201 | - return sprintf("%.{$decimals}f %s", $bytes / pow(1024, $factor), @$size[$factor]); |
|
201 | + return sprintf("%.{$decimals}f %s", $bytes / pow(1024, $factor), @$size[ $factor ]); |
|
202 | 202 | } |
203 | 203 | } |