TQ\Svn\Repository\Repository::getObjectInfo PHP Method

getObjectInfo() public method

The information returned is an array with the following structure array( 'type' => blob|tree|commit, 'mode' => 0040000 for a tree, 0100000 for a blob, 0 otherwise, 'size' => the size )
public getObjectInfo ( string $path, string $ref = 'HEAD' ) : array
$path string The path to the object
$ref string The version ref
return array The object info
    public function getObjectInfo($path, $ref = 'HEAD')
    {
        /** @var $result CallResult */
        $result = $this->getSvn()->{'info'}($this->getRepositoryPath(), array('--xml', '--revision' => $ref, $this->resolveLocalPath($path)));
        $result->assertSuccess(sprintf('Cannot get info for "%s" at "%s" from "%s"', $path, $ref, $this->getRepositoryPath()));
        $xml = simplexml_load_string($result->getStdOut());
        if (!$xml) {
            throw new \RuntimeException(sprintf('Cannot read info XML for "%s" at "%s" from "%s"', $path, $ref, $this->getRepositoryPath()));
        }
        $entry = $xml->xpath('/info/entry');
        if (count($entry) !== 1) {
            throw new \RuntimeException(sprintf('Cannot read info XML for "%s" at "%s" from "%s"', $path, $ref, $this->getRepositoryPath()));
        }
        $entry = reset($entry);
        $mode = 0;
        switch ((string) $entry['kind']) {
            case 'dir':
                $mode |= 040000;
                break;
            case 'file':
                $mode |= 0100000;
                break;
        }
        return array('type' => (string) $entry['kind'], 'mode' => (int) $mode, 'size' => 0);
    }