src/Parse/UnifiedDiffTokenizer.php
private function getHunkStartTokens(string $diffLine): array
    {
        $tokenList = [];

        if (preg_match(self::HUNK_START_REGEX, $diffLine, $matches)) {
            // File deletion
            if ($this->hasToken($matches, Token::FILE_DELETION_LINE_COUNT)) {
                $tokenList = [
                    new Token(Token::FILE_DELETION_LINE_COUNT, $matches[Token::FILE_DELETION_LINE_COUNT]),
                    new Token(Token::HUNK_NEW_START, $matches[Token::HUNK_NEW_START]),
                    new Token(Token::HUNK_NEW_COUNT, $matches[Token::HUNK_NEW_COUNT])
                ];

            // File creation
            } elseif ($this->hasToken($matches, Token::FILE_CREATION_LINE_COUNT)) {
                $tokenList = [
                    new Token(Token::HUNK_ORIGINAL_START, $matches[Token::HUNK_ORIGINAL_START]),
                    new Token(Token::HUNK_ORIGINAL_COUNT, $matches[Token::HUNK_ORIGINAL_COUNT]),
                    new Token(Token::FILE_CREATION_LINE_COUNT, $matches[Token::FILE_CREATION_LINE_COUNT]),
                ];

            // Standard Case
            } else {
                $tokenList = [
                    new Token(Token::HUNK_ORIGINAL_START, $matches[Token::HUNK_ORIGINAL_START]),
                    new Token(Token::HUNK_ORIGINAL_COUNT, $matches[Token::HUNK_ORIGINAL_COUNT]),
                    new Token(Token::HUNK_NEW_START, $matches[Token::HUNK_NEW_START]),
                    new Token(Token::HUNK_NEW_COUNT, $matches[Token::HUNK_NEW_COUNT])
                ];
            }
        }

        return $tokenList;
    }
private function getHunkStartTokens(string $diffLine): array
    {
        $tokenList = [];

        if (preg_match(self::HUNK_START_REGEX, $diffLine, $matches)) {
            // File deletion
            if ($this->hasToken($matches, Token::FILE_DELETION_LINE_COUNT)) {
                $tokenList = [
                    new Token(Token::FILE_DELETION_LINE_COUNT, $matches[Token::FILE_DELETION_LINE_COUNT]),
                    new Token(Token::HUNK_NEW_START, $matches[Token::HUNK_NEW_START]),
                    new Token(Token::HUNK_NEW_COUNT, $matches[Token::HUNK_NEW_COUNT])
                ];

            // File creation
            } elseif ($this->hasToken($matches, Token::FILE_CREATION_LINE_COUNT)) {
                $tokenList = [
                    new Token(Token::HUNK_ORIGINAL_START, $matches[Token::HUNK_ORIGINAL_START]),
                    new Token(Token::HUNK_ORIGINAL_COUNT, $matches[Token::HUNK_ORIGINAL_COUNT]),
                    new Token(Token::FILE_CREATION_LINE_COUNT, $matches[Token::FILE_CREATION_LINE_COUNT]),
                ];

            // Standard Case
            } else {
                $tokenList = [
                    new Token(Token::HUNK_ORIGINAL_START, $matches[Token::HUNK_ORIGINAL_START]),
                    new Token(Token::HUNK_ORIGINAL_COUNT, $matches[Token::HUNK_ORIGINAL_COUNT]),
                    new Token(Token::HUNK_NEW_START, $matches[Token::HUNK_NEW_START]),
                    new Token(Token::HUNK_NEW_COUNT, $matches[Token::HUNK_NEW_COUNT])
                ];
            }
        }

        return $tokenList;
    }
private function getHunkStartTokens ( string $ diffLine ) : array { $ tokenList = [ ] ; if ( preg_match ( self :: HUNK_START_REGEX , $ diffLine , $ matches ) ) { // File deletion if ( $ this -> hasToken ( $ matches , Token :: FILE_DELETION_LINE_COUNT ) ) { $ tokenList = [ new Token ( Token :: FILE_DELETION_LINE_COUNT , $ matches [ Token :: FILE_DELETION_LINE_COUNT ] ) , new Token ( Token :: HUNK_NEW_START , $ matches [ Token :: HUNK_NEW_START ] ) , new Token ( Token :: HUNK_NEW_COUNT , $ matches [ Token :: HUNK_NEW_COUNT ] ) ] ; // File creation } elseif ( $ this -> hasToken ( $ matches , Token :: FILE_CREATION_LINE_COUNT ) ) { $ tokenList = [ new Token ( Token :: HUNK_ORIGINAL_START , $ matches [ Token :: HUNK_ORIGINAL_START ] ) , new Token ( Token :: HUNK_ORIGINAL_COUNT , $ matches [ Token :: HUNK_ORIGINAL_COUNT ] ) , new Token ( Token :: FILE_CREATION_LINE_COUNT , $ matches [ Token :: FILE_CREATION_LINE_COUNT ] ) , ] ; // Standard Case } else { $ tokenList = [ new Token ( Token :: HUNK_ORIGINAL_START , $ matches [ Token :: HUNK_ORIGINAL_START ] ) , new Token ( Token :: HUNK_ORIGINAL_COUNT , $ matches [ Token :: HUNK_ORIGINAL_COUNT ] ) , new Token ( Token :: HUNK_NEW_START , $ matches [ Token :: HUNK_NEW_START ] ) , new Token ( Token :: HUNK_NEW_COUNT , $ matches [ Token :: HUNK_NEW_COUNT ] ) ] ; } } return $ tokenList ; }
Parses the hunk start into appropriate tokens.

@param string $diffLine

@return Token[]
Parses the hunk start into appropriate tokens .