Completed
Push — master ( 8ca833...6b8906 )
by Vladimir
01:55
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) = explode(' ', end($response), 2);
169 169
         if ((int) $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) = explode(' ', end($response), 2);
175 175
 
176 176
         return (int) $code === 250;
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
     {
207 207
         $connection = $this->getConnection();
208 208
 
209
-        $response = $this->rawCommand($connection, 'DELE ' . $path);
209
+        $response = $this->rawCommand($connection, 'DELE '.$path);
210 210
         list($code) = explode(' ', end($response), 2);
211 211
 
212 212
         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, 'RMD ' . $dirname);
226
+        $response = $this->rawCommand($connection, 'RMD '.$dirname);
227 227
         list($code) = explode(' ', end($response), 2);
228 228
 
229 229
         return (int) $code === 250;
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
     {
242 242
         $connection = $this->getConnection();
243 243
 
244
-        $response = $this->rawCommand($connection, 'MKD ' . $dirname);
244
+        $response = $this->rawCommand($connection, 'MKD '.$dirname);
245 245
         list($code) = explode(' ', end($response), 2);
246 246
         if ((int) $code !== 257) {
247 247
             return false;
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
         $connection = $this->getConnection();
313 313
 
314 314
         $result = $connection->exec([
315
-            CURLOPT_URL => $this->getBaseUri() . '/' . $path,
315
+            CURLOPT_URL => $this->getBaseUri().'/'.$path,
316 316
             CURLOPT_FILE => $stream,
317 317
         ]);
318 318
 
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
             return ['type' => 'dir', 'path' => ''];
341 341
         }
342 342
 
343
-        $request = rtrim('LIST -A ' . $this->normalizePath($path));
343
+        $request = rtrim('LIST -A '.$this->normalizePath($path));
344 344
 
345 345
         $connection = $this->getConnection();
346 346
         $result = $connection->exec([CURLOPT_CUSTOMREQUEST => $request]);
@@ -379,7 +379,7 @@  discard block
 block discarded – undo
379 379
      */
380 380
     public function getTimestamp($path)
381 381
     {
382
-        $response = $this->rawCommand($this->getConnection(), 'MDTM ' . $path);
382
+        $response = $this->rawCommand($this->getConnection(), 'MDTM '.$path);
383 383
         list($code, $time) = explode(' ', end($response), 2);
384 384
         if ($code !== '213') {
385 385
             return false;
@@ -401,7 +401,7 @@  discard block
 block discarded – undo
401 401
             return $this->listDirectoryContentsRecursive($directory);
402 402
         }
403 403
 
404
-        $request = rtrim('LIST -aln ' . $this->normalizePath($directory));
404
+        $request = rtrim('LIST -aln '.$this->normalizePath($directory));
405 405
 
406 406
         $connection = $this->getConnection();
407 407
         $result = $connection->exec([CURLOPT_CUSTOMREQUEST => $request]);
@@ -423,7 +423,7 @@  discard block
 block discarded – undo
423 423
      */
424 424
     protected function listDirectoryContentsRecursive($directory)
425 425
     {
426
-        $request = rtrim('LIST -aln ' . $this->normalizePath($directory));
426
+        $request = rtrim('LIST -aln '.$this->normalizePath($directory));
427 427
 
428 428
         $connection = $this->getConnection();
429 429
         $result = $connection->exec([CURLOPT_CUSTOMREQUEST => $request]);
@@ -459,7 +459,7 @@  discard block
 block discarded – undo
459 459
         // split up the permission groups
460 460
         $parts = str_split($permissions, 3);
461 461
         // convert the groups
462
-        $mapper = function ($part) {
462
+        $mapper = function($part) {
463 463
             return array_sum(str_split($part));
464 464
         };
465 465
 
@@ -515,7 +515,7 @@  discard block
 block discarded – undo
515 515
     protected function rawCommand($connection, $command)
516 516
     {
517 517
         $response = '';
518
-        $callback = function ($ch, $string) use (&$response) {
518
+        $callback = function($ch, $string) use (&$response) {
519 519
             $response .= $string;
520 520
 
521 521
             return strlen($string);
@@ -537,7 +537,7 @@  discard block
 block discarded – undo
537 537
     {
538 538
         $protocol = $this->ssl ? 'ftps' : 'ftp';
539 539
 
540
-        return $protocol . '://' . $this->getHost() . ':' . $this->getPort();
540
+        return $protocol.'://'.$this->getHost().':'.$this->getPort();
541 541
     }
542 542
 
543 543
     /**
@@ -547,7 +547,7 @@  discard block
 block discarded – undo
547 547
     {
548 548
         // We can't use the getConnection, because it will lead to an infinite cycle
549 549
         if ($this->connection->exec() === false) {
550
-            throw new RuntimeException('Could not connect to host: ' . $this->getHost() . ', port:' . $this->getPort());
550
+            throw new RuntimeException('Could not connect to host: '.$this->getHost().', port:'.$this->getPort());
551 551
         }
552 552
     }
553 553
 
@@ -562,10 +562,10 @@  discard block
 block discarded – undo
562 562
         }
563 563
 
564 564
         // We can't use the getConnection, because it will lead to an infinite cycle
565
-        $response = $this->rawCommand($this->connection, 'CWD ' . $root);
565
+        $response = $this->rawCommand($this->connection, 'CWD '.$root);
566 566
         list($code) = explode(' ', end($response), 2);
567 567
         if ((int) $code !== 250) {
568
-            throw new RuntimeException('Root is invalid or does not exist: ' . $this->getRoot());
568
+            throw new RuntimeException('Root is invalid or does not exist: '.$this->getRoot());
569 569
         }
570 570
     }
571 571
 }
Please login to merge, or discard this patch.