@@ -302,7 +302,7 @@ discard block |
||
| 302 | 302 | * |
| 303 | 303 | * @param string $path |
| 304 | 304 | * |
| 305 | - * @return array|false |
|
| 305 | + * @return string |
|
| 306 | 306 | */ |
| 307 | 307 | public function read($path) |
| 308 | 308 | { |
@@ -350,7 +350,7 @@ discard block |
||
| 350 | 350 | * |
| 351 | 351 | * @param string $path |
| 352 | 352 | * |
| 353 | - * @return array|false |
|
| 353 | + * @return string |
|
| 354 | 354 | */ |
| 355 | 355 | public function getMetadata($path) |
| 356 | 356 | { |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | $this->connection = new Curl(); |
| 48 | 48 | $this->connection->setOptions([ |
| 49 | 49 | CURLOPT_URL => $this->getBaseUri(), |
| 50 | - CURLOPT_USERPWD => $this->getUsername() . ':' . $this->getPassword(), |
|
| 50 | + CURLOPT_USERPWD => $this->getUsername().':'.$this->getPassword(), |
|
| 51 | 51 | CURLOPT_SSL_VERIFYPEER => false, |
| 52 | 52 | CURLOPT_SSL_VERIFYHOST => false, |
| 53 | 53 | CURLOPT_FTP_SSL => CURLFTPSSL_TRY, |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | $connection = $this->getConnection(); |
| 123 | 123 | |
| 124 | 124 | $result = $connection->exec([ |
| 125 | - CURLOPT_URL => $this->getBaseUri() . '/' . $path, |
|
| 125 | + CURLOPT_URL => $this->getBaseUri().'/'.$path, |
|
| 126 | 126 | CURLOPT_UPLOAD => 1, |
| 127 | 127 | CURLOPT_INFILE => $resource, |
| 128 | 128 | ]); |
@@ -176,13 +176,13 @@ discard block |
||
| 176 | 176 | { |
| 177 | 177 | $connection = $this->getConnection(); |
| 178 | 178 | |
| 179 | - $response = $this->rawCommand($connection, 'RNFR ' . $path); |
|
| 179 | + $response = $this->rawCommand($connection, 'RNFR '.$path); |
|
| 180 | 180 | list($code) = explode(' ', end($response), 2); |
| 181 | 181 | if ((int) $code !== 350) { |
| 182 | 182 | return false; |
| 183 | 183 | } |
| 184 | 184 | |
| 185 | - $response = $this->rawCommand($connection, 'RNTO ' . $newpath); |
|
| 185 | + $response = $this->rawCommand($connection, 'RNTO '.$newpath); |
|
| 186 | 186 | list($code) = explode(' ', end($response), 2); |
| 187 | 187 | |
| 188 | 188 | return (int) $code === 250; |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | { |
| 219 | 219 | $connection = $this->getConnection(); |
| 220 | 220 | |
| 221 | - $response = $this->rawCommand($connection, 'DELE ' . $path); |
|
| 221 | + $response = $this->rawCommand($connection, 'DELE '.$path); |
|
| 222 | 222 | list($code) = explode(' ', end($response), 2); |
| 223 | 223 | |
| 224 | 224 | return (int) $code === 250; |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | { |
| 236 | 236 | $connection = $this->getConnection(); |
| 237 | 237 | |
| 238 | - $response = $this->rawCommand($connection, 'RMD ' . $dirname); |
|
| 238 | + $response = $this->rawCommand($connection, 'RMD '.$dirname); |
|
| 239 | 239 | list($code) = explode(' ', end($response), 2); |
| 240 | 240 | |
| 241 | 241 | return (int) $code === 250; |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | { |
| 254 | 254 | $connection = $this->getConnection(); |
| 255 | 255 | |
| 256 | - $response = $this->rawCommand($connection, 'MKD ' . $dirname); |
|
| 256 | + $response = $this->rawCommand($connection, 'MKD '.$dirname); |
|
| 257 | 257 | list($code) = explode(' ', end($response), 2); |
| 258 | 258 | if ((int) $code !== 257) { |
| 259 | 259 | return false; |
@@ -324,7 +324,7 @@ discard block |
||
| 324 | 324 | $connection = $this->getConnection(); |
| 325 | 325 | |
| 326 | 326 | $result = $connection->exec([ |
| 327 | - CURLOPT_URL => $this->getBaseUri() . '/' . $path, |
|
| 327 | + CURLOPT_URL => $this->getBaseUri().'/'.$path, |
|
| 328 | 328 | CURLOPT_FILE => $stream, |
| 329 | 329 | ]); |
| 330 | 330 | |
@@ -352,7 +352,7 @@ discard block |
||
| 352 | 352 | return ['type' => 'dir', 'path' => '']; |
| 353 | 353 | } |
| 354 | 354 | |
| 355 | - $request = rtrim('LIST -A ' . $this->normalizePath($path)); |
|
| 355 | + $request = rtrim('LIST -A '.$this->normalizePath($path)); |
|
| 356 | 356 | |
| 357 | 357 | $connection = $this->getConnection(); |
| 358 | 358 | $result = $connection->exec([CURLOPT_CUSTOMREQUEST => $request]); |
@@ -391,7 +391,7 @@ discard block |
||
| 391 | 391 | */ |
| 392 | 392 | public function getTimestamp($path) |
| 393 | 393 | { |
| 394 | - $response = $this->rawCommand($this->getConnection(), 'MDTM ' . $path); |
|
| 394 | + $response = $this->rawCommand($this->getConnection(), 'MDTM '.$path); |
|
| 395 | 395 | list($code, $time) = explode(' ', end($response), 2); |
| 396 | 396 | if ($code !== '213') { |
| 397 | 397 | return false; |
@@ -413,7 +413,7 @@ discard block |
||
| 413 | 413 | return $this->listDirectoryContentsRecursive($directory); |
| 414 | 414 | } |
| 415 | 415 | |
| 416 | - $request = rtrim('LIST -aln ' . $this->normalizePath($directory)); |
|
| 416 | + $request = rtrim('LIST -aln '.$this->normalizePath($directory)); |
|
| 417 | 417 | |
| 418 | 418 | $connection = $this->getConnection(); |
| 419 | 419 | $result = $connection->exec([CURLOPT_CUSTOMREQUEST => $request]); |
@@ -435,7 +435,7 @@ discard block |
||
| 435 | 435 | */ |
| 436 | 436 | protected function listDirectoryContentsRecursive($directory) |
| 437 | 437 | { |
| 438 | - $request = rtrim('LIST -aln ' . $this->normalizePath($directory)); |
|
| 438 | + $request = rtrim('LIST -aln '.$this->normalizePath($directory)); |
|
| 439 | 439 | |
| 440 | 440 | $connection = $this->getConnection(); |
| 441 | 441 | $result = $connection->exec([CURLOPT_CUSTOMREQUEST => $request]); |
@@ -471,7 +471,7 @@ discard block |
||
| 471 | 471 | // split up the permission groups |
| 472 | 472 | $parts = str_split($permissions, 3); |
| 473 | 473 | // convert the groups |
| 474 | - $mapper = function ($part) { |
|
| 474 | + $mapper = function($part) { |
|
| 475 | 475 | return array_sum(str_split($part)); |
| 476 | 476 | }; |
| 477 | 477 | |
@@ -526,7 +526,7 @@ discard block |
||
| 526 | 526 | protected function rawCommand($connection, $command) |
| 527 | 527 | { |
| 528 | 528 | $response = ''; |
| 529 | - $callback = function ($ch, $string) use (&$response) { |
|
| 529 | + $callback = function($ch, $string) use (&$response) { |
|
| 530 | 530 | $response .= $string; |
| 531 | 531 | |
| 532 | 532 | return strlen($string); |
@@ -548,7 +548,7 @@ discard block |
||
| 548 | 548 | { |
| 549 | 549 | $protocol = $this->ssl ? 'ftps' : 'ftp'; |
| 550 | 550 | |
| 551 | - return $protocol . '://' . $this->getHost() . ':' . $this->getPort(); |
|
| 551 | + return $protocol.'://'.$this->getHost().':'.$this->getPort(); |
|
| 552 | 552 | } |
| 553 | 553 | |
| 554 | 554 | /** |
@@ -558,7 +558,7 @@ discard block |
||
| 558 | 558 | { |
| 559 | 559 | // We can't use the getConnection, because it will lead to an infinite cycle |
| 560 | 560 | if ($this->connection->exec() === false) { |
| 561 | - throw new RuntimeException('Could not connect to host: ' . $this->getHost() . ', port:' . $this->getPort()); |
|
| 561 | + throw new RuntimeException('Could not connect to host: '.$this->getHost().', port:'.$this->getPort()); |
|
| 562 | 562 | } |
| 563 | 563 | } |
| 564 | 564 | |
@@ -575,7 +575,7 @@ discard block |
||
| 575 | 575 | list($code, $message) = explode(' ', end($response), 2); |
| 576 | 576 | if ($code !== '200') { |
| 577 | 577 | throw new RuntimeException( |
| 578 | - 'Could not set UTF-8 mode for connection: ' . $this->getHost() . '::' . $this->getPort() |
|
| 578 | + 'Could not set UTF-8 mode for connection: '.$this->getHost().'::'.$this->getPort() |
|
| 579 | 579 | ); |
| 580 | 580 | } |
| 581 | 581 | } |
@@ -591,10 +591,10 @@ discard block |
||
| 591 | 591 | } |
| 592 | 592 | |
| 593 | 593 | // We can't use the getConnection, because it will lead to an infinite cycle |
| 594 | - $response = $this->rawCommand($this->connection, 'CWD ' . $root); |
|
| 594 | + $response = $this->rawCommand($this->connection, 'CWD '.$root); |
|
| 595 | 595 | list($code) = explode(' ', end($response), 2); |
| 596 | 596 | if ((int) $code !== 250) { |
| 597 | - throw new RuntimeException('Root is invalid or does not exist: ' . $this->getRoot()); |
|
| 597 | + throw new RuntimeException('Root is invalid or does not exist: '.$this->getRoot()); |
|
| 598 | 598 | } |
| 599 | 599 | } |
| 600 | 600 | } |