src/Parse/UnifiedDiffTokenizer.php
public function tokenize(array $diffLineList)
    {
        $tokenList = [];
        $hasStarted = false;

        $lineCount = count($diffLineList);
        for ($i = 0; $i < $lineCount; $i++) {
            // First line of a file
            if ($this->isFileStart($diffLineList, $i)) {
                $hasStarted = true;

                $tokenList = array_merge(
                    $tokenList,
                    $this->getFilenameTokens($diffLineList, $i)
                );

                $i++;   // Skip next line - we know this is safe due to check for is file start

            // Only proceed once a file beginning has been found
            } elseif ($hasStarted) {
                $tokenList = array_merge(
                    $tokenList,
                    $this->getHunkTokens($diffLineList, $i)
                );
            }
        }

        return $tokenList;
    }
public function tokenize(array $diffLineList)
    {
        $tokenList = [];
        $hasStarted = false;

        $lineCount = count($diffLineList);
        for ($i = 0; $i < $lineCount; $i++) {
            // First line of a file
            if ($this->isFileStart($diffLineList, $i)) {
                $hasStarted = true;

                $tokenList = array_merge(
                    $tokenList,
                    $this->getFilenameTokens($diffLineList, $i)
                );

                $i++;   // Skip next line - we know this is safe due to check for is file start

            // Only proceed once a file beginning has been found
            } elseif ($hasStarted) {
                $tokenList = array_merge(
                    $tokenList,
                    $this->getHunkTokens($diffLineList, $i)
                );
            }
        }

        return $tokenList;
    }
public function tokenize ( array $ diffLineList ) { $ tokenList = [ ] ; $ hasStarted = false ; $ lineCount = count ( $ diffLineList ) ; for ( $ i = 0 ; $ i < $ lineCount ; $ i ++ ) { // First line of a file if ( $ this -> isFileStart ( $ diffLineList , $ i ) ) { $ hasStarted = true ; $ tokenList = array_merge ( $ tokenList , $ this -> getFilenameTokens ( $ diffLineList , $ i ) ) ; $ i ++ ; // Skip next line - we know this is safe due to check for is file start // Only proceed once a file beginning has been found } elseif ( $ hasStarted ) { $ tokenList = array_merge ( $ tokenList , $ this -> getHunkTokens ( $ diffLineList , $ i ) ) ; } } return $ tokenList ; }
Tokenize a unified diff

@param string[] $diffLineList

@return Token[]
Tokenize a unified diff