CompositeFactory
in package
implements
IteratorAggregate, Countable, FactoryInterface
Composite factory used by a client object to create command objects utilizing multiple factories
Table of Contents
Interfaces
- IteratorAggregate
- Countable
- FactoryInterface
- Interface for creating commands by name
Properties
- $factories : array<string|int, mixed>
Methods
- __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
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
CompositeFactorycount()
public
count() : mixed
Attributes
- #[ReturnTypeWillChange]
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
CommandInterfacefind()
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|FactoryInterfacegetDefaultChain()
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
selfgetIterator()
public
getIterator() : mixed
Attributes
- #[ReturnTypeWillChange]
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
boolremove()
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