Completed
Push — master ( 64e671...de3cb6 )
by Vladimir
02:03
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_FTP_SSL => CURLFTPSSL_TRY,
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
         $connection = $this->getConnection();
111 111
 
112 112
         $result = $connection->exec([
113
-            CURLOPT_URL => $this->getBaseUri() . '/' . $path,
113
+            CURLOPT_URL => $this->getBaseUri().'/'.$path,
114 114
             CURLOPT_UPLOAD => 1,
115 115
             CURLOPT_INFILE => $resource,
116 116
         ]);
@@ -164,13 +164,13 @@  discard block
 block discarded – undo
164 164
     {
165 165
         $connection = $this->getConnection();
166 166
 
167
-        $response = $this->rawCommand($connection, 'RNFR ' . $path);
167
+        $response = $this->rawCommand($connection, 'RNFR '.$path);
168 168
         list($code, $message) = explode(' ', end($response), 2);
169 169
         if ($code !== '350') {
170 170
             return false;
171 171
         }
172 172
 
173
-        $response = $this->rawCommand($connection, 'RNTO ' . $newpath);
173
+        $response = $this->rawCommand($connection, 'RNTO '.$newpath);
174 174
         list($code, $message) = explode(' ', end($response), 2);
175 175
         if ($code !== '250') {
176 176
             return false;
@@ -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, $message) = explode(' ', end($response), 2);
214 214
         if ($code !== '250') {
215 215
             return false;
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
     {
230 230
         $connection = $this->getConnection();
231 231
 
232
-        $response = $this->rawCommand($connection, 'RMD ' . $dirname);
232
+        $response = $this->rawCommand($connection, 'RMD '.$dirname);
233 233
         list($code, $message) = explode(' ', end($response), 2);
234 234
         if ($code !== '250') {
235 235
             return false;
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
     {
251 251
         $connection = $this->getConnection();
252 252
 
253
-        $response = $this->rawCommand($connection, 'MKD ' . $dirname);
253
+        $response = $this->rawCommand($connection, 'MKD '.$dirname);
254 254
         list($code, $message) = explode(' ', end($response), 2);
255 255
         if ($code !== '257') {
256 256
             return false;
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
         $connection = $this->getConnection();
322 322
 
323 323
         $result = $connection->exec([
324
-            CURLOPT_URL => $this->getBaseUri() . '/' . $path,
324
+            CURLOPT_URL => $this->getBaseUri().'/'.$path,
325 325
             CURLOPT_FILE => $stream,
326 326
         ]);
327 327
 
@@ -349,7 +349,7 @@  discard block
 block discarded – undo
349 349
             return ['type' => 'dir', 'path' => ''];
350 350
         }
351 351
 
352
-        $request = rtrim('LIST -A ' . $this->normalizePath($path));
352
+        $request = rtrim('LIST -A '.$this->normalizePath($path));
353 353
 
354 354
         $connection = $this->getConnection();
355 355
         $result = $connection->exec([CURLOPT_CUSTOMREQUEST => $request]);
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
      */
389 389
     public function getTimestamp($path)
390 390
     {
391
-        $response = $this->rawCommand($this->getConnection(), 'MDTM ' . $path);
391
+        $response = $this->rawCommand($this->getConnection(), 'MDTM '.$path);
392 392
         list($code, $time) = explode(' ', end($response), 2);
393 393
         if ($code !== '213') {
394 394
             return false;
@@ -410,7 +410,7 @@  discard block
 block discarded – undo
410 410
             return $this->listDirectoryContentsRecursive($directory);
411 411
         }
412 412
 
413
-        $request = rtrim('LIST -aln ' . $this->normalizePath($directory));
413
+        $request = rtrim('LIST -aln '.$this->normalizePath($directory));
414 414
 
415 415
         $connection = $this->getConnection();
416 416
         $result = $connection->exec([CURLOPT_CUSTOMREQUEST => $request]);
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
      */
433 433
     protected function listDirectoryContentsRecursive($directory)
434 434
     {
435
-        $request = rtrim('LIST -aln ' . $this->normalizePath($directory));
435
+        $request = rtrim('LIST -aln '.$this->normalizePath($directory));
436 436
 
437 437
         $connection = $this->getConnection();
438 438
         $result = $connection->exec([CURLOPT_CUSTOMREQUEST => $request]);
@@ -469,7 +469,7 @@  discard block
 block discarded – undo
469 469
         // split up the permission groups
470 470
         $parts = str_split($permissions, 3);
471 471
         // convert the groups
472
-        $mapper = function ($part) {
472
+        $mapper = function($part) {
473 473
             return array_sum(str_split($part));
474 474
         };
475 475
 
@@ -525,7 +525,7 @@  discard block
 block discarded – undo
525 525
     protected function rawCommand($connection, $command)
526 526
     {
527 527
         $response = '';
528
-        $callback = function ($ch, $string) use (&$response) {
528
+        $callback = function($ch, $string) use (&$response) {
529 529
             $response .= $string;
530 530
 
531 531
             return strlen($string);
@@ -547,7 +547,7 @@  discard block
 block discarded – undo
547 547
     {
548 548
         $protocol = $this->ssl ? 'ftps' : 'ftp';
549 549
 
550
-        return $protocol . '://' . $this->getHost() . ':' . $this->getPort();
550
+        return $protocol.'://'.$this->getHost().':'.$this->getPort();
551 551
     }
552 552
 
553 553
     /**
@@ -557,7 +557,7 @@  discard block
 block discarded – undo
557 557
     {
558 558
         // We can't use the getConnection, because it will lead to an infinite cycle
559 559
         if ($this->connection->exec() === false) {
560
-            throw new RuntimeException('Could not connect to host: ' . $this->getHost() . ', port:' . $this->getPort());
560
+            throw new RuntimeException('Could not connect to host: '.$this->getHost().', port:'.$this->getPort());
561 561
         }
562 562
     }
563 563
 
@@ -572,10 +572,10 @@  discard block
 block discarded – undo
572 572
         }
573 573
 
574 574
         // We can't use the getConnection, because it will lead to an infinite cycle
575
-        $response = $this->rawCommand($this->connection, 'CWD ' . $root);
575
+        $response = $this->rawCommand($this->connection, 'CWD '.$root);
576 576
         list($code, $message) = explode(' ', end($response), 2);
577 577
         if ($code !== '250') {
578
-            throw new RuntimeException('Root is invalid or does not exist: ' . $this->getRoot());
578
+            throw new RuntimeException('Root is invalid or does not exist: '.$this->getRoot());
579 579
         }
580 580
     }
581 581
 }
Please login to merge, or discard this patch.