Test Failed
Push — master ( 37e8ab...13f89e )
by Php Easy Api
04:31
created
src/resta/Support/FileSystem.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
         $path = realpath($path) ?: $path;
131 131
         $tempPath = tempnam(dirname($path), basename($path));
132 132
         // Fix permissions of tempPath because `tempnam()` creates it with permissions set to 0600...
133
-        chmod($tempPath, 0777 - umask());
133
+        chmod($tempPath, 0777-umask());
134 134
         file_put_contents($tempPath, $content);
135 135
         rename($tempPath, $path);
136 136
     }
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
         $success = true;
190 190
         foreach ($paths as $path) {
191 191
             try {
192
-                if (! @unlink($path)) {
192
+                if (!@unlink($path)) {
193 193
                     $success = false;
194 194
                 }
195 195
             } catch (ErrorException $e) {
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
      */
233 233
     public function link($target, $link)
234 234
     {
235
-        if (! windows_os()) {
235
+        if (!windows_os()) {
236 236
             return symlink($target, $link);
237 237
         }
238 238
         $mode = $this->isDirectory($target) ? 'J' : 'H';
@@ -393,7 +393,7 @@  discard block
 block discarded – undo
393 393
     public function files($directory, $hidden = false)
394 394
     {
395 395
         return iterator_to_array(
396
-            Finder::create()->files()->ignoreDotFiles(! $hidden)->in($directory)->depth(0)->sortByName(),
396
+            Finder::create()->files()->ignoreDotFiles(!$hidden)->in($directory)->depth(0)->sortByName(),
397 397
             false
398 398
         );
399 399
     }
@@ -408,7 +408,7 @@  discard block
 block discarded – undo
408 408
     public function allFiles($directory, $hidden = false)
409 409
     {
410 410
         return iterator_to_array(
411
-            Finder::create()->files()->ignoreDotFiles(! $hidden)->in($directory)->sortByName(),
411
+            Finder::create()->files()->ignoreDotFiles(!$hidden)->in($directory)->sortByName(),
412 412
             false
413 413
         );
414 414
     }
@@ -455,10 +455,10 @@  discard block
 block discarded – undo
455 455
      */
456 456
     public function moveDirectory($from, $to, $overwrite = false)
457 457
     {
458
-        if ($overwrite && $this->isDirectory($to) && ! $this->deleteDirectory($to)) {
458
+        if ($overwrite && $this->isDirectory($to) && !$this->deleteDirectory($to)) {
459 459
             return false;
460 460
         }
461
-        return @rename($from, $to) === true;
461
+        return @rename($from, $to)===true;
462 462
     }
463 463
 
464 464
     /**
@@ -471,14 +471,14 @@  discard block
 block discarded – undo
471 471
      */
472 472
     public function copyDirectory($directory, $destination, $options = null)
473 473
     {
474
-        if (! $this->isDirectory($directory)) {
474
+        if (!$this->isDirectory($directory)) {
475 475
             return false;
476 476
         }
477 477
         $options = $options ?: FilesystemIterator::SKIP_DOTS;
478 478
         // If the destination directory does not actually exist, we will go ahead and
479 479
         // create it recursively, which just gets the destination prepared to copy
480 480
         // the files over. Once we make the directory we'll proceed the copying.
481
-        if (! $this->isDirectory($destination)) {
481
+        if (!$this->isDirectory($destination)) {
482 482
             $this->makeDirectory($destination, 0777, true);
483 483
         }
484 484
         $items = new FilesystemIterator($directory, $options);
@@ -489,7 +489,7 @@  discard block
 block discarded – undo
489 489
             $target = $destination.'/'.$item->getBasename();
490 490
             if ($item->isDir()) {
491 491
                 $path = $item->getPathname();
492
-                if (! $this->copyDirectory($path, $target, $options)) {
492
+                if (!$this->copyDirectory($path, $target, $options)) {
493 493
                     return false;
494 494
                 }
495 495
             }
@@ -497,7 +497,7 @@  discard block
 block discarded – undo
497 497
             // location and keep looping. If for some reason the copy fails we'll bail out
498 498
             // and return false, so the developer is aware that the copy process failed.
499 499
             else {
500
-                if (! $this->copy($item->getPathname(), $target)) {
500
+                if (!$this->copy($item->getPathname(), $target)) {
501 501
                     return false;
502 502
                 }
503 503
             }
@@ -516,7 +516,7 @@  discard block
 block discarded – undo
516 516
      */
517 517
     public function deleteDirectory($directory, $preserve = false)
518 518
     {
519
-        if (! $this->isDirectory($directory)) {
519
+        if (!$this->isDirectory($directory)) {
520 520
             return false;
521 521
         }
522 522
         $items = new FilesystemIterator($directory);
@@ -524,7 +524,7 @@  discard block
 block discarded – undo
524 524
             // If the item is a directory, we can just recurse into the function and
525 525
             // delete that sub-directory otherwise we'll just delete the file and
526 526
             // keep iterating through each file until the directory is cleaned.
527
-            if ($item->isDir() && ! $item->isLink()) {
527
+            if ($item->isDir() && !$item->isLink()) {
528 528
                 $this->deleteDirectory($item->getPathname());
529 529
             }
530 530
             // If the item is just a file, we can go ahead and delete it since we're
@@ -534,7 +534,7 @@  discard block
 block discarded – undo
534 534
                 $this->delete($item->getPathname());
535 535
             }
536 536
         }
537
-        if (! $preserve) {
537
+        if (!$preserve) {
538 538
             @rmdir($directory);
539 539
         }
540 540
         return true;
@@ -549,7 +549,7 @@  discard block
 block discarded – undo
549 549
     public function deleteDirectories($directory)
550 550
     {
551 551
         $allDirectories = $this->directories($directory);
552
-        if (! empty($allDirectories)) {
552
+        if (!empty($allDirectories)) {
553 553
             foreach ($allDirectories as $directoryName) {
554 554
                 $this->deleteDirectory($directoryName);
555 555
             }
@@ -580,17 +580,17 @@  discard block
 block discarded – undo
580 580
      */
581 581
     public function getAllFilesInDirectory($dir, $recursive = true, $basedir = '', $include_dirs = false)
582 582
     {
583
-        if ($dir == '') {return array();} else {$results = array(); $subresults = array();}
584
-        if (!is_dir($dir)) {$dir = dirname($dir);} // so a files path can be sent
585
-        if ($basedir == '') {$basedir = realpath($dir).DIRECTORY_SEPARATOR;}
583
+        if ($dir=='') {return array(); } else {$results = array(); $subresults = array(); }
584
+        if (!is_dir($dir)) {$dir = dirname($dir); } // so a files path can be sent
585
+        if ($basedir=='') {$basedir = realpath($dir).DIRECTORY_SEPARATOR; }
586 586
 
587 587
         $files = scandir($dir);
588
-        foreach ($files as $key => $value){
589
-            if ( ($value != '.') && ($value != '..') ) {
588
+        foreach ($files as $key => $value) {
589
+            if (($value!='.') && ($value!='..')) {
590 590
                 $path = realpath($dir.DIRECTORY_SEPARATOR.$value);
591 591
                 if (is_dir($path)) {
592 592
                     // optionally include directories in file list
593
-                    if ($include_dirs) {$subresults[] = str_replace($basedir, '', $path);}
593
+                    if ($include_dirs) {$subresults[] = str_replace($basedir, '', $path); }
594 594
                     // optionally get file list for all subdirectories
595 595
                     if ($recursive) {
596 596
                         $subdirresults = $this->getAllFilesInDirectory($path, $recursive, $basedir, $include_dirs);
@@ -603,7 +603,7 @@  discard block
 block discarded – undo
603 603
             }
604 604
         }
605 605
         // merge the subarray to give the list of files then subdirectory files
606
-        if (count($subresults) > 0) {$results = array_merge($subresults, $results);}
606
+        if (count($subresults)>0) {$results = array_merge($subresults, $results); }
607 607
         return $results;
608 608
     }
609 609
 
@@ -625,15 +625,15 @@  discard block
 block discarded – undo
625 625
      * @param $param
626 626
      * @return bool
627 627
      */
628
-    public function change($executionPath,$param)
628
+    public function change($executionPath, $param)
629 629
     {
630 630
         $dt = fopen($executionPath, "r");
631 631
         $content = fread($dt, filesize($executionPath));
632 632
         fclose($dt);
633 633
 
634
-        foreach ($param as $key=>$value){
634
+        foreach ($param as $key=>$value) {
635 635
 
636
-            $content=str_replace("".$key."",$value,$content);
636
+            $content = str_replace("".$key."", $value, $content);
637 637
         }
638 638
 
639 639
         $dt = fopen($executionPath, "w");
Please login to merge, or discard this patch.