src/Parse/UnifiedDiffParser.php
private function getHunkMeta(array $hunkTokenList): array
    {
        switch (true) {
            case Token::FILE_DELETION_LINE_COUNT === $hunkTokenList[0]->getType():
                $originalStart = 1;
                $originalCount = intval($hunkTokenList[0]->getValue());
                $newStart = intval($hunkTokenList[1]->getValue());
                $newCount = intval($hunkTokenList[2]->getValue());
                $tokensReadCount = 3;
                break;

            case Token::FILE_CREATION_LINE_COUNT === $hunkTokenList[2]->getType():
                $originalStart = intval($hunkTokenList[0]->getValue());
                $originalCount = intval($hunkTokenList[1]->getValue());
                $newStart = 1;
                $newCount = intval($hunkTokenList[2]->getValue());
                $tokensReadCount = 3;
                break;

            default:
                $originalStart = intval($hunkTokenList[0]->getValue());
                $originalCount = intval($hunkTokenList[1]->getValue());
                $newStart = intval($hunkTokenList[2]->getValue());
                $newCount = intval($hunkTokenList[3]->getValue());
                $tokensReadCount = 4;
                break;
        }

        return [
            $originalStart,
            $originalCount,
            $newStart,
            $newCount,
            $tokensReadCount
        ];
    }
private function getHunkMeta(array $hunkTokenList): array
    {
        switch (true) {
            case Token::FILE_DELETION_LINE_COUNT === $hunkTokenList[0]->getType():
                $originalStart = 1;
                $originalCount = intval($hunkTokenList[0]->getValue());
                $newStart = intval($hunkTokenList[1]->getValue());
                $newCount = intval($hunkTokenList[2]->getValue());
                $tokensReadCount = 3;
                break;

            case Token::FILE_CREATION_LINE_COUNT === $hunkTokenList[2]->getType():
                $originalStart = intval($hunkTokenList[0]->getValue());
                $originalCount = intval($hunkTokenList[1]->getValue());
                $newStart = 1;
                $newCount = intval($hunkTokenList[2]->getValue());
                $tokensReadCount = 3;
                break;

            default:
                $originalStart = intval($hunkTokenList[0]->getValue());
                $originalCount = intval($hunkTokenList[1]->getValue());
                $newStart = intval($hunkTokenList[2]->getValue());
                $newCount = intval($hunkTokenList[3]->getValue());
                $tokensReadCount = 4;
                break;
        }

        return [
            $originalStart,
            $originalCount,
            $newStart,
            $newCount,
            $tokensReadCount
        ];
    }
private function getHunkMeta ( array $ hunkTokenList ) : array { switch ( true ) { case Token :: FILE_DELETION_LINE_COUNT === $ hunkTokenList [ 0 ] -> getType ( ) : $ originalStart = 1 ; $ originalCount = intval ( $ hunkTokenList [ 0 ] -> getValue ( ) ) ; $ newStart = intval ( $ hunkTokenList [ 1 ] -> getValue ( ) ) ; $ newCount = intval ( $ hunkTokenList [ 2 ] -> getValue ( ) ) ; $ tokensReadCount = 3 ; break ; case Token :: FILE_CREATION_LINE_COUNT === $ hunkTokenList [ 2 ] -> getType ( ) : $ originalStart = intval ( $ hunkTokenList [ 0 ] -> getValue ( ) ) ; $ originalCount = intval ( $ hunkTokenList [ 1 ] -> getValue ( ) ) ; $ newStart = 1 ; $ newCount = intval ( $ hunkTokenList [ 2 ] -> getValue ( ) ) ; $ tokensReadCount = 3 ; break ; default : $ originalStart = intval ( $ hunkTokenList [ 0 ] -> getValue ( ) ) ; $ originalCount = intval ( $ hunkTokenList [ 1 ] -> getValue ( ) ) ; $ newStart = intval ( $ hunkTokenList [ 2 ] -> getValue ( ) ) ; $ newCount = intval ( $ hunkTokenList [ 3 ] -> getValue ( ) ) ; $ tokensReadCount = 4 ; break ; } return [ $ originalStart , $ originalCount , $ newStart , $ newCount , $ tokensReadCount ] ; }
Parse out hunk meta.

@param Token[] $hunkTokenList

@return array Containing Original Start, Original Count, New Start, New Count & number of tokens consumed.
Parse out hunk meta .