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

tryGetRepository() public method

Returns the repository if it is registered in the map, NULL otherwise
public tryGetRepository ( string $key ) : TQ\Vcs\Repository\RepositoryInterface | null
$key string The key
return TQ\Vcs\Repository\RepositoryInterface | null
    public function tryGetRepository($key)
    {
        if ($this->hasRepository($key)) {
            return $this->map[$key];
        } else {
            return null;
        }
    }

Usage Example

 public function testTryGetNonExistentRepositoryReturnsNull()
 {
     $registry = new RepositoryRegistry();
     $this->assertNull($registry->tryGetRepository('a'));
 }