Completed
Pull Request — master (#607)
by Romain
01:50
created
src/Gaufrette/Adapter/Ftp.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -121,13 +121,13 @@  discard block
 block discarded – undo
121 121
         $this->ensureDirectoryExists($this->directory, $this->create);
122 122
 
123 123
         $file = $this->computePath($key);
124
-        $lines = ftp_rawlist($this->getConnection(), '-al ' . \Gaufrette\Util\Path::dirname($file));
124
+        $lines = ftp_rawlist($this->getConnection(), '-al '.\Gaufrette\Util\Path::dirname($file));
125 125
 
126 126
         if (false === $lines) {
127 127
             return false;
128 128
         }
129 129
 
130
-        $pattern = '{(?<!->) ' . preg_quote(basename($file)) . '( -> |$)}m';
130
+        $pattern = '{(?<!->) '.preg_quote(basename($file)).'( -> |$)}m';
131 131
         foreach ($lines as $line) {
132 132
             if (preg_match($pattern, $line)) {
133 133
                 return true;
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
         $directory = preg_replace('/^[\/]*([^\/].*)$/', '/$1', $directory);
235 235
 
236 236
         $items = $this->parseRawlist(
237
-            ftp_rawlist($this->getConnection(), '-al ' . $this->directory . $directory) ?: []
237
+            ftp_rawlist($this->getConnection(), '-al '.$this->directory.$directory) ?: []
238 238
         );
239 239
 
240 240
         $fileData = $dirs = [];
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
 
246 246
             $item = [
247 247
                 'name' => $itemData['name'],
248
-                'path' => trim(($directory ? $directory . '/' : '') . $itemData['name'], '/'),
248
+                'path' => trim(($directory ? $directory.'/' : '').$itemData['name'], '/'),
249 249
                 'time' => $itemData['time'],
250 250
                 'size' => $itemData['size'],
251 251
             ];
@@ -358,8 +358,8 @@  discard block
 block discarded – undo
358 358
     private function createConnectionUrl()
359 359
     {
360 360
         $url = $this->ssl ? 'sftp://' : 'ftp://';
361
-        $url .= $this->username . ':' . $this->password . '@' . $this->host;
362
-        $url .= $this->port ? ':' . $this->port : '';
361
+        $url .= $this->username.':'.$this->password.'@'.$this->host;
362
+        $url .= $this->port ? ':'.$this->port : '';
363 363
 
364 364
         return $url;
365 365
     }
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
 
395 395
             // Build the FTP URL that will be used to check if the path is a directory or not
396 396
             $url = $this->createConnectionUrl();
397
-            return @is_dir($url . $directory);
397
+            return @is_dir($url.$directory);
398 398
         }
399 399
     }
400 400
 
@@ -402,13 +402,13 @@  discard block
 block discarded – undo
402 402
     {
403 403
         $directory = preg_replace('/^[\/]*([^\/].*)$/', '/$1', $directory);
404 404
 
405
-        $lines = ftp_rawlist($this->getConnection(), '-alR ' . $this->directory . $directory);
405
+        $lines = ftp_rawlist($this->getConnection(), '-alR '.$this->directory.$directory);
406 406
 
407 407
         if (false === $lines) {
408 408
             return ['keys' => [], 'dirs' => []];
409 409
         }
410 410
 
411
-        $regexDir = '/' . preg_quote($this->directory . $directory, '/') . '\/?(.+):$/u';
411
+        $regexDir = '/'.preg_quote($this->directory.$directory, '/').'\/?(.+):$/u';
412 412
         $regexItem = '/^(?:([d\-\d])\S+)\s+\S+(?:(?:\s+\S+){5})?\s+(\S+)\s+(.+?)$/';
413 413
 
414 414
         $prevLine = null;
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
                     continue;
433 433
                 }
434 434
 
435
-                $path = ltrim($directory . '/' . $name, '/');
435
+                $path = ltrim($directory.'/'.$name, '/');
436 436
 
437 437
                 if ('d' === $tokens[1] || '<dir>' === $tokens[2]) {
438 438
                     $keys['dirs'][] = $path;
@@ -472,13 +472,13 @@  discard block
 block discarded – undo
472 472
             $infos = preg_split("/[\s]+/", $line, 9);
473 473
 
474 474
             if ($this->isLinuxListing($infos)) {
475
-                $infos[7] = (strrpos($infos[7], ':') != 2) ? ($infos[7] . ' 00:00') : (date('Y') . ' ' . $infos[7]);
475
+                $infos[7] = (strrpos($infos[7], ':') != 2) ? ($infos[7].' 00:00') : (date('Y').' '.$infos[7]);
476 476
                 if ('total' !== $infos[0]) {
477 477
                     $parsed[] = [
478 478
                         'perms' => $infos[0],
479 479
                         'num' => $infos[1],
480 480
                         'size' => $infos[4],
481
-                        'time' => strtotime($infos[5] . ' ' . $infos[6] . '. ' . $infos[7]),
481
+                        'time' => strtotime($infos[5].' '.$infos[6].'. '.$infos[7]),
482 482
                         'name' => $infos[8],
483 483
                     ];
484 484
                 }
@@ -488,7 +488,7 @@  discard block
 block discarded – undo
488 488
                     'perms' => $isDir ? 'd' : '-',
489 489
                     'num' => '',
490 490
                     'size' => $isDir ? '' : $infos[2],
491
-                    'time' => strtotime($infos[0] . ' ' . $infos[1]),
491
+                    'time' => strtotime($infos[0].' '.$infos[1]),
492 492
                     'name' => $infos[3],
493 493
                 ];
494 494
             }
@@ -504,7 +504,7 @@  discard block
 block discarded – undo
504 504
      */
505 505
     private function computePath($key)
506 506
     {
507
-        return rtrim($this->directory, '/') . '/' . $key;
507
+        return rtrim($this->directory, '/').'/'.$key;
508 508
     }
509 509
 
510 510
     /**
Please login to merge, or discard this patch.