Moosh\Command\Generic\Tools\ToolsCodeCheck::execute PHP 메소드

execute() 공개 메소드

public execute ( )
    public function execute()
    {
        require_once $this->mooshDir . "/includes/codesniffer_cli.php";
        require_once $this->mooshDir . "/includes/coderepair/CodeRepair.php";
        $moodle_sniffs = $this->mooshDir . "/vendor/moodlerooms/moodle-coding-standard/moodle";
        $options = $this->expandedOptions;
        $interactive = $options['interactive'];
        if (isset($options['path'])) {
            $this->checkDirArg($options['path']);
            $path = $options['path'];
        } else {
            $path = $this->cwd;
        }
        $files = $this->_get_files($path);
        if ($options['repair'] === true) {
            $code_repair = new \CodeRepair($files);
            $code_repair->drymode = false;
            $code_repair->start();
        }
        $phpcscli = new \codesniffer_cli();
        $phpcs = new \PHP_CodeSniffer(1, 0, 'utf-8', (bool) $interactive);
        $phpcs->setCli($phpcscli);
        $phpcs->process($files, $moodle_sniffs);
        $phpcs->reporting->printReport('full', false, $phpcscli->getCommandLineValues(), null);
    }