| @@ -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 |      { | 
| @@ -8,7 +8,6 @@ | ||
| 8 | 8 | use League\Flysystem\Config; | 
| 9 | 9 | use League\Flysystem\Util\MimeType; | 
| 10 | 10 | use League\Flysystem\AdapterInterface; | 
| 11 | -use League\Flysystem\NotSupportedException; | |
| 12 | 11 | use League\Flysystem\Adapter\AbstractFtpAdapter; | 
| 13 | 12 | |
| 14 | 13 | class CurlFtpAdapter extends AbstractFtpAdapter | 
| @@ -133,7 +133,7 @@ discard block | ||
| 133 | 133 | $connection = $this->getConnection(); | 
| 134 | 134 | |
| 135 | 135 | $result = $connection->exec([ | 
| 136 | - CURLOPT_URL => $this->getUrl() . '/' . $path, | |
| 136 | + CURLOPT_URL => $this->getUrl().'/'.$path, | |
| 137 | 137 | CURLOPT_UPLOAD => 1, | 
| 138 | 138 | CURLOPT_INFILE => $resource, | 
| 139 | 139 | ]); | 
| @@ -372,7 +372,7 @@ discard block | ||
| 372 | 372 | return false; | 
| 373 | 373 | } | 
| 374 | 374 | |
| 375 | -        $file = array_filter($listing, function ($item) use ($path) { | |
| 375 | +        $file = array_filter($listing, function($item) use ($path) { | |
| 376 | 376 | return Normalizer::normalize($item['path']) === Normalizer::normalize($path); | 
| 377 | 377 | }); | 
| 378 | 378 | |
| @@ -406,7 +406,7 @@ discard block | ||
| 406 | 406 | */ | 
| 407 | 407 | public function getTimestamp($path) | 
| 408 | 408 |      { | 
| 409 | -        $response = $this->rawCommand('MDTM ' . $path); | |
| 409 | +        $response = $this->rawCommand('MDTM '.$path); | |
| 410 | 410 |          list($code, $time) = explode(' ', end($response), 2); | 
| 411 | 411 |          if ($code !== '213') { | 
| 412 | 412 | return false; | 
| @@ -429,7 +429,7 @@ discard block | ||
| 429 | 429 | } | 
| 430 | 430 | |
| 431 | 431 | $options = $recursive ? '-alnR' : '-aln'; | 
| 432 | -        $request = rtrim("LIST $options " . $this->normalizePath($directory)); | |
| 432 | +        $request = rtrim("LIST $options ".$this->normalizePath($directory)); | |
| 433 | 433 | |
| 434 | 434 | $connection = $this->getConnection(); | 
| 435 | 435 | $result = $connection->exec([CURLOPT_CUSTOMREQUEST => $request]); | 
| @@ -513,7 +513,7 @@ discard block | ||
| 513 | 513 | protected function rawCommand($command) | 
| 514 | 514 |      { | 
| 515 | 515 | $response = ''; | 
| 516 | -        $callback = function ($ch, $string) use (&$response) { | |
| 516 | +        $callback = function($ch, $string) use (&$response) { | |
| 517 | 517 | $response .= $string; | 
| 518 | 518 | return strlen($string); | 
| 519 | 519 | }; | 
| @@ -4,106 +4,106 @@ | ||
| 4 | 4 | |
| 5 | 5 | class Curl | 
| 6 | 6 |  { | 
| 7 | - /** | |
| 8 | - * @var resource | |
| 9 | - */ | |
| 10 | - protected $curl; | |
| 7 | + /** | |
| 8 | + * @var resource | |
| 9 | + */ | |
| 10 | + protected $curl; | |
| 11 | 11 | |
| 12 | - /** | |
| 13 | - * @var array | |
| 14 | - */ | |
| 15 | - protected $options; | |
| 12 | + /** | |
| 13 | + * @var array | |
| 14 | + */ | |
| 15 | + protected $options; | |
| 16 | 16 | |
| 17 | - /** | |
| 18 | - * @param array $options Array of the Curl options, where key is a CURLOPT_* constant | |
| 19 | - */ | |
| 20 | - public function __construct($options = []) | |
| 21 | -	{ | |
| 22 | - $this->curl = curl_init(); | |
| 23 | - $this->options = $options; | |
| 24 | - } | |
| 17 | + /** | |
| 18 | + * @param array $options Array of the Curl options, where key is a CURLOPT_* constant | |
| 19 | + */ | |
| 20 | + public function __construct($options = []) | |
| 21 | +    { | |
| 22 | + $this->curl = curl_init(); | |
| 23 | + $this->options = $options; | |
| 24 | + } | |
| 25 | 25 | |
| 26 | - public function __destruct() | |
| 27 | -	{ | |
| 28 | -		if (is_resource($this->curl)) { | |
| 29 | - curl_close($this->curl); | |
| 30 | - } | |
| 31 | - } | |
| 26 | + public function __destruct() | |
| 27 | +    { | |
| 28 | +        if (is_resource($this->curl)) { | |
| 29 | + curl_close($this->curl); | |
| 30 | + } | |
| 31 | + } | |
| 32 | 32 | |
| 33 | - /** | |
| 34 | - * Set the Curl options | |
| 35 | - * | |
| 36 | - * @param array $options Array of the Curl options, where key is a CURLOPT_* constant | |
| 37 | - */ | |
| 38 | - public function setOptions($options) | |
| 39 | -	{ | |
| 40 | -		foreach ($options as $key => $value) { | |
| 41 | - $this->setOption($key, $value); | |
| 42 | - } | |
| 43 | - } | |
| 33 | + /** | |
| 34 | + * Set the Curl options | |
| 35 | + * | |
| 36 | + * @param array $options Array of the Curl options, where key is a CURLOPT_* constant | |
| 37 | + */ | |
| 38 | + public function setOptions($options) | |
| 39 | +    { | |
| 40 | +        foreach ($options as $key => $value) { | |
| 41 | + $this->setOption($key, $value); | |
| 42 | + } | |
| 43 | + } | |
| 44 | 44 | |
| 45 | - /** | |
| 46 | - * Set the Curl option | |
| 47 | - * | |
| 48 | - * @param int $key One of the CURLOPT_* constant | |
| 49 | - * @param mixed $value The value of the CURL option | |
| 50 | - */ | |
| 51 | - public function setOption($key, $value) | |
| 52 | -	{ | |
| 53 | - $this->options[$key] = $value; | |
| 54 | - } | |
| 45 | + /** | |
| 46 | + * Set the Curl option | |
| 47 | + * | |
| 48 | + * @param int $key One of the CURLOPT_* constant | |
| 49 | + * @param mixed $value The value of the CURL option | |
| 50 | + */ | |
| 51 | + public function setOption($key, $value) | |
| 52 | +    { | |
| 53 | + $this->options[$key] = $value; | |
| 54 | + } | |
| 55 | 55 | |
| 56 | - /** | |
| 57 | - * Returns the value of the option | |
| 58 | - * | |
| 59 | - * @param int $key One of the CURLOPT_* constant | |
| 60 | - * @return mixed|null The value of the option set, or NULL, if it does not exist | |
| 61 | - */ | |
| 62 | - public function getOption($key) | |
| 63 | -	{ | |
| 64 | -		if (!$this->hasOption($key)) { | |
| 65 | - return null; | |
| 66 | - } | |
| 67 | - return $this->options[$key]; | |
| 68 | - } | |
| 56 | + /** | |
| 57 | + * Returns the value of the option | |
| 58 | + * | |
| 59 | + * @param int $key One of the CURLOPT_* constant | |
| 60 | + * @return mixed|null The value of the option set, or NULL, if it does not exist | |
| 61 | + */ | |
| 62 | + public function getOption($key) | |
| 63 | +    { | |
| 64 | +        if (!$this->hasOption($key)) { | |
| 65 | + return null; | |
| 66 | + } | |
| 67 | + return $this->options[$key]; | |
| 68 | + } | |
| 69 | 69 | |
| 70 | - /** | |
| 71 | - * Checking if the option is set | |
| 72 | - * | |
| 73 | - * @param int $key One of the CURLOPT_* constant | |
| 74 | - * @return boolean | |
| 75 | - */ | |
| 76 | - public function hasOption($key) | |
| 77 | -	{ | |
| 78 | - return array_key_exists($this->options, $key); | |
| 79 | - } | |
| 70 | + /** | |
| 71 | + * Checking if the option is set | |
| 72 | + * | |
| 73 | + * @param int $key One of the CURLOPT_* constant | |
| 74 | + * @return boolean | |
| 75 | + */ | |
| 76 | + public function hasOption($key) | |
| 77 | +    { | |
| 78 | + return array_key_exists($this->options, $key); | |
| 79 | + } | |
| 80 | 80 | |
| 81 | - /** | |
| 82 | - * Remove the option | |
| 83 | - * | |
| 84 | - * @param int $key One of the CURLOPT_* constant | |
| 85 | - */ | |
| 86 | - public function removeOption($key) | |
| 87 | -	{ | |
| 88 | -		if ($this->hasOption($key)) { | |
| 89 | - unset($this->options[$key]); | |
| 90 | - } | |
| 91 | - } | |
| 81 | + /** | |
| 82 | + * Remove the option | |
| 83 | + * | |
| 84 | + * @param int $key One of the CURLOPT_* constant | |
| 85 | + */ | |
| 86 | + public function removeOption($key) | |
| 87 | +    { | |
| 88 | +        if ($this->hasOption($key)) { | |
| 89 | + unset($this->options[$key]); | |
| 90 | + } | |
| 91 | + } | |
| 92 | 92 | |
| 93 | - /** | |
| 94 | - * Calls curl_exec and returns its result | |
| 95 | - * | |
| 96 | - * @param array $options Array where key is a CURLOPT_* constant | |
| 97 | - * @return mixed Results of curl_exec | |
| 98 | - */ | |
| 99 | - public function exec($options = []) | |
| 100 | -	{ | |
| 101 | - $options = array_replace($this->options, $options); | |
| 93 | + /** | |
| 94 | + * Calls curl_exec and returns its result | |
| 95 | + * | |
| 96 | + * @param array $options Array where key is a CURLOPT_* constant | |
| 97 | + * @return mixed Results of curl_exec | |
| 98 | + */ | |
| 99 | + public function exec($options = []) | |
| 100 | +    { | |
| 101 | + $options = array_replace($this->options, $options); | |
| 102 | 102 | |
| 103 | - curl_setopt_array($this->curl, $options); | |
| 104 | - $result = curl_exec($this->curl); | |
| 105 | - curl_reset($this->curl); | |
| 103 | + curl_setopt_array($this->curl, $options); | |
| 104 | + $result = curl_exec($this->curl); | |
| 105 | + curl_reset($this->curl); | |
| 106 | 106 | |
| 107 | - return $result; | |
| 108 | - } | |
| 107 | + return $result; | |
| 108 | + } | |
| 109 | 109 | } | 
| 110 | 110 | \ No newline at end of file |