@@ -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'])) { |
@@ -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 | |
@@ -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( |
@@ -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 | |
@@ -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); |
@@ -252,7 +252,7 @@ discard block |
||
| 252 | 252 | /** |
| 253 | 253 | * Makes request to MogileFS tracker |
| 254 | 254 | * |
| 255 | - * @param cmd Command |
|
| 255 | + * @param cmd string |
|
| 256 | 256 | * @param args Array of arguments |
| 257 | 257 | * @return mixed Array on success, false on failure |
| 258 | 258 | */ |
@@ -303,7 +303,7 @@ discard block |
||
| 303 | 303 | /** |
| 304 | 304 | * Get file location at server from MogileFS tracker |
| 305 | 305 | * |
| 306 | - * @param key File key |
|
| 306 | + * @param key string key |
|
| 307 | 307 | * @return mixed Array on success, false on failure |
| 308 | 308 | */ |
| 309 | 309 | private function getPaths($key) |
@@ -318,7 +318,7 @@ discard block |
||
| 318 | 318 | * Sends file to MogileFS tracker |
| 319 | 319 | * |
| 320 | 320 | * @param path Save path at server |
| 321 | - * @param data Data to save |
|
| 321 | + * @param data string to save |
|
| 322 | 322 | * @return boolean |
| 323 | 323 | */ |
| 324 | 324 | private function putFile($path, $data) |
@@ -192,12 +192,12 @@ discard block |
||
| 192 | 192 | $domains = array(); |
| 193 | 193 | |
| 194 | 194 | for ($i = 1; $i <= $res['domains']; $i++) { |
| 195 | - $dom = 'domain' . $i; |
|
| 195 | + $dom = 'domain'.$i; |
|
| 196 | 196 | $classes = array(); |
| 197 | 197 | |
| 198 | 198 | // Associate classes to current domain (class name => mindevcount) |
| 199 | 199 | for ($j = 1; $j <= $res[$dom.'classes']; $j++) { |
| 200 | - $classes[$res[$dom . 'class' . $j . 'name']] = $res[$dom . 'class' . $j . 'mindevcount']; |
|
| 200 | + $classes[$res[$dom.'class'.$j.'name']] = $res[$dom.'class'.$j.'mindevcount']; |
|
| 201 | 201 | } |
| 202 | 202 | |
| 203 | 203 | $domains[] = array('name' => $res[$dom], 'classes' => $classes); |
@@ -337,11 +337,11 @@ discard block |
||
| 337 | 337 | stream_set_blocking($fp, true); |
| 338 | 338 | stream_set_timeout($fp, 30, 200000); |
| 339 | 339 | |
| 340 | - $out = "PUT ". $url['path']. " HTTP/1.1". $b; |
|
| 341 | - $out .= "Host: ". $url['host']. $b; |
|
| 342 | - $out .= "Content-Length: ". Util\Size::fromContent($data). $b. $b; |
|
| 340 | + $out = "PUT ".$url['path']." HTTP/1.1".$b; |
|
| 341 | + $out .= "Host: ".$url['host'].$b; |
|
| 342 | + $out .= "Content-Length: ".Util\Size::fromContent($data).$b.$b; |
|
| 343 | 343 | $out .= $data; |
| 344 | - $out .= $b. $b; |
|
| 344 | + $out .= $b.$b; |
|
| 345 | 345 | fwrite($fp, $out); |
| 346 | 346 | fflush($fp); |
| 347 | 347 | |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | * |
| 87 | 87 | * @param string $key |
| 88 | 88 | * |
| 89 | - * @return string|boolean if cannot read content |
|
| 89 | + * @return string if cannot read content |
|
| 90 | 90 | */ |
| 91 | 91 | public function read($key) |
| 92 | 92 | { |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | * |
| 160 | 160 | * @param string $key |
| 161 | 161 | * |
| 162 | - * @return integer|boolean An UNIX like timestamp or false |
|
| 162 | + * @return string|false An UNIX like timestamp or false |
|
| 163 | 163 | */ |
| 164 | 164 | public function mtime($key) |
| 165 | 165 | { |
@@ -143,7 +143,7 @@ |
||
| 143 | 143 | public function keys() |
| 144 | 144 | { |
| 145 | 145 | $objectList = $this->getContainer()->objectList(); |
| 146 | - $keys = array (); |
|
| 146 | + $keys = array(); |
|
| 147 | 147 | |
| 148 | 148 | while ($object = $objectList->next()) { |
| 149 | 149 | $keys[] = $object->getName(); |
@@ -187,6 +187,10 @@ discard block |
||
| 187 | 187 | $this->initialized = true; |
| 188 | 188 | } |
| 189 | 189 | |
| 190 | + /** |
|
| 191 | + * @param string|null $directory |
|
| 192 | + * @param boolean $create |
|
| 193 | + */ |
|
| 190 | 194 | protected function ensureDirectoryExists($directory, $create) |
| 191 | 195 | { |
| 192 | 196 | $pwd = $this->sftp->pwd(); |
@@ -201,6 +205,9 @@ discard block |
||
| 201 | 205 | } |
| 202 | 206 | } |
| 203 | 207 | |
| 208 | + /** |
|
| 209 | + * @param string $key |
|
| 210 | + */ |
|
| 204 | 211 | protected function computePath($key) |
| 205 | 212 | { |
| 206 | 213 | return $this->directory.'/'.ltrim($key, '/'); |