TQ\Vcs\StreamWrapper\RepositoryRegistry::getRepository PHP Method

getRepository() public method

Returns the repository if it is registered in the map, throws exception otherwise
public getRepository ( string $key ) : TQ\Vcs\Repository\RepositoryInterface
$key string The key
return TQ\Vcs\Repository\RepositoryInterface
    public function getRepository($key)
    {
        $repository = $this->tryGetRepository($key);
        if ($repository === null) {
            throw new \OutOfBoundsException($key . ' does not exist in the registry');
        }
        return $repository;
    }

Usage Example

 /**
  * Returns the repository for the given path information
  *
  * @param   array       $pathInfo       An array containing information about the path
  * @return  RepositoryInterface
  */
 protected function getRepository(array $pathInfo)
 {
     if ($pathInfo['host'] === PathInformationInterface::GLOBAL_PATH_HOST) {
         return $this->createRepositoryForPath($pathInfo['path']);
     } else {
         return $this->map->getRepository($pathInfo['host']);
     }
 }
All Usage Examples Of TQ\Vcs\StreamWrapper\RepositoryRegistry::getRepository