Code Duplication    Length = 21-21 lines in 2 locations

src/Config.php 2 locations

@@ 719-739 (lines=21) @@
716
                $this->cacheFile = Util\Common::realpath(substr($arg, 6));
717
718
                // It may not exist and return false instead.
719
                if ($this->cacheFile === false) {
720
                    $this->cacheFile = substr($arg, 6);
721
722
                    $dir = dirname($this->cacheFile);
723
                    if (is_dir($dir) === false) {
724
                        echo 'ERROR: The specified cache file path "'.$this->cacheFile.'" points to a non-existent directory'.PHP_EOL.PHP_EOL;
725
                        $this->printUsage();
726
                        exit(2);
727
                    }
728
729
                    if ($dir === '.') {
730
                        // Passed report file is a file in the current directory.
731
                        $this->cacheFile = getcwd().'/'.basename($this->cacheFile);
732
                    } else {
733
                        $dir = Util\Common::realpath(getcwd().'/'.$dir);
734
                        if ($dir !== false) {
735
                            // Report file path is relative.
736
                            $this->cacheFile = $dir.'/'.basename($this->cacheFile);
737
                        }
738
                    }
739
                }//end if
740
741
                $this->overriddenDefaults['cacheFile'] = true;
742
@@ 777-797 (lines=21) @@
774
                $this->reportFile = Util\Common::realpath(substr($arg, 12));
775
776
                // It may not exist and return false instead.
777
                if ($this->reportFile === false) {
778
                    $this->reportFile = substr($arg, 12);
779
780
                    $dir = dirname($this->reportFile);
781
                    if (is_dir($dir) === false) {
782
                        echo 'ERROR: The specified report file path "'.$this->reportFile.'" points to a non-existent directory'.PHP_EOL.PHP_EOL;
783
                        $this->printUsage();
784
                        exit(2);
785
                    }
786
787
                    if ($dir === '.') {
788
                        // Passed report file is a file in the current directory.
789
                        $this->reportFile = getcwd().'/'.basename($this->reportFile);
790
                    } else {
791
                        $dir = Util\Common::realpath(getcwd().'/'.$dir);
792
                        if ($dir !== false) {
793
                            // Report file path is relative.
794
                            $this->reportFile = $dir.'/'.basename($this->reportFile);
795
                        }
796
                    }
797
                }//end if
798
799
                $this->overriddenDefaults['reportFile'] = true;
800