@@ -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 | } |
@@ -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 | ]); |
@@ -10,9 +10,9 @@ discard block |
||
10 | 10 | |
11 | 11 | private $helper; |
12 | 12 | |
13 | - private $columns = ['name', 'url', 'time', 'icon', 'is_file', 'is_image', 'thumb_url']; |
|
13 | + private $columns = [ 'name', 'url', 'time', 'icon', 'is_file', 'is_image', 'thumb_url' ]; |
|
14 | 14 | |
15 | - public $attributes = []; |
|
15 | + public $attributes = [ ]; |
|
16 | 16 | |
17 | 17 | public function __construct(LfmPath $lfm, Lfm $helper) |
18 | 18 | { |
@@ -22,12 +22,12 @@ discard block |
||
22 | 22 | |
23 | 23 | public function __get($var_name) |
24 | 24 | { |
25 | - if (! array_key_exists($var_name, $this->attributes)) { |
|
25 | + if (!array_key_exists($var_name, $this->attributes)) { |
|
26 | 26 | $function_name = camel_case($var_name); |
27 | - $this->attributes[$var_name] = $this->$function_name(); |
|
27 | + $this->attributes[ $var_name ] = $this->$function_name(); |
|
28 | 28 | } |
29 | 29 | |
30 | - return $this->attributes[$var_name]; |
|
30 | + return $this->attributes[ $var_name ]; |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | public function fill() |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | */ |
67 | 67 | public function isFile() |
68 | 68 | { |
69 | - return ! $this->isDirectory(); |
|
69 | + return !$this->isDirectory(); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | /** |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | */ |
77 | 77 | public function isImage() |
78 | 78 | { |
79 | - if (! $this->isDirectory()) { |
|
79 | + if (!$this->isDirectory()) { |
|
80 | 80 | return starts_with($this->mimeType(), 'image'); |
81 | 81 | } |
82 | 82 | |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | */ |
129 | 129 | public function time() |
130 | 130 | { |
131 | - if (! $this->isDirectory()) { |
|
131 | + if (!$this->isDirectory()) { |
|
132 | 132 | return $this->lfm->lastModified(); |
133 | 133 | } |
134 | 134 | |
@@ -176,11 +176,11 @@ discard block |
||
176 | 176 | |
177 | 177 | public function hasThumb() |
178 | 178 | { |
179 | - if (! $this->isImage()) { |
|
179 | + if (!$this->isImage()) { |
|
180 | 180 | return false; |
181 | 181 | } |
182 | 182 | |
183 | - if (! $this->lfm->thumb()->exists()) { |
|
183 | + if (!$this->lfm->thumb()->exists()) { |
|
184 | 184 | return false; |
185 | 185 | } |
186 | 186 | |
@@ -189,15 +189,15 @@ discard block |
||
189 | 189 | |
190 | 190 | public function shouldCreateThumb() |
191 | 191 | { |
192 | - if (! $this->helper->config('should_create_thumbnails')) { |
|
192 | + if (!$this->helper->config('should_create_thumbnails')) { |
|
193 | 193 | return false; |
194 | 194 | } |
195 | 195 | |
196 | - if (! $this->isImage()) { |
|
196 | + if (!$this->isImage()) { |
|
197 | 197 | return false; |
198 | 198 | } |
199 | 199 | |
200 | - if (in_array($this->mimeType(), ['image/gif', 'image/svg+xml'])) { |
|
200 | + if (in_array($this->mimeType(), [ 'image/gif', 'image/svg+xml' ])) { |
|
201 | 201 | return false; |
202 | 202 | } |
203 | 203 | |
@@ -219,9 +219,9 @@ discard block |
||
219 | 219 | */ |
220 | 220 | public function humanFilesize($bytes, $decimals = 2) |
221 | 221 | { |
222 | - $size = ['B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']; |
|
222 | + $size = [ 'B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB' ]; |
|
223 | 223 | $factor = floor((strlen($bytes) - 1) / 3); |
224 | 224 | |
225 | - return sprintf("%.{$decimals}f %s", $bytes / pow(1024, $factor), @$size[$factor]); |
|
225 | + return sprintf("%.{$decimals}f %s", $bytes / pow(1024, $factor), @$size[ $factor ]); |
|
226 | 226 | } |
227 | 227 | } |