PHP Class TQ\Vcs\StreamWrapper\RepositoryRegistry

Inheritance: implements Countable
Show file Open project: teqneers/php-stream-wrapper-for-git Class Usage Examples

Protected Properties

Property Type Description
$map array The repository map

Public Methods

Method Description
addRepositories ( array $repositories ) : RepositoryRegistry Adds multiple repositories
addRepository ( string $key, TQ\Vcs\Repository\RepositoryInterface $repository ) : RepositoryRegistry Adds a single repository
count ( ) : integer Count elements of an object
getRepository ( string $key ) : TQ\Vcs\Repository\RepositoryInterface Returns the repository if it is registered in the map, throws exception otherwise
hasRepository ( string $key ) : boolean Returns true if the repository is registered in the map
tryGetRepository ( string $key ) : TQ\Vcs\Repository\RepositoryInterface | null Returns the repository if it is registered in the map, NULL otherwise

Method Details

addRepositories() public method

Adds multiple repositories
public addRepositories ( array $repositories ) : RepositoryRegistry
$repositories array The repositories (key => repository)
return RepositoryRegistry

addRepository() public method

Adds a single repository
public addRepository ( string $key, TQ\Vcs\Repository\RepositoryInterface $repository ) : RepositoryRegistry
$key string The key
$repository TQ\Vcs\Repository\RepositoryInterface The repository
return RepositoryRegistry

count() public method

Count elements of an object
public count ( ) : integer
return integer The custom count as an integer

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

hasRepository() public method

Returns true if the repository is registered in the map
public hasRepository ( string $key ) : boolean
$key string The key
return boolean

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

Property Details

$map protected property

The repository map
protected array $map
return array