alexia\mar\main::__construct PHP 메소드

__construct() 공개 메소드

Main Constructor
public __construct ( ) : void
리턴 void
    public function __construct()
    {
        define('PHP7MAR_DIR', __DIR__);
        define('PHP7MAR_VERSION', '0.2.0');
        spl_autoload_register([$this, 'autoloader'], true, false);
        //Setup command line options/switches.
        $this->options = new options();
        $projectPath = self::getRealPath($this->options->getOption('f'));
        if ($projectPath !== false) {
            $this->projectPath = $projectPath;
        } else {
            die("The project path given could not be found.\n");
        }
        //Initialize the reporter class.(File output)
        $this->reporter = new reporter($this->projectPath, $this->options->getOption('r'));
        $this->tests = new tests($this->options->getOption('t'));
        $phpBinary = $this->options->getOption('php');
        if (!empty($phpBinary)) {
            $this->tests->setPHPBinaryPath($this->options->getOption('php'));
        }
        $start = microtime(true);
        $fileExtensions = is_array($this->options->getOption('x')) ? $this->options->getOption('x') : null;
        $this->scanner = new scanner($this->projectPath, $this->options->getOption('x'));
        $this->reporter->add("Including file extensions: " . implode(",", $this->scanner->getFileExtensions()), 0, 1);
        $this->run();
        $end = microtime(true);
        $runTime = $end - $start;
        $this->reporter->add("Processing took {$runTime} seconds.", 0, 1);
        $this->reporter->addSections();
        echo "Report located at: " . $this->reporter->getReportFilePath() . "\n";
    }