public static function getLineSlices(string $line)
    {
        preg_match('/^(\d+) (\w+) ([a-z0-9]+) +(\d+|-)\t(.*)$/', $line, $matches);
        $permissions = $matches[1];
        $type = null;
        switch ($matches[2]) {
            case NodeObject::TYPE_TREE:
                $type = NodeObject::TYPE_TREE;
                break;
            case NodeObject::TYPE_BLOB:
                $type = NodeObject::TYPE_BLOB;
                break;
            case NodeObject::TYPE_LINK:
                $type = NodeObject::TYPE_LINK;
                break;
        }
        $sha = $matches[3];
        $size = $matches[4];
        $fullPath = $matches[5];

        return [
            'permissions' => $permissions,
            'type'        => $type,
            'sha'         => $sha,
            'size'        => $size,
            'fullPath'    => $fullPath,
        ];
    }
public static function getLineSlices(string $line)
    {
        preg_match('/^(\d+) (\w+) ([a-z0-9]+) +(\d+|-)\t(.*)$/', $line, $matches);
        $permissions = $matches[1];
        $type = null;
        switch ($matches[2]) {
            case NodeObject::TYPE_TREE:
                $type = NodeObject::TYPE_TREE;
                break;
            case NodeObject::TYPE_BLOB:
                $type = NodeObject::TYPE_BLOB;
                break;
            case NodeObject::TYPE_LINK:
                $type = NodeObject::TYPE_LINK;
                break;
        }
        $sha = $matches[3];
        $size = $matches[4];
        $fullPath = $matches[5];

        return [
            'permissions' => $permissions,
            'type'        => $type,
            'sha'         => $sha,
            'size'        => $size,
            'fullPath'    => $fullPath,
        ];
    }
public static function getLineSlices ( string $ line ) { preg_match ( '/^(\d+) (\w+) ([a-z0-9]+) +(\d+|-)\t(.*)$/' , $ line , $ matches ) ; $ permissions = $ matches [ 1 ] ; $ type = null ; switch ( $ matches [ 2 ] ) { case NodeObject :: TYPE_TREE : $ type = NodeObject :: TYPE_TREE ; break ; case NodeObject :: TYPE_BLOB : $ type = NodeObject :: TYPE_BLOB ; break ; case NodeObject :: TYPE_LINK : $ type = NodeObject :: TYPE_LINK ; break ; } $ sha = $ matches [ 3 ] ; $ size = $ matches [ 4 ] ; $ fullPath = $ matches [ 5 ] ; return [ 'permissions' => $ permissions , 'type' => $ type , 'sha' => $ sha , 'size' => $ size , 'fullPath' => $ fullPath , ] ; }
Take a line and turn it in slices

@param string $line a single line output from the git binary

@return array
Take a line and turn it in slices