@@ -12,5 +12,5 @@ |
||
| 12 | 12 | /** |
| 13 | 13 | * @return false|string the mime type of the specified key. |
| 14 | 14 | */ |
| 15 | - public function mimeType(string $key): string|bool; |
|
| 15 | + public function mimeType(string $key): string | bool; |
|
| 16 | 16 | } |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | /** |
| 73 | 73 | * {@inheritdoc} |
| 74 | 74 | */ |
| 75 | - public function read(string $key): string|bool |
|
| 75 | + public function read(string $key): string | bool |
|
| 76 | 76 | { |
| 77 | 77 | $this->ensureBucketExists(); |
| 78 | 78 | $options = $this->getOptions($key); |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | $this->ensureBucketExists(); |
| 102 | 102 | $options = $this->getOptions( |
| 103 | 103 | $targetKey, |
| 104 | - ['CopySource' => $this->bucket . '/' . $this->computePath($sourceKey)] |
|
| 104 | + ['CopySource' => $this->bucket.'/'.$this->computePath($sourceKey)] |
|
| 105 | 105 | ); |
| 106 | 106 | |
| 107 | 107 | try { |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | /** |
| 117 | 117 | * {@inheritdoc} |
| 118 | 118 | */ |
| 119 | - public function write(string $key, mixed $content): int|bool |
|
| 119 | + public function write(string $key, mixed $content): int | bool |
|
| 120 | 120 | { |
| 121 | 121 | $this->ensureBucketExists(); |
| 122 | 122 | $options = $this->getOptions($key); |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | /** |
| 155 | 155 | * {@inheritdoc} |
| 156 | 156 | */ |
| 157 | - public function mtime(string $key): int|bool |
|
| 157 | + public function mtime(string $key): int | bool |
|
| 158 | 158 | { |
| 159 | 159 | try { |
| 160 | 160 | $result = $this->service->headObject($this->getOptions($key)); |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | return (int) $result->getContentLength(); |
| 176 | 176 | } |
| 177 | 177 | |
| 178 | - public function mimeType(string $key): string|bool |
|
| 178 | + public function mimeType(string $key): string | bool |
|
| 179 | 179 | { |
| 180 | 180 | $result = $this->service->headObject($this->getOptions($key)); |
| 181 | 181 | |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | { |
| 235 | 235 | $result = $this->service->listObjectsV2([ |
| 236 | 236 | 'Bucket' => $this->bucket, |
| 237 | - 'Prefix' => rtrim($this->computePath($key), '/') . '/', |
|
| 237 | + 'Prefix' => rtrim($this->computePath($key), '/').'/', |
|
| 238 | 238 | 'MaxKeys' => 1, |
| 239 | 239 | ]); |
| 240 | 240 | |
@@ -313,7 +313,7 @@ discard block |
||
| 313 | 313 | return ltrim(substr($path, strlen($this->options['directory'])), '/'); |
| 314 | 314 | } |
| 315 | 315 | |
| 316 | - private function guessContentType(mixed $content): bool|string |
|
| 316 | + private function guessContentType(mixed $content): bool | string |
|
| 317 | 317 | { |
| 318 | 318 | $fileInfo = new \finfo(FILEINFO_MIME_TYPE); |
| 319 | 319 | |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | /** |
| 116 | 116 | * {@inheritdoc} |
| 117 | 117 | */ |
| 118 | - public function read(string $key): string|bool |
|
| 118 | + public function read(string $key): string | bool |
|
| 119 | 119 | { |
| 120 | 120 | $this->init(); |
| 121 | 121 | list($containerName, $key) = $this->tokenizeKey($key); |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | /** |
| 135 | 135 | * {@inheritdoc} |
| 136 | 136 | */ |
| 137 | - public function write(string $key, mixed $content): int|bool |
|
| 137 | + public function write(string $key, mixed $content): int | bool |
|
| 138 | 138 | { |
| 139 | 139 | $this->init(); |
| 140 | 140 | list($containerName, $key) = $this->tokenizeKey($key); |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | $containersList = $this->blobProxy->listContainers(); |
| 223 | 223 | |
| 224 | 224 | return call_user_func_array('array_merge', array_map( |
| 225 | - function (Container $container) { |
|
| 225 | + function(Container $container) { |
|
| 226 | 226 | $containerName = $container->getName(); |
| 227 | 227 | |
| 228 | 228 | return $this->fetchBlobs($containerName, $containerName); |
@@ -248,7 +248,7 @@ discard block |
||
| 248 | 248 | /** |
| 249 | 249 | * {@inheritdoc} |
| 250 | 250 | */ |
| 251 | - public function mtime(string $key): int|bool |
|
| 251 | + public function mtime(string $key): int | bool |
|
| 252 | 252 | { |
| 253 | 253 | $this->init(); |
| 254 | 254 | list($containerName, $key) = $this->tokenizeKey($key); |
@@ -286,7 +286,7 @@ discard block |
||
| 286 | 286 | /** |
| 287 | 287 | * {@inheritdoc} |
| 288 | 288 | */ |
| 289 | - public function mimeType(string $key): string|bool |
|
| 289 | + public function mimeType(string $key): string | bool |
|
| 290 | 290 | { |
| 291 | 291 | $this->init(); |
| 292 | 292 | list($containerName, $key) = $this->tokenizeKey($key); |
@@ -305,7 +305,7 @@ discard block |
||
| 305 | 305 | /** |
| 306 | 306 | * {@inheritdoc} |
| 307 | 307 | */ |
| 308 | - public function checksum(string $key): string|bool |
|
| 308 | + public function checksum(string $key): string | bool |
|
| 309 | 309 | { |
| 310 | 310 | $this->init(); |
| 311 | 311 | list($containerName, $key) = $this->tokenizeKey($key); |
@@ -509,10 +509,10 @@ discard block |
||
| 509 | 509 | $blobList = $this->blobProxy->listBlobs($containerName); |
| 510 | 510 | |
| 511 | 511 | return array_map( |
| 512 | - function (Blob $blob) use ($prefix) { |
|
| 512 | + function(Blob $blob) use ($prefix) { |
|
| 513 | 513 | $name = $blob->getName(); |
| 514 | 514 | if (null !== $prefix) { |
| 515 | - $name = $prefix . '/' . $name; |
|
| 515 | + $name = $prefix.'/'.$name; |
|
| 516 | 516 | } |
| 517 | 517 | |
| 518 | 518 | return $name; |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | /** |
| 32 | 32 | * {@inheritdoc} |
| 33 | 33 | */ |
| 34 | - public function read(string $key): string|bool |
|
| 34 | + public function read(string $key): string | bool |
|
| 35 | 35 | { |
| 36 | 36 | try { |
| 37 | 37 | $stream = $this->bucket->openDownloadStreamByName($key); |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | /** |
| 50 | 50 | * {@inheritdoc} |
| 51 | 51 | */ |
| 52 | - public function write(string $key, mixed $content): int|bool |
|
| 52 | + public function write(string $key, mixed $content): int | bool |
|
| 53 | 53 | { |
| 54 | 54 | $stream = $this->bucket->openUploadStream($key, ['metadata' => $this->getMetadata($key)]); |
| 55 | 55 | |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | /** |
| 116 | 116 | * {@inheritdoc} |
| 117 | 117 | */ |
| 118 | - public function mtime(string $key): int|bool |
|
| 118 | + public function mtime(string $key): int | bool |
|
| 119 | 119 | { |
| 120 | 120 | $file = $this->bucket->findOne(['filename' => $key], ['projection' => ['uploadDate' => 1]]); |
| 121 | 121 | |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | /** |
| 126 | 126 | * {@inheritdoc} |
| 127 | 127 | */ |
| 128 | - public function checksum(string $key): string|bool |
|
| 128 | + public function checksum(string $key): string | bool |
|
| 129 | 129 | { |
| 130 | 130 | $file = $this->bucket->findOne(['filename' => $key], ['projection' => ['md5' => 1]]); |
| 131 | 131 | |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | if (isset($this->metadata[$key])) { |
| 163 | 163 | return $this->metadata[$key]; |
| 164 | 164 | } |
| 165 | - $meta = $this->bucket->findOne(['filename' => $key], ['projection' => ['metadata' => 1,'_id' => 0]]); |
|
| 165 | + $meta = $this->bucket->findOne(['filename' => $key], ['projection' => ['metadata' => 1, '_id' => 0]]); |
|
| 166 | 166 | |
| 167 | 167 | if ($meta === null || !isset($meta['metadata'])) { |
| 168 | 168 | return []; |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | if (!$this->exists($key)) { |
| 207 | 207 | return false; |
| 208 | 208 | } |
| 209 | - $size = $this->bucket->findOne(['filename' => $key], ['projection' => ['length' => 1,'_id' => 0]]); |
|
| 209 | + $size = $this->bucket->findOne(['filename' => $key], ['projection' => ['length' => 1, '_id' => 0]]); |
|
| 210 | 210 | if (!isset($size['length'])) { |
| 211 | 211 | return false; |
| 212 | 212 | } |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | ]; |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | - public function read(string $key): string|bool |
|
| 68 | + public function read(string $key): string | bool |
|
| 69 | 69 | { |
| 70 | 70 | return $this->files[$key]['content']; |
| 71 | 71 | } |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | /** |
| 82 | 82 | * @param ?array<string, mixed> $metadata |
| 83 | 83 | */ |
| 84 | - public function write(string $key, mixed $content, array $metadata = null): int|bool |
|
| 84 | + public function write(string $key, mixed $content, array $metadata = null): int | bool |
|
| 85 | 85 | { |
| 86 | 86 | $this->files[$key]['content'] = $content; |
| 87 | 87 | $this->files[$key]['mtime'] = time(); |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | return array_keys($this->files); |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | - public function mtime(string $key): int|bool |
|
| 105 | + public function mtime(string $key): int | bool |
|
| 106 | 106 | { |
| 107 | 107 | return $this->files[$key]['mtime'] ?? false; |
| 108 | 108 | } |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | return false; |
| 121 | 121 | } |
| 122 | 122 | |
| 123 | - public function mimeType(string $key): bool|string |
|
| 123 | + public function mimeType(string $key): bool | string |
|
| 124 | 124 | { |
| 125 | 125 | $fileInfo = new \finfo(FILEINFO_MIME_TYPE); |
| 126 | 126 | |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | /** |
| 30 | 30 | * {@inheritdoc} |
| 31 | 31 | */ |
| 32 | - public function read(string $key): string|bool |
|
| 32 | + public function read(string $key): string | bool |
|
| 33 | 33 | { |
| 34 | 34 | return $this->sftp->get($this->computePath($key)); |
| 35 | 35 | } |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | /** |
| 53 | 53 | * {@inheritdoc} |
| 54 | 54 | */ |
| 55 | - public function write(string $key, mixed $content): int|bool |
|
| 55 | + public function write(string $key, mixed $content): int | bool |
|
| 56 | 56 | { |
| 57 | 57 | $this->initialize(); |
| 58 | 58 | |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | /** |
| 133 | 133 | * {@inheritdoc} |
| 134 | 134 | */ |
| 135 | - public function mtime(string $key): int|bool |
|
| 135 | + public function mtime(string $key): int | bool |
|
| 136 | 136 | { |
| 137 | 137 | $this->initialize(); |
| 138 | 138 | |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | |
| 197 | 197 | protected function computePath(string $key): string |
| 198 | 198 | { |
| 199 | - return $this->directory . '/' . ltrim($key, '/'); |
|
| 199 | + return $this->directory.'/'.ltrim($key, '/'); |
|
| 200 | 200 | } |
| 201 | 201 | |
| 202 | 202 | /** |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | continue; |
| 218 | 218 | } |
| 219 | 219 | |
| 220 | - $path = ltrim($directory . '/' . $filename, '/'); |
|
| 220 | + $path = ltrim($directory.'/'.$filename, '/'); |
|
| 221 | 221 | if (isset($stat['type']) && $stat['type'] === NET_SFTP_TYPE_DIRECTORY) { |
| 222 | 222 | $keys['dirs'][] = $path; |
| 223 | 223 | } else { |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | /** |
| 28 | 28 | * {@inheritdoc} |
| 29 | 29 | */ |
| 30 | - public function read(string $key): string|bool |
|
| 30 | + public function read(string $key): string | bool |
|
| 31 | 31 | { |
| 32 | 32 | return $this->adapter->read($key)['contents']; |
| 33 | 33 | } |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | /** |
| 36 | 36 | * {@inheritdoc} |
| 37 | 37 | */ |
| 38 | - public function write(string $key, mixed $content): int|bool |
|
| 38 | + public function write(string $key, mixed $content): int | bool |
|
| 39 | 39 | { |
| 40 | 40 | $metadata = $this->adapter->write($key, $content, $this->config); |
| 41 | 41 | |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | */ |
| 64 | 64 | public function keys(): array |
| 65 | 65 | { |
| 66 | - return array_map(function ($content) { |
|
| 66 | + return array_map(function($content) { |
|
| 67 | 67 | return $content['path']; |
| 68 | 68 | }, $this->adapter->listContents()); |
| 69 | 69 | } |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | /** |
| 96 | 96 | * {@inheritdoc} |
| 97 | 97 | */ |
| 98 | - public function mtime(string $key): int|bool |
|
| 98 | + public function mtime(string $key): int | bool |
|
| 99 | 99 | { |
| 100 | 100 | return $this->adapter->getTimestamp($key); |
| 101 | 101 | } |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | $this->utf8 = $options['utf8'] ?? false; |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | - public function read(string $key): string|bool |
|
| 55 | + public function read(string $key): string | bool |
|
| 56 | 56 | { |
| 57 | 57 | $this->ensureDirectoryExists($this->directory, $this->create); |
| 58 | 58 | |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | return $contents; |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | - public function write(string $key, mixed $content): int|bool |
|
| 72 | + public function write(string $key, mixed $content): int | bool |
|
| 73 | 73 | { |
| 74 | 74 | $this->ensureDirectoryExists($this->directory, $this->create); |
| 75 | 75 | |
@@ -110,13 +110,13 @@ discard block |
||
| 110 | 110 | $this->ensureDirectoryExists($this->directory, $this->create); |
| 111 | 111 | |
| 112 | 112 | $file = $this->computePath($key); |
| 113 | - $lines = ftp_rawlist($this->getConnection(), '-al ' . \Gaufrette\Util\Path::dirname($file)); |
|
| 113 | + $lines = ftp_rawlist($this->getConnection(), '-al '.\Gaufrette\Util\Path::dirname($file)); |
|
| 114 | 114 | |
| 115 | 115 | if (false === $lines) { |
| 116 | 116 | return false; |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | - $pattern = '{(?<!->) ' . preg_quote(basename($file)) . '( -> |$)}m'; |
|
| 119 | + $pattern = '{(?<!->) '.preg_quote(basename($file)).'( -> |$)}m'; |
|
| 120 | 120 | foreach ($lines as $line) { |
| 121 | 121 | if (preg_match($pattern, $line)) { |
| 122 | 122 | return true; |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | return $filteredKeys; |
| 165 | 165 | } |
| 166 | 166 | |
| 167 | - public function mtime(string $key): int|bool |
|
| 167 | + public function mtime(string $key): int | bool |
|
| 168 | 168 | { |
| 169 | 169 | $this->ensureDirectoryExists($this->directory, $this->create); |
| 170 | 170 | |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | $directory = preg_replace('/^[\/]*([^\/].*)$/', '/$1', $directory); |
| 212 | 212 | |
| 213 | 213 | $items = $this->parseRawlist( |
| 214 | - ftp_rawlist($this->getConnection(), '-al ' . $this->directory . $directory) ?: [] |
|
| 214 | + ftp_rawlist($this->getConnection(), '-al '.$this->directory.$directory) ?: [] |
|
| 215 | 215 | ); |
| 216 | 216 | |
| 217 | 217 | $fileData = $dirs = []; |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | |
| 223 | 223 | $item = [ |
| 224 | 224 | 'name' => $itemData['name'], |
| 225 | - 'path' => trim(($directory ? $directory . '/' : '') . $itemData['name'], '/'), |
|
| 225 | + 'path' => trim(($directory ? $directory.'/' : '').$itemData['name'], '/'), |
|
| 226 | 226 | 'time' => $itemData['time'], |
| 227 | 227 | 'size' => $itemData['size'], |
| 228 | 228 | ]; |
@@ -351,13 +351,13 @@ discard block |
||
| 351 | 351 | { |
| 352 | 352 | $directory = preg_replace('/^[\/]*([^\/].*)$/', '/$1', $directory); |
| 353 | 353 | |
| 354 | - $lines = ftp_rawlist($this->getConnection(), '-alR ' . $this->directory . $directory); |
|
| 354 | + $lines = ftp_rawlist($this->getConnection(), '-alR '.$this->directory.$directory); |
|
| 355 | 355 | |
| 356 | 356 | if (false === $lines) { |
| 357 | 357 | return ['keys' => [], 'dirs' => []]; |
| 358 | 358 | } |
| 359 | 359 | |
| 360 | - $regexDir = '/' . preg_quote($this->directory . $directory, '/') . '\/?(.+):$/u'; |
|
| 360 | + $regexDir = '/'.preg_quote($this->directory.$directory, '/').'\/?(.+):$/u'; |
|
| 361 | 361 | $regexItem = '/^(?:([d\-\d])\S+)\s+\S+(?:(?:\s+\S+){5})?\s+(\S+)\s+(.+?)$/'; |
| 362 | 362 | |
| 363 | 363 | $prevLine = null; |
@@ -381,7 +381,7 @@ discard block |
||
| 381 | 381 | continue; |
| 382 | 382 | } |
| 383 | 383 | |
| 384 | - $path = ltrim($directory . '/' . $name, '/'); |
|
| 384 | + $path = ltrim($directory.'/'.$name, '/'); |
|
| 385 | 385 | |
| 386 | 386 | if ('d' === $tokens[1] || '<dir>' === $tokens[2]) { |
| 387 | 387 | $keys['dirs'][] = $path; |
@@ -421,13 +421,13 @@ discard block |
||
| 421 | 421 | $infos = preg_split("/[\s]+/", $line, 9); |
| 422 | 422 | |
| 423 | 423 | if ($this->isLinuxListing($infos)) { |
| 424 | - $infos[7] = (strrpos($infos[7], ':') != 2) ? ($infos[7] . ' 00:00') : (date('Y') . ' ' . $infos[7]); |
|
| 424 | + $infos[7] = (strrpos($infos[7], ':') != 2) ? ($infos[7].' 00:00') : (date('Y').' '.$infos[7]); |
|
| 425 | 425 | if ('total' !== $infos[0]) { |
| 426 | 426 | $parsed[] = [ |
| 427 | 427 | 'perms' => $infos[0], |
| 428 | 428 | 'num' => $infos[1], |
| 429 | 429 | 'size' => $infos[4], |
| 430 | - 'time' => strtotime($infos[5] . ' ' . $infos[6] . '. ' . $infos[7]), |
|
| 430 | + 'time' => strtotime($infos[5].' '.$infos[6].'. '.$infos[7]), |
|
| 431 | 431 | 'name' => $infos[8], |
| 432 | 432 | ]; |
| 433 | 433 | } |
@@ -437,7 +437,7 @@ discard block |
||
| 437 | 437 | 'perms' => $isDir ? 'd' : '-', |
| 438 | 438 | 'num' => '', |
| 439 | 439 | 'size' => $isDir ? '' : $infos[2], |
| 440 | - 'time' => strtotime($infos[0] . ' ' . $infos[1]), |
|
| 440 | + 'time' => strtotime($infos[0].' '.$infos[1]), |
|
| 441 | 441 | 'name' => $infos[3], |
| 442 | 442 | ]; |
| 443 | 443 | } |
@@ -451,7 +451,7 @@ discard block |
||
| 451 | 451 | */ |
| 452 | 452 | private function computePath(string $key): string |
| 453 | 453 | { |
| 454 | - return rtrim($this->directory, '/') . '/' . $key; |
|
| 454 | + return rtrim($this->directory, '/').'/'.$key; |
|
| 455 | 455 | } |
| 456 | 456 | |
| 457 | 457 | /** |
@@ -561,7 +561,7 @@ discard block |
||
| 561 | 561 | /** |
| 562 | 562 | * @param array<int, string>|false $info |
| 563 | 563 | */ |
| 564 | - private function isLinuxListing(bool|array $info): bool |
|
| 564 | + private function isLinuxListing(bool | array $info): bool |
|
| 565 | 565 | { |
| 566 | 566 | return count($info) >= 9; |
| 567 | 567 | } |
@@ -12,5 +12,5 @@ |
||
| 12 | 12 | /** |
| 13 | 13 | * Returns the checksum of the specified key. |
| 14 | 14 | */ |
| 15 | - public function checksum(string $key): string|bool; |
|
| 15 | + public function checksum(string $key): string | bool; |
|
| 16 | 16 | } |