PHP_CodeSniffer::_processFile PHP Method

_processFile() private method

Does raw processing only. No interactive support or error checking.
See also: processFile()
private _processFile ( string $file, string $contents ) : PHP_CodeSniffer_File
$file string The file to process.
$contents string The contents to parse. If NULL, the content is taken from the file system.
return PHP_CodeSniffer_File
    private function _processFile($file, $contents)
    {
        $stdin = false;
        $cliValues = $this->cli->getCommandLineValues();
        if (empty($cliValues['files']) === true) {
            $stdin = true;
        }
        if (PHP_CODESNIFFER_VERBOSITY > 0 || PHP_CODESNIFFER_CBF === true && $stdin === false) {
            $startTime = microtime(true);
            echo 'Processing ' . basename($file) . ' ';
            if (PHP_CODESNIFFER_VERBOSITY > 1) {
                echo PHP_EOL;
            }
        }
        $phpcsFile = new PHP_CodeSniffer_File($file, $this->_tokenListeners, $this->ruleset, $this);
        $phpcsFile->start($contents);
        if (PHP_CODESNIFFER_VERBOSITY > 0 || PHP_CODESNIFFER_CBF === true && $stdin === false) {
            $timeTaken = (microtime(true) - $startTime) * 1000;
            if ($timeTaken < 1000) {
                $timeTaken = round($timeTaken);
                echo "DONE in {$timeTaken}ms";
            } else {
                $timeTaken = round($timeTaken / 1000, 2);
                echo "DONE in {$timeTaken} secs";
            }
            if (PHP_CODESNIFFER_CBF === true) {
                $errors = $phpcsFile->getFixableCount();
                echo " ({$errors} fixable violations)" . PHP_EOL;
            } else {
                $errors = $phpcsFile->getErrorCount();
                $warnings = $phpcsFile->getWarningCount();
                echo " ({$errors} errors, {$warnings} warnings)" . PHP_EOL;
            }
        }
        return $phpcsFile;
    }