Completed
Push — master ( 6b8906...4dd8f1 )
by Vladimir
10s
created
src/CurlFtpAdapter.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
         $this->connection = new Curl();
37 37
         $this->connection->setOptions([
38 38
             CURLOPT_URL => $this->getBaseUri(),
39
-            CURLOPT_USERPWD => $this->getUsername() . ':' . $this->getPassword(),
39
+            CURLOPT_USERPWD => $this->getUsername().':'.$this->getPassword(),
40 40
             CURLOPT_SSL_VERIFYPEER => false,
41 41
             CURLOPT_SSL_VERIFYHOST => false,
42 42
             CURLOPT_FTPSSLAUTH => CURLFTPAUTH_TLS,
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
         $connection = $this->getConnection();
114 114
 
115 115
         $result = $connection->exec([
116
-            CURLOPT_URL => $this->getBaseUri() . '/' . $path,
116
+            CURLOPT_URL => $this->getBaseUri().'/'.$path,
117 117
             CURLOPT_UPLOAD => 1,
118 118
             CURLOPT_INFILE => $resource,
119 119
         ]);
@@ -167,13 +167,13 @@  discard block
 block discarded – undo
167 167
     {
168 168
         $connection = $this->getConnection();
169 169
 
170
-        $response = $this->rawCommand($connection, 'RNFR ' . $path);
170
+        $response = $this->rawCommand($connection, 'RNFR '.$path);
171 171
         list($code) = explode(' ', end($response), 2);
172 172
         if ((int) $code !== 350) {
173 173
             return false;
174 174
         }
175 175
 
176
-        $response = $this->rawCommand($connection, 'RNTO ' . $newpath);
176
+        $response = $this->rawCommand($connection, 'RNTO '.$newpath);
177 177
         list($code) = explode(' ', end($response), 2);
178 178
 
179 179
         return (int) $code === 250;
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
     {
210 210
         $connection = $this->getConnection();
211 211
 
212
-        $response = $this->rawCommand($connection, 'DELE ' . $path);
212
+        $response = $this->rawCommand($connection, 'DELE '.$path);
213 213
         list($code) = explode(' ', end($response), 2);
214 214
 
215 215
         return (int) $code === 250;
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
     {
227 227
         $connection = $this->getConnection();
228 228
 
229
-        $response = $this->rawCommand($connection, 'RMD ' . $dirname);
229
+        $response = $this->rawCommand($connection, 'RMD '.$dirname);
230 230
         list($code) = explode(' ', end($response), 2);
231 231
 
232 232
         return (int) $code === 250;
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
     {
245 245
         $connection = $this->getConnection();
246 246
 
247
-        $response = $this->rawCommand($connection, 'MKD ' . $dirname);
247
+        $response = $this->rawCommand($connection, 'MKD '.$dirname);
248 248
         list($code) = explode(' ', end($response), 2);
249 249
         if ((int) $code !== 257) {
250 250
             return false;
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
         $connection = $this->getConnection();
316 316
 
317 317
         $result = $connection->exec([
318
-            CURLOPT_URL => $this->getBaseUri() . '/' . $path,
318
+            CURLOPT_URL => $this->getBaseUri().'/'.$path,
319 319
             CURLOPT_FILE => $stream,
320 320
         ]);
321 321
 
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
             return ['type' => 'dir', 'path' => ''];
344 344
         }
345 345
 
346
-        $request = rtrim('LIST -A ' . $this->normalizePath($path));
346
+        $request = rtrim('LIST -A '.$this->normalizePath($path));
347 347
 
348 348
         $connection = $this->getConnection();
349 349
         $result = $connection->exec([CURLOPT_CUSTOMREQUEST => $request]);
@@ -382,7 +382,7 @@  discard block
 block discarded – undo
382 382
      */
383 383
     public function getTimestamp($path)
384 384
     {
385
-        $response = $this->rawCommand($this->getConnection(), 'MDTM ' . $path);
385
+        $response = $this->rawCommand($this->getConnection(), 'MDTM '.$path);
386 386
         list($code, $time) = explode(' ', end($response), 2);
387 387
         if ($code !== '213') {
388 388
             return false;
@@ -404,7 +404,7 @@  discard block
 block discarded – undo
404 404
             return $this->listDirectoryContentsRecursive($directory);
405 405
         }
406 406
 
407
-        $request = rtrim('LIST -aln ' . $this->normalizePath($directory));
407
+        $request = rtrim('LIST -aln '.$this->normalizePath($directory));
408 408
 
409 409
         $connection = $this->getConnection();
410 410
         $result = $connection->exec([CURLOPT_CUSTOMREQUEST => $request]);
@@ -426,7 +426,7 @@  discard block
 block discarded – undo
426 426
      */
427 427
     protected function listDirectoryContentsRecursive($directory)
428 428
     {
429
-        $request = rtrim('LIST -aln ' . $this->normalizePath($directory));
429
+        $request = rtrim('LIST -aln '.$this->normalizePath($directory));
430 430
 
431 431
         $connection = $this->getConnection();
432 432
         $result = $connection->exec([CURLOPT_CUSTOMREQUEST => $request]);
@@ -462,7 +462,7 @@  discard block
 block discarded – undo
462 462
         // split up the permission groups
463 463
         $parts = str_split($permissions, 3);
464 464
         // convert the groups
465
-        $mapper = function ($part) {
465
+        $mapper = function($part) {
466 466
             return array_sum(str_split($part));
467 467
         };
468 468
 
@@ -518,7 +518,7 @@  discard block
 block discarded – undo
518 518
     protected function rawCommand($connection, $command)
519 519
     {
520 520
         $response = '';
521
-        $callback = function ($ch, $string) use (&$response) {
521
+        $callback = function($ch, $string) use (&$response) {
522 522
             $response .= $string;
523 523
 
524 524
             return strlen($string);
@@ -540,7 +540,7 @@  discard block
 block discarded – undo
540 540
     {
541 541
         $protocol = $this->ssl ? 'ftps' : 'ftp';
542 542
 
543
-        return $protocol . '://' . $this->getHost() . ':' . $this->getPort();
543
+        return $protocol.'://'.$this->getHost().':'.$this->getPort();
544 544
     }
545 545
 
546 546
     /**
@@ -550,7 +550,7 @@  discard block
 block discarded – undo
550 550
     {
551 551
         // We can't use the getConnection, because it will lead to an infinite cycle
552 552
         if ($this->connection->exec() === false) {
553
-            throw new RuntimeException('Could not connect to host: ' . $this->getHost() . ', port:' . $this->getPort());
553
+            throw new RuntimeException('Could not connect to host: '.$this->getHost().', port:'.$this->getPort());
554 554
         }
555 555
     }
556 556
 
@@ -565,10 +565,10 @@  discard block
 block discarded – undo
565 565
         }
566 566
 
567 567
         // We can't use the getConnection, because it will lead to an infinite cycle
568
-        $response = $this->rawCommand($this->connection, 'CWD ' . $root);
568
+        $response = $this->rawCommand($this->connection, 'CWD '.$root);
569 569
         list($code) = explode(' ', end($response), 2);
570 570
         if ((int) $code !== 250) {
571
-            throw new RuntimeException('Root is invalid or does not exist: ' . $this->getRoot());
571
+            throw new RuntimeException('Root is invalid or does not exist: '.$this->getRoot());
572 572
         }
573 573
     }
574 574
 }
Please login to merge, or discard this patch.