Completed
Push — master ( 36861d...250896 )
by Vladimir
04:55 queued 03:00
created
src/CurlFtpAdapter.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
     {
Please login to merge, or discard this patch.
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
         $this->connection = new Curl();
49 49
         $this->connection->setOptions([
50 50
             CURLOPT_URL => $this->getBaseUri(),
51
-            CURLOPT_USERPWD => $this->getUsername() . ':' . $this->getPassword(),
51
+            CURLOPT_USERPWD => $this->getUsername().':'.$this->getPassword(),
52 52
             CURLOPT_SSL_VERIFYPEER => false,
53 53
             CURLOPT_SSL_VERIFYHOST => false,
54 54
             CURLOPT_FTPSSLAUTH => CURLFTPAUTH_TLS,
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
         $connection = $this->getConnection();
128 128
 
129 129
         $result = $connection->exec([
130
-            CURLOPT_URL => $this->getBaseUri() . '/' . $path,
130
+            CURLOPT_URL => $this->getBaseUri().'/'.$path,
131 131
             CURLOPT_UPLOAD => 1,
132 132
             CURLOPT_INFILE => $resource,
133 133
         ]);
@@ -181,13 +181,13 @@  discard block
 block discarded – undo
181 181
     {
182 182
         $connection = $this->getConnection();
183 183
 
184
-        $response = $this->rawCommand($connection, 'RNFR ' . $path);
184
+        $response = $this->rawCommand($connection, 'RNFR '.$path);
185 185
         list($code) = explode(' ', end($response), 2);
186 186
         if ((int) $code !== 350) {
187 187
             return false;
188 188
         }
189 189
 
190
-        $response = $this->rawCommand($connection, 'RNTO ' . $newpath);
190
+        $response = $this->rawCommand($connection, 'RNTO '.$newpath);
191 191
         list($code) = explode(' ', end($response), 2);
192 192
 
193 193
         return (int) $code === 250;
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
     {
224 224
         $connection = $this->getConnection();
225 225
 
226
-        $response = $this->rawCommand($connection, 'DELE ' . $path);
226
+        $response = $this->rawCommand($connection, 'DELE '.$path);
227 227
         list($code) = explode(' ', end($response), 2);
228 228
 
229 229
         return (int) $code === 250;
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
     {
241 241
         $connection = $this->getConnection();
242 242
 
243
-        $response = $this->rawCommand($connection, 'RMD ' . $dirname);
243
+        $response = $this->rawCommand($connection, 'RMD '.$dirname);
244 244
         list($code) = explode(' ', end($response), 2);
245 245
 
246 246
         return (int) $code === 250;
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
     {
259 259
         $connection = $this->getConnection();
260 260
 
261
-        $response = $this->rawCommand($connection, 'MKD ' . $dirname);
261
+        $response = $this->rawCommand($connection, 'MKD '.$dirname);
262 262
         list($code) = explode(' ', end($response), 2);
263 263
         if ((int) $code !== 257) {
264 264
             return false;
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
         $connection = $this->getConnection();
330 330
 
331 331
         $result = $connection->exec([
332
-            CURLOPT_URL => $this->getBaseUri() . '/' . $path,
332
+            CURLOPT_URL => $this->getBaseUri().'/'.$path,
333 333
             CURLOPT_FILE => $stream,
334 334
         ]);
335 335
 
@@ -357,7 +357,7 @@  discard block
 block discarded – undo
357 357
             return ['type' => 'dir', 'path' => ''];
358 358
         }
359 359
 
360
-        $request = rtrim('LIST -A ' . $this->normalizePath($path));
360
+        $request = rtrim('LIST -A '.$this->normalizePath($path));
361 361
 
362 362
         $connection = $this->getConnection();
363 363
         $result = $connection->exec([CURLOPT_CUSTOMREQUEST => $request]);
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
      */
397 397
     public function getTimestamp($path)
398 398
     {
399
-        $response = $this->rawCommand($this->getConnection(), 'MDTM ' . $path);
399
+        $response = $this->rawCommand($this->getConnection(), 'MDTM '.$path);
400 400
         list($code, $time) = explode(' ', end($response), 2);
401 401
         if ($code !== '213') {
402 402
             return false;
@@ -418,7 +418,7 @@  discard block
 block discarded – undo
418 418
             return $this->listDirectoryContentsRecursive($directory);
419 419
         }
420 420
 
421
-        $request = rtrim('LIST -aln ' . $this->normalizePath($directory));
421
+        $request = rtrim('LIST -aln '.$this->normalizePath($directory));
422 422
 
423 423
         $connection = $this->getConnection();
424 424
         $result = $connection->exec([CURLOPT_CUSTOMREQUEST => $request]);
@@ -440,7 +440,7 @@  discard block
 block discarded – undo
440 440
      */
441 441
     protected function listDirectoryContentsRecursive($directory)
442 442
     {
443
-        $request = rtrim('LIST -aln ' . $this->normalizePath($directory));
443
+        $request = rtrim('LIST -aln '.$this->normalizePath($directory));
444 444
 
445 445
         $connection = $this->getConnection();
446 446
         $result = $connection->exec([CURLOPT_CUSTOMREQUEST => $request]);
@@ -476,7 +476,7 @@  discard block
 block discarded – undo
476 476
         // split up the permission groups
477 477
         $parts = str_split($permissions, 3);
478 478
         // convert the groups
479
-        $mapper = function ($part) {
479
+        $mapper = function($part) {
480 480
             return array_sum(str_split($part));
481 481
         };
482 482
 
@@ -531,7 +531,7 @@  discard block
 block discarded – undo
531 531
     protected function rawCommand($connection, $command)
532 532
     {
533 533
         $response = '';
534
-        $callback = function ($ch, $string) use (&$response) {
534
+        $callback = function($ch, $string) use (&$response) {
535 535
             $response .= $string;
536 536
 
537 537
             return strlen($string);
@@ -553,7 +553,7 @@  discard block
 block discarded – undo
553 553
     {
554 554
         $protocol = $this->ssl ? 'ftps' : 'ftp';
555 555
 
556
-        return $protocol . '://' . $this->getHost() . ':' . $this->getPort();
556
+        return $protocol.'://'.$this->getHost().':'.$this->getPort();
557 557
     }
558 558
 
559 559
     /**
@@ -563,7 +563,7 @@  discard block
 block discarded – undo
563 563
     {
564 564
         // We can't use the getConnection, because it will lead to an infinite cycle
565 565
         if ($this->connection->exec() === false) {
566
-            throw new RuntimeException('Could not connect to host: ' . $this->getHost() . ', port:' . $this->getPort());
566
+            throw new RuntimeException('Could not connect to host: '.$this->getHost().', port:'.$this->getPort());
567 567
         }
568 568
     }
569 569
 
@@ -580,7 +580,7 @@  discard block
 block discarded – undo
580 580
         list($code, $message) = explode(' ', end($response), 2);
581 581
         if ($code !== '200') {
582 582
             throw new RuntimeException(
583
-                'Could not set UTF-8 mode for connection: ' . $this->getHost() . '::' . $this->getPort()
583
+                'Could not set UTF-8 mode for connection: '.$this->getHost().'::'.$this->getPort()
584 584
             );
585 585
         }
586 586
     }
@@ -596,10 +596,10 @@  discard block
 block discarded – undo
596 596
         }
597 597
 
598 598
         // We can't use the getConnection, because it will lead to an infinite cycle
599
-        $response = $this->rawCommand($this->connection, 'CWD ' . $root);
599
+        $response = $this->rawCommand($this->connection, 'CWD '.$root);
600 600
         list($code) = explode(' ', end($response), 2);
601 601
         if ((int) $code !== 250) {
602
-            throw new RuntimeException('Root is invalid or does not exist: ' . $this->getRoot());
602
+            throw new RuntimeException('Root is invalid or does not exist: '.$this->getRoot());
603 603
         }
604 604
     }
605 605
 }
Please login to merge, or discard this patch.