Gittern\Repository::getObject PHP Method

getObject() public method

public getObject ( $treeish )
    public function getObject($treeish)
    {
        $sha = $this->transport->resolveTreeish($treeish);
        if (!$sha) {
            throw new EntityNotFoundException(sprintf("Couldn't find an object with identifier %s", $treeish));
        }
        return $this->getObjectBySha($sha);
    }

Usage Example

 public function __construct(Repository $repo, $commitish)
 {
     $this->repo = $repo;
     $object = $repo->getObject($commitish);
     if ($object instanceof Commit) {
         $this->commit = $object;
         $this->tree = $object->getTree();
     } else {
         throw new EntityNotFoundException("Could not resolve commitish to a commit.");
     }
 }