@@ -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 | { |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | $this->connection = new Curl(); |
52 | 52 | $this->connection->setOptions([ |
53 | 53 | CURLOPT_URL => $this->getUrl(), |
54 | - CURLOPT_USERPWD => $this->getUsername() . ':' . $this->getPassword(), |
|
54 | + CURLOPT_USERPWD => $this->getUsername().':'.$this->getPassword(), |
|
55 | 55 | CURLOPT_SSL_VERIFYPEER => false, |
56 | 56 | CURLOPT_SSL_VERIFYHOST => false, |
57 | 57 | CURLOPT_FTP_SSL => CURLFTPSSL_TRY, |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | $connection = $this->getConnection(); |
126 | 126 | |
127 | 127 | $result = $connection->exec([ |
128 | - CURLOPT_URL => $this->getUrl() . '/' . $path, |
|
128 | + CURLOPT_URL => $this->getUrl().'/'.$path, |
|
129 | 129 | CURLOPT_UPLOAD => 1, |
130 | 130 | CURLOPT_INFILE => $resource, |
131 | 131 | ]); |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | $connection = $this->getConnection(); |
181 | 181 | |
182 | 182 | $result = $connection->exec([ |
183 | - CURLOPT_POSTQUOTE => ['RNFR ' . $path, 'RNTO ' . $newpath], |
|
183 | + CURLOPT_POSTQUOTE => ['RNFR '.$path, 'RNTO '.$newpath], |
|
184 | 184 | ]); |
185 | 185 | |
186 | 186 | return $result !== false; |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | $connection = $this->getConnection(); |
218 | 218 | |
219 | 219 | $result = $connection->exec([ |
220 | - CURLOPT_POSTQUOTE => ['DELE ' . $path], |
|
220 | + CURLOPT_POSTQUOTE => ['DELE '.$path], |
|
221 | 221 | ]); |
222 | 222 | |
223 | 223 | return $result !== false; |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | $connection = $this->getConnection(); |
236 | 236 | |
237 | 237 | $result = $connection->exec([ |
238 | - CURLOPT_POSTQUOTE => ['RMD ' . $dirname], |
|
238 | + CURLOPT_POSTQUOTE => ['RMD '.$dirname], |
|
239 | 239 | ]); |
240 | 240 | |
241 | 241 | return $result !== false; |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | $connection = $this->getConnection(); |
255 | 255 | |
256 | 256 | $result = $connection->exec([ |
257 | - CURLOPT_POSTQUOTE => ['MKD ' . $dirname], |
|
257 | + CURLOPT_POSTQUOTE => ['MKD '.$dirname], |
|
258 | 258 | ]); |
259 | 259 | |
260 | 260 | if ($result === false) { |
@@ -324,7 +324,7 @@ discard block |
||
324 | 324 | $connection = $this->getConnection(); |
325 | 325 | |
326 | 326 | $result = $connection->exec([ |
327 | - CURLOPT_URL => $this->getUrl() . '/' . $path, |
|
327 | + CURLOPT_URL => $this->getUrl().'/'.$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]); |
@@ -472,7 +472,7 @@ discard block |
||
472 | 472 | // split up the permission groups |
473 | 473 | $parts = str_split($permissions, 3); |
474 | 474 | // convert the groups |
475 | - $mapper = function ($part) { |
|
475 | + $mapper = function($part) { |
|
476 | 476 | return array_sum(str_split($part)); |
477 | 477 | }; |
478 | 478 | |
@@ -528,7 +528,7 @@ discard block |
||
528 | 528 | protected function rawCommand($connection, $command) |
529 | 529 | { |
530 | 530 | $response = ''; |
531 | - $callback = function ($ch, $string) use (&$response) { |
|
531 | + $callback = function($ch, $string) use (&$response) { |
|
532 | 532 | $response .= $string; |
533 | 533 | |
534 | 534 | return strlen($string); |
@@ -552,10 +552,10 @@ discard block |
||
552 | 552 | } |
553 | 553 | |
554 | 554 | // We can't use the getConnection, because it will lead to an infinite cycle |
555 | - $response = $this->rawCommand($this->connection, 'CWD ' . $root); |
|
555 | + $response = $this->rawCommand($this->connection, 'CWD '.$root); |
|
556 | 556 | list($code, $message) = explode(' ', end($response), 2); |
557 | 557 | if ($code !== '250') { |
558 | - throw new RuntimeException('Root is invalid or does not exist: ' . $this->getRoot()); |
|
558 | + throw new RuntimeException('Root is invalid or does not exist: '.$this->getRoot()); |
|
559 | 559 | } |
560 | 560 | } |
561 | 561 | |
@@ -566,12 +566,12 @@ discard block |
||
566 | 566 | { |
567 | 567 | // We can't use the getConnection, because it will lead to an infinite cycle |
568 | 568 | if ($this->connection->exec() === false) { |
569 | - throw new RuntimeException('Could not connect to host: ' . $this->getHost() . ', port:' . $this->getPort()); |
|
569 | + throw new RuntimeException('Could not connect to host: '.$this->getHost().', port:'.$this->getPort()); |
|
570 | 570 | } |
571 | 571 | } |
572 | 572 | |
573 | 573 | protected function getUrl() |
574 | 574 | { |
575 | - return $this->protocol . '://' . $this->getHost() . ':' . $this->getPort(); |
|
575 | + return $this->protocol.'://'.$this->getHost().':'.$this->getPort(); |
|
576 | 576 | } |
577 | 577 | } |