ResourceIteratorClassFactory
extends AbstractResourceIteratorFactory
in package
Factory for creating {@see ResourceIteratorInterface} objects using a convention of storing iterator classes under a root namespace using the name of a {@see CommandInterface} object as a convention for determining the name of an iterator class. The command name is converted to CamelCase and Iterator is appended (e.g. abc_foo => AbcFoo).
Table of Contents
Properties
- $inflector : InflectorInterface
- $namespaces : array<string|int, mixed>
Methods
- __construct() : mixed
- build() : ResourceIteratorInterface
- Create a resource iterator
- canBuild() : bool
- Check if the factory can create an iterator
- registerNamespace() : self
- Registers a namespace to check for Iterators
- getClassName() : string
- Get the name of the class to instantiate for the command
Properties
$inflector
protected
InflectorInterface
$inflector
Inflector used to determine class names
$namespaces
protected
array<string|int, mixed>
$namespaces
List of namespaces used to look for classes
Methods
__construct()
public
__construct([string|array<string|int, mixed> $namespaces = array() ][, InflectorInterface $inflector = null ]) : mixed
Parameters
- $namespaces : string|array<string|int, mixed> = array()
-
List of namespaces for iterator objects
- $inflector : InflectorInterface = null
-
Inflector used to resolve class names
build()
Create a resource iterator
public
build(CommandInterface $command[, array<string|int, mixed> $options = array() ]) : ResourceIteratorInterface
Parameters
- $command : CommandInterface
-
Command to create an iterator for
- $options : array<string|int, mixed> = array()
-
Iterator options that are exposed as data.
Return values
ResourceIteratorInterfacecanBuild()
Check if the factory can create an iterator
public
canBuild(CommandInterface $command) : bool
Parameters
- $command : CommandInterface
-
Command to create an iterator for
Return values
boolregisterNamespace()
Registers a namespace to check for Iterators
public
registerNamespace(string $namespace) : self
Parameters
- $namespace : string
-
Namespace which contains Iterator classes
Return values
selfgetClassName()
Get the name of the class to instantiate for the command
protected
getClassName(CommandInterface $command) : string
Parameters
- $command : CommandInterface
-
Command that is associated with the iterator