private function parseParents($sha)
    {
        if (!strpos($sha, '^') && !strpos($sha, '~')) {
            return [];
        }
        preg_match_all('#[\^~][0-9]*#', $sha, $matches);
        $parents = [];
        foreach ($matches[0] as $match) {
            $sign = $match[0];
            $number = intval(substr($match, 1) ?: 1);
            if ($sign === '~') {
                for ($i = 1; $i <= $number; $i++) {
                    $parents[] = 1;
                }
            } elseif ($sign === '^') {
                $parents[] = intval($number);
            }
        }

        return $parents;
    }
private function parseParents($sha)
    {
        if (!strpos($sha, '^') && !strpos($sha, '~')) {
            return [];
        }
        preg_match_all('#[\^~][0-9]*#', $sha, $matches);
        $parents = [];
        foreach ($matches[0] as $match) {
            $sign = $match[0];
            $number = intval(substr($match, 1) ?: 1);
            if ($sign === '~') {
                for ($i = 1; $i <= $number; $i++) {
                    $parents[] = 1;
                }
            } elseif ($sign === '^') {
                $parents[] = intval($number);
            }
        }

        return $parents;
    }
private function parseParents ( $ sha ) { if ( ! strpos ( $ sha , '^' ) && ! strpos ( $ sha , '~' ) ) { return [ ] ; } preg_match_all ( '#[\^~][0-9]*#' , $ sha , $ matches ) ; $ parents = [ ] ; foreach ( $ matches [ 0 ] as $ match ) { $ sign = $ match [ 0 ] ; $ number = intval ( substr ( $ match , 1 ) ? : 1 ) ; if ( $ sign === '~' ) { for ( $ i = 1 ; $ i <= $ number ; $ i ++ ) { $ parents [ ] = 1 ; } } elseif ( $ sign === '^' ) { $ parents [ ] = intval ( $ number ) ; } } return $ parents ; }
Parse the parents in a Git commit spec.

@param string $sha

@return int[]
A list of parents.
Parse the parents in a Git commit spec .