@@ -137,7 +137,7 @@ |
||
| 137 | 137 | /** |
| 138 | 138 | * @param string $key - by default '' |
| 139 | 139 | * @param integer $format - by default APC_ITER_NONE |
| 140 | - * @return \APCIterator |
|
| 140 | + * @return \Traversable |
|
| 141 | 141 | * |
| 142 | 142 | */ |
| 143 | 143 | protected function getCachedKeysIterator($key = '', $format = APC_ITER_NONE) |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | public function rename($sourceKey, $targetKey) |
| 110 | 110 | { |
| 111 | 111 | // TODO: this probably allows for race conditions... |
| 112 | - $written = $this->write($targetKey, $this->read($sourceKey)); |
|
| 112 | + $written = $this->write($targetKey, $this->read($sourceKey)); |
|
| 113 | 113 | $deleted = $this->delete($sourceKey); |
| 114 | 114 | |
| 115 | 115 | return $written && $deleted; |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | */ |
| 132 | 132 | public function computePath($key) |
| 133 | 133 | { |
| 134 | - return $this->prefix . $key; |
|
| 134 | + return $this->prefix.$key; |
|
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | /** |
@@ -272,6 +272,9 @@ discard block |
||
| 272 | 272 | return true; |
| 273 | 273 | } |
| 274 | 274 | |
| 275 | + /** |
|
| 276 | + * @param string $key |
|
| 277 | + */ |
|
| 275 | 278 | protected function getOptions($key, array $options = array()) |
| 276 | 279 | { |
| 277 | 280 | $options['ACL'] = $this->options['acl']; |
@@ -287,6 +290,9 @@ discard block |
||
| 287 | 290 | return $options; |
| 288 | 291 | } |
| 289 | 292 | |
| 293 | + /** |
|
| 294 | + * @return string |
|
| 295 | + */ |
|
| 290 | 296 | protected function computePath($key) |
| 291 | 297 | { |
| 292 | 298 | if (empty($this->options['directory'])) { |
@@ -12,9 +12,9 @@ |
||
| 12 | 12 | * @author Michael Dowling <[email protected]> |
| 13 | 13 | */ |
| 14 | 14 | class AwsS3 implements Adapter, |
| 15 | - MetadataSupporter, |
|
| 16 | - ListKeysAware, |
|
| 17 | - SizeCalculator |
|
| 15 | + MetadataSupporter, |
|
| 16 | + ListKeysAware, |
|
| 17 | + SizeCalculator |
|
| 18 | 18 | { |
| 19 | 19 | protected $service; |
| 20 | 20 | protected $bucket; |
@@ -228,7 +228,7 @@ |
||
| 228 | 228 | { |
| 229 | 229 | $result = $this->service->listObjects(array( |
| 230 | 230 | 'Bucket' => $this->bucket, |
| 231 | - 'Prefix' => rtrim($this->computePath($key), '/') . '/', |
|
| 231 | + 'Prefix' => rtrim($this->computePath($key), '/').'/', |
|
| 232 | 232 | 'MaxKeys' => 1 |
| 233 | 233 | )); |
| 234 | 234 | |
@@ -5,7 +5,6 @@ |
||
| 5 | 5 | use Gaufrette\Adapter; |
| 6 | 6 | use Gaufrette\Util; |
| 7 | 7 | use Gaufrette\Adapter\AzureBlobStorage\BlobProxyFactoryInterface; |
| 8 | - |
|
| 9 | 8 | use WindowsAzure\Blob\Models\CreateBlobOptions; |
| 10 | 9 | use WindowsAzure\Blob\Models\CreateContainerOptions; |
| 11 | 10 | use WindowsAzure\Blob\Models\DeleteContainerOptions; |
@@ -19,7 +19,7 @@ |
||
| 19 | 19 | * @author Paweł Czyżewski <[email protected]> |
| 20 | 20 | */ |
| 21 | 21 | class AzureBlobStorage implements Adapter, |
| 22 | - MetadataSupporter |
|
| 22 | + MetadataSupporter |
|
| 23 | 23 | { |
| 24 | 24 | /** |
| 25 | 25 | * Error constants |
@@ -2,7 +2,6 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace Gaufrette\Adapter; |
| 4 | 4 | |
| 5 | -use Gaufrette\File; |
|
| 6 | 5 | use Gaufrette\Adapter; |
| 7 | 6 | use Gaufrette\Adapter\InMemory as InMemoryAdapter; |
| 8 | 7 | |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | * @author Antoine Hérault <[email protected]> |
| 14 | 14 | */ |
| 15 | 15 | class Cache implements Adapter, |
| 16 | - MetadataSupporter |
|
| 16 | + MetadataSupporter |
|
| 17 | 17 | { |
| 18 | 18 | /** |
| 19 | 19 | * @var Adapter |
@@ -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( |
@@ -4,7 +4,6 @@ |
||
| 4 | 4 | |
| 5 | 5 | use Gaufrette\Adapter; |
| 6 | 6 | use Gaufrette\Util; |
| 7 | - |
|
| 8 | 7 | use Doctrine\DBAL\Connection; |
| 9 | 8 | |
| 10 | 9 | /** |
@@ -15,8 +15,8 @@ |
||
| 15 | 15 | * @author Leszek Prabucki <[email protected]> |
| 16 | 16 | */ |
| 17 | 17 | class DoctrineDbal implements Adapter, |
| 18 | - ChecksumCalculator, |
|
| 19 | - ListKeysAware |
|
| 18 | + ChecksumCalculator, |
|
| 19 | + ListKeysAware |
|
| 20 | 20 | { |
| 21 | 21 | protected $connection; |
| 22 | 22 | protected $table; |
@@ -186,7 +186,7 @@ |
||
| 186 | 186 | |
| 187 | 187 | return array( |
| 188 | 188 | 'dirs' => array(), |
| 189 | - 'keys' => array_map(function ($value) { |
|
| 189 | + 'keys' => array_map(function($value) { |
|
| 190 | 190 | return $value['_key']; |
| 191 | 191 | }, |
| 192 | 192 | $keys) |
@@ -162,6 +162,9 @@ |
||
| 162 | 162 | } |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | + /** |
|
| 166 | + * @param string $key |
|
| 167 | + */ |
|
| 165 | 168 | private function getDropboxMetadata($key) |
| 166 | 169 | { |
| 167 | 170 | try { |
@@ -131,7 +131,7 @@ |
||
| 131 | 131 | public function keys() |
| 132 | 132 | { |
| 133 | 133 | $metadata = $this->client->getMetaData('/', true); |
| 134 | - if (! isset($metadata['contents'])) { |
|
| 134 | + if (!isset($metadata['contents'])) { |
|
| 135 | 135 | return array(); |
| 136 | 136 | } |
| 137 | 137 | |
@@ -5,7 +5,6 @@ |
||
| 5 | 5 | use Gaufrette\Adapter; |
| 6 | 6 | use Gaufrette\File; |
| 7 | 7 | use Gaufrette\Filesystem; |
| 8 | -use Gaufrette\Exception; |
|
| 9 | 8 | |
| 10 | 9 | /** |
| 11 | 10 | * Ftp adapter |
@@ -14,8 +14,8 @@ discard block |
||
| 14 | 14 | * @author Antoine Hérault <[email protected]> |
| 15 | 15 | */ |
| 16 | 16 | class Ftp implements Adapter, |
| 17 | - FileFactory, |
|
| 18 | - ListKeysAware |
|
| 17 | + FileFactory, |
|
| 18 | + ListKeysAware |
|
| 19 | 19 | { |
| 20 | 20 | protected $connection = null; |
| 21 | 21 | protected $directory; |
@@ -263,8 +263,8 @@ discard block |
||
| 263 | 263 | $this->fileData = array_merge($fileData, $this->fileData); |
| 264 | 264 | |
| 265 | 265 | return array( |
| 266 | - 'keys' => array_keys($fileData), |
|
| 267 | - 'dirs' => $dirs |
|
| 266 | + 'keys' => array_keys($fileData), |
|
| 267 | + 'dirs' => $dirs |
|
| 268 | 268 | ); |
| 269 | 269 | } |
| 270 | 270 | |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | $this->ensureDirectoryExists($this->directory, $this->create); |
| 124 | 124 | |
| 125 | 125 | $file = $this->computePath($key); |
| 126 | - $lines = ftp_rawlist($this->getConnection(), '-al ' . str_replace('\\', '/', dirname($file))); |
|
| 126 | + $lines = ftp_rawlist($this->getConnection(), '-al '.str_replace('\\', '/', dirname($file))); |
|
| 127 | 127 | |
| 128 | 128 | if (false === $lines) { |
| 129 | 129 | return false; |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | $directory = preg_replace('/^[\/]*([^\/].*)$/', '/$1', $directory); |
| 237 | 237 | |
| 238 | 238 | $items = $this->parseRawlist( |
| 239 | - ftp_rawlist($this->getConnection(), '-al ' . $this->directory . $directory ) ? : array() |
|
| 239 | + ftp_rawlist($this->getConnection(), '-al '.$this->directory.$directory) ?: array() |
|
| 240 | 240 | ); |
| 241 | 241 | |
| 242 | 242 | $fileData = $dirs = array(); |
@@ -248,7 +248,7 @@ discard block |
||
| 248 | 248 | |
| 249 | 249 | $item = array( |
| 250 | 250 | 'name' => $itemData['name'], |
| 251 | - 'path' => trim(($directory ? $directory . '/' : '') . $itemData['name'], '/'), |
|
| 251 | + 'path' => trim(($directory ? $directory.'/' : '').$itemData['name'], '/'), |
|
| 252 | 252 | 'time' => $itemData['time'], |
| 253 | 253 | 'size' => $itemData['size'], |
| 254 | 254 | ); |
@@ -360,13 +360,13 @@ discard block |
||
| 360 | 360 | { |
| 361 | 361 | $directory = preg_replace('/^[\/]*([^\/].*)$/', '/$1', $directory); |
| 362 | 362 | |
| 363 | - $lines = ftp_rawlist($this->getConnection(), '-alR '. $this->directory . $directory); |
|
| 363 | + $lines = ftp_rawlist($this->getConnection(), '-alR '.$this->directory.$directory); |
|
| 364 | 364 | |
| 365 | 365 | if (false === $lines) { |
| 366 | 366 | return array('keys' => array(), 'dirs' => array()); |
| 367 | 367 | } |
| 368 | 368 | |
| 369 | - $regexDir = '/'.preg_quote($this->directory . $directory, '/').'\/?(.+):$/u'; |
|
| 369 | + $regexDir = '/'.preg_quote($this->directory.$directory, '/').'\/?(.+):$/u'; |
|
| 370 | 370 | $regexItem = '/^(?:([d\-\d])\S+)\s+\S+(?:(?:\s+\S+){5})?\s+(\S+)\s+(.+?)$/'; |
| 371 | 371 | |
| 372 | 372 | $prevLine = null; |
@@ -390,7 +390,7 @@ discard block |
||
| 390 | 390 | continue; |
| 391 | 391 | } |
| 392 | 392 | |
| 393 | - $path = ltrim($directory . '/' . $name, '/'); |
|
| 393 | + $path = ltrim($directory.'/'.$name, '/'); |
|
| 394 | 394 | |
| 395 | 395 | if ('d' === $tokens[1] || '<dir>' === $tokens[2]) { |
| 396 | 396 | $keys['dirs'][] = $path; |
@@ -430,13 +430,13 @@ discard block |
||
| 430 | 430 | $infos = preg_split("/[\s]+/", $line, 9); |
| 431 | 431 | |
| 432 | 432 | if ($this->isLinuxListing($infos)) { |
| 433 | - $infos[7] = (strrpos($infos[7], ':') != 2 ) ? ($infos[7] . ' 00:00') : (date('Y') . ' ' . $infos[7]); |
|
| 433 | + $infos[7] = (strrpos($infos[7], ':') != 2) ? ($infos[7].' 00:00') : (date('Y').' '.$infos[7]); |
|
| 434 | 434 | if ('total' !== $infos[0]) { |
| 435 | 435 | $parsed[] = array( |
| 436 | 436 | 'perms' => $infos[0], |
| 437 | 437 | 'num' => $infos[1], |
| 438 | 438 | 'size' => $infos[4], |
| 439 | - 'time' => strtotime($infos[5] . ' ' . $infos[6] . '. ' . $infos[7]), |
|
| 439 | + 'time' => strtotime($infos[5].' '.$infos[6].'. '.$infos[7]), |
|
| 440 | 440 | 'name' => $infos[8] |
| 441 | 441 | ); |
| 442 | 442 | } |
@@ -446,7 +446,7 @@ discard block |
||
| 446 | 446 | 'perms' => $isDir ? 'd' : '-', |
| 447 | 447 | 'num' => '', |
| 448 | 448 | 'size' => $isDir ? '' : $infos[2], |
| 449 | - 'time' => strtotime($infos[0] . ' ' . $infos[1]), |
|
| 449 | + 'time' => strtotime($infos[0].' '.$infos[1]), |
|
| 450 | 450 | 'name' => $infos[3] |
| 451 | 451 | ); |
| 452 | 452 | } |
@@ -462,7 +462,7 @@ discard block |
||
| 462 | 462 | */ |
| 463 | 463 | private function computePath($key) |
| 464 | 464 | { |
| 465 | - return rtrim($this->directory, '/') . '/' . $key; |
|
| 465 | + return rtrim($this->directory, '/').'/'.$key; |
|
| 466 | 466 | } |
| 467 | 467 | |
| 468 | 468 | /** |
@@ -501,7 +501,7 @@ discard block |
||
| 501 | 501 | if (!$this->ssl) { |
| 502 | 502 | $this->connection = ftp_connect($this->host, $this->port); |
| 503 | 503 | } else { |
| 504 | - if(function_exists('ftp_ssl_connect')) { |
|
| 504 | + if (function_exists('ftp_ssl_connect')) { |
|
| 505 | 505 | $this->connection = ftp_ssl_connect($this->host, $this->port); |
| 506 | 506 | } else { |
| 507 | 507 | throw new \RuntimeException('This Server Has No SSL-FTP Available.'); |
@@ -511,8 +511,8 @@ discard block |
||
| 511 | 511 | throw new \RuntimeException(sprintf('Could not connect to \'%s\' (port: %s).', $this->host, $this->port)); |
| 512 | 512 | } |
| 513 | 513 | |
| 514 | - $username = $this->username ? : 'anonymous'; |
|
| 515 | - $password = $this->password ? : ''; |
|
| 514 | + $username = $this->username ?: 'anonymous'; |
|
| 515 | + $password = $this->password ?: ''; |
|
| 516 | 516 | |
| 517 | 517 | // login ftp user |
| 518 | 518 | if (!@ftp_login($this->connection, $username, $password)) { |
@@ -349,6 +349,9 @@ |
||
| 349 | 349 | } |
| 350 | 350 | } |
| 351 | 351 | |
| 352 | + /** |
|
| 353 | + * @param string $key |
|
| 354 | + */ |
|
| 352 | 355 | protected function computePath($key) |
| 353 | 356 | { |
| 354 | 357 | if (empty($this->options['directory'])) { |
@@ -261,7 +261,7 @@ discard block |
||
| 261 | 261 | */ |
| 262 | 262 | public function isDirectory($key) |
| 263 | 263 | { |
| 264 | - if ($this->exists($key . '/')) { |
|
| 264 | + if ($this->exists($key.'/')) { |
|
| 265 | 265 | return true; |
| 266 | 266 | } |
| 267 | 267 | |
@@ -276,7 +276,7 @@ discard block |
||
| 276 | 276 | $this->ensureBucketExists(); |
| 277 | 277 | |
| 278 | 278 | $options = array(); |
| 279 | - if ((string)$prefix != '') { |
|
| 279 | + if ((string) $prefix != '') { |
|
| 280 | 280 | $options['prefix'] = $this->computePath($prefix); |
| 281 | 281 | } elseif (!empty($this->options['directory'])) { |
| 282 | 282 | $options['prefix'] = $this->options['directory']; |
@@ -145,6 +145,9 @@ |
||
| 145 | 145 | return isset($this->metadata[$key]) ? $this->metadata[$key] : array(); |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | + /** |
|
| 149 | + * @param string $key |
|
| 150 | + */ |
|
| 148 | 151 | private function find($key, array $fields = array()) |
| 149 | 152 | { |
| 150 | 153 | return $this->gridFS->findOne($key, $fields); |