@@ -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; |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | public function getDelete() |
16 | 16 | { |
17 | 17 | $item_names = request('items'); |
18 | - $errors = []; |
|
18 | + $errors = [ ]; |
|
19 | 19 | |
20 | 20 | foreach ($item_names as $name_to_delete) { |
21 | 21 | $file_to_delete = $this->lfm->pretty($name_to_delete); |
@@ -28,13 +28,13 @@ discard block |
||
28 | 28 | continue; |
29 | 29 | } |
30 | 30 | |
31 | - if (! $this->lfm->setName($name_to_delete)->exists()) { |
|
32 | - array_push($errors, parent::error('folder-not-found', ['folder' => $file_path])); |
|
31 | + if (!$this->lfm->setName($name_to_delete)->exists()) { |
|
32 | + array_push($errors, parent::error('folder-not-found', [ 'folder' => $file_path ])); |
|
33 | 33 | continue; |
34 | 34 | } |
35 | 35 | |
36 | 36 | if ($this->lfm->setName($name_to_delete)->isDirectory()) { |
37 | - if (! $this->lfm->setName($name_to_delete)->directoryIsEmpty()) { |
|
37 | + if (!$this->lfm->setName($name_to_delete)->directoryIsEmpty()) { |
|
38 | 38 | array_push($errors, parent::error('delete-folder')); |
39 | 39 | continue; |
40 | 40 | } |
@@ -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 | ]); |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | $lfm_type = 'file'; |
76 | 76 | |
77 | 77 | $request_type = lcfirst(Str::singular($this->input('type') ?: '')); |
78 | - $available_types = array_keys($this->config->get('lfm.folder_categories') ?: []); |
|
78 | + $available_types = array_keys($this->config->get('lfm.folder_categories') ?: [ ]); |
|
79 | 79 | |
80 | 80 | if (in_array($request_type, $available_types)) { |
81 | 81 | $lfm_type = $request_type; |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | $view_type = 'grid'; |
93 | 93 | $target_display_type = $this->input('show_list') ?: $startup_view; |
94 | 94 | |
95 | - if (in_array($target_display_type, ['list', 'grid'])) { |
|
95 | + if (in_array($target_display_type, [ 'list', 'grid' ])) { |
|
96 | 96 | $view_type = $target_display_type; |
97 | 97 | } |
98 | 98 | |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | */ |
177 | 177 | public function allowShareFolder() |
178 | 178 | { |
179 | - if (! $this->allowMultiUser()) { |
|
179 | + if (!$this->allowMultiUser()) { |
|
180 | 180 | return true; |
181 | 181 | } |
182 | 182 | |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | * @param mixed $variables Variables the message needs. |
231 | 231 | * @return string |
232 | 232 | */ |
233 | - public function error($error_type, $variables = []) |
|
233 | + public function error($error_type, $variables = [ ]) |
|
234 | 234 | { |
235 | 235 | throw new \Exception(trans(self::PACKAGE_NAME . '::lfm.error-' . $error_type, $variables)); |
236 | 236 | } |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | $as = 'unisharp.lfm.'; |
247 | 247 | $namespace = '\\UniSharp\\LaravelFilemanager\\Controllers\\'; |
248 | 248 | |
249 | - Route::group(compact('middleware', 'as', 'namespace'), function () { |
|
249 | + Route::group(compact('middleware', 'as', 'namespace'), function() { |
|
250 | 250 | |
251 | 251 | // display main layout |
252 | 252 | Route::get('/', [ |
@@ -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 | ]) |