@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | return static::from_pathname($pathname_or_parts); |
158 | 158 | } |
159 | 159 | |
160 | - throw new \InvalidArgumentException("Expected an array or a string, got: " . gettype($pathname_or_parts) . "."); |
|
160 | + throw new \InvalidArgumentException("Expected an array or a string, got: ".gettype($pathname_or_parts)."."); |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | /** |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | */ |
174 | 174 | static protected function from_parts(array $parts) |
175 | 175 | { |
176 | - list($root, $hash, $random) = $parts + [ 2 => null]; |
|
176 | + list($root, $hash, $random) = $parts + [2 => null]; |
|
177 | 177 | |
178 | 178 | $random = $random ?: self::random(); |
179 | 179 | |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | { |
192 | 192 | $ds = preg_quote(DIRECTORY_SEPARATOR); |
193 | 193 | |
194 | - if (!preg_match("#(.+{$ds})" . self::FILENAME_REGEX . '$#', $pathname, $matches)) |
|
194 | + if (!preg_match("#(.+{$ds})".self::FILENAME_REGEX.'$#', $pathname, $matches)) |
|
195 | 195 | { |
196 | 196 | throw new \InvalidArgumentException("Invalid hash pathname: $pathname."); |
197 | 197 | } |
@@ -218,6 +218,6 @@ discard block |
||
218 | 218 | */ |
219 | 219 | public function __toString() |
220 | 220 | { |
221 | - return $this->root . $this->filename; |
|
221 | + return $this->root.$this->filename; |
|
222 | 222 | } |
223 | 223 | } |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | $encoded_uuid = substr($key, self::ENCODED_ID_LENGTH + 1, self::ENCODED_UUID_LENGTH); |
78 | 78 | $hash = substr($key, self::ENCODED_ID_LENGTH + 1 + self::ENCODED_UUID_LENGTH + 1); |
79 | 79 | |
80 | - return [ $encoded_id, $encoded_uuid, $hash ]; |
|
80 | + return [$encoded_id, $encoded_uuid, $hash]; |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | /** |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | */ |
104 | 104 | static public function encode_id($id) |
105 | 105 | { |
106 | - return sprintf('%0' . self::ENCODED_ID_LENGTH . 'x', $id); |
|
106 | + return sprintf('%0'.self::ENCODED_ID_LENGTH.'x', $id); |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | /** |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | throw new \LogicException("Invalid UUID: $uuid."); |
133 | 133 | } |
134 | 134 | |
135 | - return Base64::encode_unpadded(hex2bin(strtr($uuid, [ '-' => '' ]))); |
|
135 | + return Base64::encode_unpadded(hex2bin(strtr($uuid, ['-' => '']))); |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | /** |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | throw new \InvalidArgumentException("`\$root` parameter cannot be empty."); |
53 | 53 | } |
54 | 54 | |
55 | - $this->root = rtrim($root, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR; |
|
55 | + $this->root = rtrim($root, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR; |
|
56 | 56 | $this->index = $index; |
57 | 57 | } |
58 | 58 | |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | { |
70 | 70 | $this->assert_hash_is_used($hash); |
71 | 71 | |
72 | - $key = IndexKey::from([ $nid, $uuid, $hash ]); |
|
72 | + $key = IndexKey::from([$nid, $uuid, $hash]); |
|
73 | 73 | |
74 | 74 | $this->index->add($key); |
75 | 75 | |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | protected function find_by_hash($hash) |
166 | 166 | { |
167 | 167 | $di = new \DirectoryIterator($this->root); |
168 | - $di = new \RegexIterator($di, '#^' . preg_quote($hash) . '\-#'); |
|
168 | + $di = new \RegexIterator($di, '#^'.preg_quote($hash).'\-#'); |
|
169 | 169 | |
170 | 170 | foreach ($di as $file) |
171 | 171 | { |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | { |
205 | 205 | $hash = $hash ?: $this->hash($pathname); |
206 | 206 | |
207 | - return Pathname::from([ $this->root, $hash ]); |
|
207 | + return Pathname::from([$this->root, $hash]); |
|
208 | 208 | } |
209 | 209 | |
210 | 210 | /** |
@@ -36,8 +36,8 @@ discard block |
||
36 | 36 | { |
37 | 37 | parent::add_assets($document); |
38 | 38 | |
39 | - $document->css->add(Root\DIR . 'public/edit.css'); |
|
40 | - $document->js->add(Root\DIR . 'public/edit.js'); |
|
39 | + $document->css->add(Root\DIR.'public/edit.css'); |
|
40 | + $document->js->add(Root\DIR.'public/edit.js'); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | protected function lazy_get_values() |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | |
53 | 53 | protected function lazy_get_children() |
54 | 54 | { |
55 | - $folder = \ICanBoogie\REPOSITORY . 'tmp'; |
|
55 | + $folder = \ICanBoogie\REPOSITORY.'tmp'; |
|
56 | 56 | |
57 | 57 | if (!is_writable($folder)) |
58 | 58 | { |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | |
61 | 61 | Element::CHILDREN => [ |
62 | 62 | |
63 | - $this->t('The folder %folder is not writable !', [ '%folder' => $folder ]) |
|
63 | + $this->t('The folder %folder is not writable !', ['%folder' => $folder]) |
|
64 | 64 | |
65 | 65 | ] |
66 | 66 | ]; |
@@ -117,9 +117,9 @@ discard block |
||
117 | 117 | |
118 | 118 | Form::LABEL => 'file', |
119 | 119 | Element::REQUIRED => empty($nid), |
120 | - \Brickrouge\File::FILE_WITH_LIMIT => $this->app->site->metas[$this->module->flat_id . '.max_file_size'], |
|
120 | + \Brickrouge\File::FILE_WITH_LIMIT => $this->app->site->metas[$this->module->flat_id.'.max_file_size'], |
|
121 | 121 | Element::WEIGHT => -100, |
122 | - \Brickrouge\File::T_UPLOAD_URL => Operation::encode($this->module->id . '/upload'), |
|
122 | + \Brickrouge\File::T_UPLOAD_URL => Operation::encode($this->module->id.'/upload'), |
|
123 | 123 | |
124 | 124 | 'value' => $path |
125 | 125 |
@@ -26,14 +26,14 @@ |
||
26 | 26 | { |
27 | 27 | parent::add_assets($document); |
28 | 28 | |
29 | - $document->css->add(Root\DIR . '/public/manage.css'); |
|
29 | + $document->css->add(Root\DIR.'/public/manage.css'); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | public function __construct(Module $module, array $attributes) |
33 | 33 | { |
34 | 34 | parent::__construct($module, $attributes + [ |
35 | 35 | |
36 | - self::T_COLUMNS_ORDER => [ 'title', 'size', 'download', 'is_online', 'uid', 'mime', 'updated_at' ] |
|
36 | + self::T_COLUMNS_ORDER => ['title', 'size', 'download', 'is_online', 'uid', 'mime', 'updated_at'] |
|
37 | 37 | |
38 | 38 | ]); |
39 | 39 | } |
@@ -13,11 +13,11 @@ |
||
13 | 13 | |
14 | 14 | use ICanBoogie; |
15 | 15 | |
16 | -$hooks = Hooks::class . '::'; |
|
16 | +$hooks = Hooks::class.'::'; |
|
17 | 17 | |
18 | 18 | return [ |
19 | 19 | |
20 | - ICanBoogie\Core::class . '::lazy_get_file_storage_index' => $hooks . 'get_file_storage_index', |
|
21 | - ICanBoogie\Core::class . '::lazy_get_file_storage' => $hooks . 'get_file_storage' |
|
20 | + ICanBoogie\Core::class.'::lazy_get_file_storage_index' => $hooks.'get_file_storage_index', |
|
21 | + ICanBoogie\Core::class.'::lazy_get_file_storage' => $hooks.'get_file_storage' |
|
22 | 22 | |
23 | 23 | ]; |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | 'files:show' => [ |
21 | 21 | |
22 | 22 | 'pattern' => '/files/<uuid:{:uuid:}><extension:[\.a-z]*>', |
23 | - 'controller' => FilesController::class . '#show', |
|
23 | + 'controller' => FilesController::class.'#show', |
|
24 | 24 | 'via' => Request::METHOD_GET |
25 | 25 | |
26 | 26 | ], |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | 'files:download' => [ |
29 | 29 | |
30 | 30 | 'pattern' => '/files/download/<uuid:{:uuid:}><extension:[\.a-z]*>', |
31 | - 'controller' => FilesController::class . '#download', |
|
31 | + 'controller' => FilesController::class.'#download', |
|
32 | 32 | 'via' => Request::METHOD_GET |
33 | 33 | |
34 | 34 | ], |
@@ -36,14 +36,14 @@ discard block |
||
36 | 36 | 'files:protected:show' => [ |
37 | 37 | |
38 | 38 | 'pattern' => '/files/<nid:\d+><extension:[\.a-z]*>', |
39 | - 'controller' => FilesAdminController::class . '#show' |
|
39 | + 'controller' => FilesAdminController::class.'#show' |
|
40 | 40 | |
41 | 41 | ], |
42 | 42 | |
43 | 43 | 'files:protected:download' => [ |
44 | 44 | |
45 | 45 | 'pattern' => '/files/download/<nid:\d+><extension:[\.a-z]*>', |
46 | - 'controller' => FilesAdminController::class . '#download' |
|
46 | + 'controller' => FilesAdminController::class.'#download' |
|
47 | 47 | |
48 | 48 | ] |
49 | 49 |
@@ -27,10 +27,10 @@ |
||
27 | 27 | Model::EXTENDING => 'nodes', |
28 | 28 | Model::SCHEMA => [ |
29 | 29 | |
30 | - 'size' => [ 'integer', 'unsigned' => true ], |
|
31 | - 'mime' => [ 'varchar', 'charset' => 'ascii/general_ci' ], |
|
32 | - 'extension' => [ 'varchar', 16, 'charset' => 'ascii/general_ci' ], |
|
33 | - 'short_hash' => [ 'char', 8 ], |
|
30 | + 'size' => ['integer', 'unsigned' => true], |
|
31 | + 'mime' => ['varchar', 'charset' => 'ascii/general_ci'], |
|
32 | + 'extension' => ['varchar', 16, 'charset' => 'ascii/general_ci'], |
|
33 | + 'short_hash' => ['char', 8], |
|
34 | 34 | 'description' => 'text' |
35 | 35 | |
36 | 36 | ] |
@@ -80,7 +80,7 @@ |
||
80 | 80 | return new FileResponse($pathname, $this->request, [ |
81 | 81 | |
82 | 82 | FileResponse::OPTION_ETAG => $pathname->hash, |
83 | - FileResponse::OPTION_FILENAME => $record->title . $record->extension, |
|
83 | + FileResponse::OPTION_FILENAME => $record->title.$record->extension, |
|
84 | 84 | FileResponse::OPTION_MIME => $record->mime |
85 | 85 | |
86 | 86 | ]); |