AbstractLocator
in package
implements
LocatorInterface
AbstractYes
Provides an abstract registry/factory for repository objects.
Table of Contents
Interfaces
- LocatorInterface
- Registries for repository objects should implement this interface.
Properties
- $instances : array<string, RepositoryInterface>
- Instances that belong to the registry.
- $options : array<string, array<string|int, mixed>>
- Contains a list of options that were passed to get() method.
Methods
- clear() : void
- Clears the registry of configuration and instances.
- exists() : bool
- Check to see if an instance exists in the registry.
- get() : RepositoryInterface
- Get a repository instance from the registry.
- remove() : void
- Removes an repository instance from the registry.
- set() : RepositoryInterface
- Set a repository instance.
- createInstance() : RepositoryInterface
- Create an instance of a given classname.
Properties
$instances
Instances that belong to the registry.
protected
array<string, RepositoryInterface>
$instances
= []
$options
Contains a list of options that were passed to get() method.
protected
array<string, array<string|int, mixed>>
$options
= []
Methods
clear()
Clears the registry of configuration and instances.
public
clear() : void
Tags
exists()
Check to see if an instance exists in the registry.
public
exists(string $alias) : bool
Parameters
- $alias : string
-
The alias to check for.
Tags
Return values
boolget()
Get a repository instance from the registry.
public
get(string $alias[, array<string, mixed> $options = [] ]) : RepositoryInterface
Parameters
- $alias : string
-
The alias name you want to get.
- $options : array<string, mixed> = []
-
The options you want to build the table with.
Tags
Return values
RepositoryInterfaceremove()
Removes an repository instance from the registry.
public
remove(string $alias) : void
Parameters
- $alias : string
-
The alias to remove.
Tags
set()
Set a repository instance.
public
set(string $alias, RepositoryInterface $repository) : RepositoryInterface
Parameters
- $alias : string
-
The alias to set.
- $repository : RepositoryInterface
-
The repository to set.
Tags
Return values
RepositoryInterfacecreateInstance()
Create an instance of a given classname.
protected
abstract createInstance(string $alias, array<string, mixed> $options) : RepositoryInterface
Parameters
- $alias : string
-
Repository alias.
- $options : array<string, mixed>
-
The options you want to build the instance with.