@@ -152,6 +152,10 @@ |
||
| 152 | 152 | return false; |
| 153 | 153 | } |
| 154 | 154 | |
| 155 | + /** |
|
| 156 | + * @param string $key |
|
| 157 | + * @param string $column |
|
| 158 | + */ |
|
| 155 | 159 | private function getColumnValue($key, $column) |
| 156 | 160 | { |
| 157 | 161 | $value = $this->connection->fetchColumn( |
@@ -184,7 +184,7 @@ |
||
| 184 | 184 | |
| 185 | 185 | return [ |
| 186 | 186 | 'dirs' => [], |
| 187 | - 'keys' => array_map(function ($value) { |
|
| 187 | + 'keys' => array_map(function($value) { |
|
| 188 | 188 | return $value['_key']; |
| 189 | 189 | }, |
| 190 | 190 | $keys), |
@@ -41,7 +41,7 @@ |
||
| 41 | 41 | } |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | - return $prefix . implode('/', $tokens); |
|
| 44 | + return $prefix.implode('/', $tokens); |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | /** |
@@ -205,7 +205,7 @@ |
||
| 205 | 205 | { |
| 206 | 206 | $this->ensureDirectoryExists($this->directory, $this->create); |
| 207 | 207 | |
| 208 | - return $this->normalizePath($this->directory . '/' . $key); |
|
| 208 | + return $this->normalizePath($this->directory.'/'.$key); |
|
| 209 | 209 | } |
| 210 | 210 | |
| 211 | 211 | /** |
@@ -58,7 +58,7 @@ |
||
| 58 | 58 | */ |
| 59 | 59 | public function keys() |
| 60 | 60 | { |
| 61 | - return array_map(function ($content) { |
|
| 61 | + return array_map(function($content) { |
|
| 62 | 62 | return $content['path']; |
| 63 | 63 | }, $this->adapter->listContents()); |
| 64 | 64 | } |
@@ -135,7 +135,7 @@ |
||
| 135 | 135 | * Returns the stat of a file in the zip archive |
| 136 | 136 | * (name, index, crc, mtime, compression size, compression method, filesize). |
| 137 | 137 | * |
| 138 | - * @param $key |
|
| 138 | + * @param string $key |
|
| 139 | 139 | * |
| 140 | 140 | * @return array|bool |
| 141 | 141 | */ |
@@ -166,46 +166,46 @@ |
||
| 166 | 166 | |
| 167 | 167 | if (true !== ($resultCode = $this->zipArchive->open($this->zipFile, ZipArchive::CREATE))) { |
| 168 | 168 | switch ($resultCode) { |
| 169 | - case ZipArchive::ER_EXISTS: |
|
| 170 | - $errMsg = 'File already exists.'; |
|
| 169 | + case ZipArchive::ER_EXISTS: |
|
| 170 | + $errMsg = 'File already exists.'; |
|
| 171 | 171 | |
| 172 | - break; |
|
| 173 | - case ZipArchive::ER_INCONS: |
|
| 174 | - $errMsg = 'Zip archive inconsistent.'; |
|
| 172 | + break; |
|
| 173 | + case ZipArchive::ER_INCONS: |
|
| 174 | + $errMsg = 'Zip archive inconsistent.'; |
|
| 175 | 175 | |
| 176 | - break; |
|
| 177 | - case ZipArchive::ER_INVAL: |
|
| 178 | - $errMsg = 'Invalid argument.'; |
|
| 176 | + break; |
|
| 177 | + case ZipArchive::ER_INVAL: |
|
| 178 | + $errMsg = 'Invalid argument.'; |
|
| 179 | 179 | |
| 180 | - break; |
|
| 181 | - case ZipArchive::ER_MEMORY: |
|
| 182 | - $errMsg = 'Malloc failure.'; |
|
| 180 | + break; |
|
| 181 | + case ZipArchive::ER_MEMORY: |
|
| 182 | + $errMsg = 'Malloc failure.'; |
|
| 183 | 183 | |
| 184 | - break; |
|
| 185 | - case ZipArchive::ER_NOENT: |
|
| 186 | - $errMsg = 'Invalid argument.'; |
|
| 184 | + break; |
|
| 185 | + case ZipArchive::ER_NOENT: |
|
| 186 | + $errMsg = 'Invalid argument.'; |
|
| 187 | 187 | |
| 188 | - break; |
|
| 189 | - case ZipArchive::ER_NOZIP: |
|
| 190 | - $errMsg = 'Not a zip archive.'; |
|
| 188 | + break; |
|
| 189 | + case ZipArchive::ER_NOZIP: |
|
| 190 | + $errMsg = 'Not a zip archive.'; |
|
| 191 | 191 | |
| 192 | - break; |
|
| 193 | - case ZipArchive::ER_OPEN: |
|
| 194 | - $errMsg = 'Can\'t open file.'; |
|
| 192 | + break; |
|
| 193 | + case ZipArchive::ER_OPEN: |
|
| 194 | + $errMsg = 'Can\'t open file.'; |
|
| 195 | 195 | |
| 196 | - break; |
|
| 197 | - case ZipArchive::ER_READ: |
|
| 198 | - $errMsg = 'Read error.'; |
|
| 196 | + break; |
|
| 197 | + case ZipArchive::ER_READ: |
|
| 198 | + $errMsg = 'Read error.'; |
|
| 199 | 199 | |
| 200 | - break; |
|
| 201 | - case ZipArchive::ER_SEEK: |
|
| 202 | - $errMsg = 'Seek error.'; |
|
| 200 | + break; |
|
| 201 | + case ZipArchive::ER_SEEK: |
|
| 202 | + $errMsg = 'Seek error.'; |
|
| 203 | 203 | |
| 204 | - break; |
|
| 205 | - default: |
|
| 206 | - $errMsg = 'Unknown error.'; |
|
| 204 | + break; |
|
| 205 | + default: |
|
| 206 | + $errMsg = 'Unknown error.'; |
|
| 207 | 207 | |
| 208 | - break; |
|
| 208 | + break; |
|
| 209 | 209 | } |
| 210 | 210 | |
| 211 | 211 | throw new \RuntimeException(sprintf('%s', $errMsg)); |
@@ -213,7 +213,7 @@ |
||
| 213 | 213 | /** |
| 214 | 214 | * @param string $path |
| 215 | 215 | * |
| 216 | - * @return mixed |
|
| 216 | + * @return boolean |
|
| 217 | 217 | */ |
| 218 | 218 | public function unlink($path) |
| 219 | 219 | { |
@@ -257,11 +257,11 @@ |
||
| 257 | 257 | $key = substr($parts['path'], 1); |
| 258 | 258 | |
| 259 | 259 | if (null !== $parts['query']) { |
| 260 | - $key .= '?' . $parts['query']; |
|
| 260 | + $key .= '?'.$parts['query']; |
|
| 261 | 261 | } |
| 262 | 262 | |
| 263 | 263 | if (null !== $parts['fragment']) { |
| 264 | - $key .= '#' . $parts['fragment']; |
|
| 264 | + $key .= '#'.$parts['fragment']; |
|
| 265 | 265 | } |
| 266 | 266 | |
| 267 | 267 | if (empty($domain) || empty($key)) { |
@@ -458,7 +458,7 @@ discard block |
||
| 458 | 458 | } |
| 459 | 459 | |
| 460 | 460 | /** |
| 461 | - * @param string|resource $content |
|
| 461 | + * @param string $content |
|
| 462 | 462 | * |
| 463 | 463 | * @return string |
| 464 | 464 | */ |
@@ -476,7 +476,7 @@ discard block |
||
| 476 | 476 | /** |
| 477 | 477 | * @param string $key |
| 478 | 478 | * |
| 479 | - * @return array |
|
| 479 | + * @return string[] |
|
| 480 | 480 | * @throws \InvalidArgumentException |
| 481 | 481 | */ |
| 482 | 482 | private function tokenizeKey($key) |
@@ -273,7 +273,7 @@ discard block |
||
| 273 | 273 | $containersList = $this->blobProxy->listContainers(); |
| 274 | 274 | |
| 275 | 275 | return call_user_func_array('array_merge', array_map( |
| 276 | - function (Container $container) { |
|
| 276 | + function(Container $container) { |
|
| 277 | 277 | $containerName = $container->getName(); |
| 278 | 278 | |
| 279 | 279 | return $this->fetchBlobs($containerName, $containerName); |
@@ -567,10 +567,10 @@ discard block |
||
| 567 | 567 | $blobList = $this->blobProxy->listBlobs($containerName); |
| 568 | 568 | |
| 569 | 569 | return array_map( |
| 570 | - function (Blob $blob) use ($prefix) { |
|
| 570 | + function(Blob $blob) use ($prefix) { |
|
| 571 | 571 | $name = $blob->getName(); |
| 572 | 572 | if (null !== $prefix) { |
| 573 | - $name = $prefix . '/' . $name; |
|
| 573 | + $name = $prefix.'/'.$name; |
|
| 574 | 574 | } |
| 575 | 575 | |
| 576 | 576 | return $name; |
@@ -307,6 +307,9 @@ discard block |
||
| 307 | 307 | return true; |
| 308 | 308 | } |
| 309 | 309 | |
| 310 | + /** |
|
| 311 | + * @param string $key |
|
| 312 | + */ |
|
| 310 | 313 | protected function getOptions($key, array $options = []) |
| 311 | 314 | { |
| 312 | 315 | $options['ACL'] = $this->options['acl']; |
@@ -322,6 +325,9 @@ discard block |
||
| 322 | 325 | return $options; |
| 323 | 326 | } |
| 324 | 327 | |
| 328 | + /** |
|
| 329 | + * @return string |
|
| 330 | + */ |
|
| 325 | 331 | protected function computePath($key) |
| 326 | 332 | { |
| 327 | 333 | if (empty($this->options['directory'])) { |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | $this->ensureBucketExists(); |
| 140 | 140 | $options = $this->getOptions( |
| 141 | 141 | $targetKey, |
| 142 | - ['CopySource' => $this->bucket . '/' . $this->computePath($sourceKey)] |
|
| 142 | + ['CopySource' => $this->bucket.'/'.$this->computePath($sourceKey)] |
|
| 143 | 143 | ); |
| 144 | 144 | |
| 145 | 145 | try { |
@@ -268,7 +268,7 @@ discard block |
||
| 268 | 268 | { |
| 269 | 269 | $result = $this->service->listObjects([ |
| 270 | 270 | 'Bucket' => $this->bucket, |
| 271 | - 'Prefix' => rtrim($this->computePath($key), '/') . '/', |
|
| 271 | + 'Prefix' => rtrim($this->computePath($key), '/').'/', |
|
| 272 | 272 | 'MaxKeys' => 1, |
| 273 | 273 | ]); |
| 274 | 274 | if (isset($result['Contents'])) { |
@@ -241,6 +241,7 @@ |
||
| 241 | 241 | |
| 242 | 242 | /** |
| 243 | 243 | * {@inheritdoc} |
| 244 | + * @param string $key |
|
| 244 | 245 | */ |
| 245 | 246 | public function createFile($key) |
| 246 | 247 | { |