extensions/felixfbecker.php-intellisense-0.0.12/vendor/squizlabs/php_codesniffer/src/Files/File.php
/**
     * Tokenizes the file and prepares it for the test run.
     *
     * @return void
     */
Tokenizes the file and prepares it for the test run.
@return void
Tokenizes the file and prepares it for the test run . @return void
public function parse()
    {
        if (empty($this->tokens) === false) {
            return;
        }
        try {
            $tokenizerClass  = 'PHP_CodeSniffer\Tokenizers\\'.$this->tokenizerType;
            $this->tokenizer = new $tokenizerClass($this->content, $this->config, $this->eolChar);
            $this->tokens    = $this->tokenizer->getTokens();
        } catch (TokenizerException $e) {
            $this->addWarning($e->getMessage(), null, 'Internal.Tokenizer.Exception');
            if (PHP_CODESNIFFER_VERBOSITY > 0) {
                echo "[$this->tokenizerType => tokenizer error]... ";
                if (PHP_CODESNIFFER_VERBOSITY > 1) {
                    echo PHP_EOL;
                }
            }
            return;
        }
        $this->numTokens = count($this->tokens);
        $contents = str_replace('\\', '', $this->content);
        $contents = str_replace($this->eolChar, '', $contents);
        $contents = str_replace("\n", '\n', $contents);
        $contents = str_replace("\r", '\r', $contents);
        if (strpos($contents, '\\') !== false) {
            $error = 'File has mixed line endings; this may cause incorrect results';
            $this->addWarningOnLine($error, 1, 'Internal.LineEndings.Mixed');
        }
        if (PHP_CODESNIFFER_VERBOSITY > 0) {
            if ($this->numTokens === 0) {
                $numLines = 0;
            } else {
                $numLines = $this->tokens[($this->numTokens - 1)]['line'];
            }
            echo "[$this->tokenizerType => $this->numTokens tokens in $numLines lines]... ";
            if (PHP_CODESNIFFER_VERBOSITY > 1) {
                echo PHP_EOL;
            }
        }
    }
public function parse ( ) { if ( empty ( $ this -> tokens ) === false ) { return ; } try { $ tokenizerClass = 'PHP_CodeSniffer\Tokenizers\\' . $ this -> tokenizerType ; $ this -> tokenizer = new $ tokenizerClass ( $ this -> content , $ this -> config , $ this -> eolChar ) ; $ this -> tokens = $ this -> tokenizer -> getTokens ( ) ; } catch ( TokenizerException $ e ) { $ this -> addWarning ( $ e -> getMessage ( ) , null , 'Internal.Tokenizer.Exception' ) ; if ( PHP_CODESNIFFER_VERBOSITY > 0 ) { echo " [ $ this -> tokenizerType  => tokenizer error]...  " ; if ( PHP_CODESNIFFER_VERBOSITY > 1 ) { echo PHP_EOL ; } } return ; } $ this -> numTokens = count ( $ this -> tokens ) ; $ contents = str_replace ( '\\' , '' , $ this -> content ) ; $ contents = str_replace ( $ this -> eolChar , '' , $ contents ) ; $ contents = str_replace ( " \n " , '\n' , $ contents ) ; $ contents = str_replace ( " \r " , '\r' , $ contents ) ; if ( strpos ( $ contents , '\\' ) !== false ) { $ error = 'File has mixed line endings; this may cause incorrect results' ; $ this -> addWarningOnLine ( $ error , 1 , 'Internal.LineEndings.Mixed' ) ; } if ( PHP_CODESNIFFER_VERBOSITY > 0 ) { if ( $ this -> numTokens === 0 ) { $ numLines = 0 ; } else { $ numLines = $ this -> tokens [ ( $ this -> numTokens - 1 ) ] [ 'line' ] ; } echo " [ $ this -> tokenizerType  =>  $ this -> numTokens  tokens in  $ numLines  lines]...  " ; if ( PHP_CODESNIFFER_VERBOSITY > 1 ) { echo PHP_EOL ; } } }
Tokenizes the file and prepares it for the test run.
Tokenizes the file and prepares it for the test run .
// File has already been parsed. // Check for mixed line endings as these can cause tokenizer errors and we // should let the user know that the results they get may be incorrect. // This is done by removing all backslashes, removing the newline char we // detected, then converting newlines chars into text. If any backslashes // are left at the end, we have additional newline chars in use.