CompositeFactory
in package
implements
IteratorAggregate, Countable, FactoryInterface
Composite factory used by a client object to create command objects utilizing multiple factories
Interfaces, Classes and Traits
- IteratorAggregate
- Countable
- FactoryInterface
- Interface for creating commands by name
Table of Contents
- $factories : array<string|int, mixed>
- __construct() : mixed
- add() : CompositeFactory
- Add a command factory to the chain
- count() : mixed
- factory() : CommandInterface
- Create a command using the associated command factories
- find() : null|FactoryInterface
- Get a command factory by class name
- getDefaultChain() : self
- Get the default chain to use with clients
- getIterator() : mixed
- has() : bool
- Check if the chain contains a specific command factory
- remove() : CompositeFactory
- Remove a specific command factory from the chain
Properties
$factories
protected
array<string|int, mixed>
$factories
Array of command factories
Methods
__construct()
public
__construct([array<string|int, mixed> $factories = array() ]) : mixed
Parameters
- $factories : array<string|int, mixed> = array()
-
Array of command factories
Return values
mixed —add()
Add a command factory to the chain
public
add(FactoryInterface $factory[, string|FactoryInterface $before = null ]) : CompositeFactory
Parameters
- $factory : FactoryInterface
-
Factory to add
- $before : string|FactoryInterface = null
-
Insert the new command factory before a command factory class or object matching a class name.
Return values
CompositeFactory —count()
public
count() : mixed
Return values
mixed —factory()
Create a command using the associated command factories
public
factory(string $name[, array<string|int, mixed> $args = array() ]) : CommandInterface
Parameters
- $name : string
-
Name of the command
- $args : array<string|int, mixed> = array()
-
Command arguments
Return values
CommandInterface —find()
Get a command factory by class name
public
find(string|FactoryInterface $factory) : null|FactoryInterface
Parameters
- $factory : string|FactoryInterface
-
Command factory class or instance
Return values
null|FactoryInterface —getDefaultChain()
Get the default chain to use with clients
public
static getDefaultChain(ClientInterface $client) : self
Parameters
- $client : ClientInterface
-
Client to base the chain on
Return values
self —getIterator()
public
getIterator() : mixed
Return values
mixed —has()
Check if the chain contains a specific command factory
public
has(FactoryInterface|string $factory) : bool
Parameters
- $factory : FactoryInterface|string
-
Factory to check
Return values
bool —remove()
Remove a specific command factory from the chain
public
remove([string|FactoryInterface $factory = null ]) : CompositeFactory
Parameters
- $factory : string|FactoryInterface = null
-
Factory to remove by name or instance