AbcFoo). */ class ResourceIteratorClassFactory extends AbstractResourceIteratorFactory { /** @var array List of namespaces used to look for classes */ protected $namespaces; /** @var InflectorInterface Inflector used to determine class names */ protected $inflector; /** * @param string|array $namespaces List of namespaces for iterator objects * @param InflectorInterface $inflector Inflector used to resolve class names */ public function __construct($namespaces = array(), InflectorInterface $inflector = null) { $this->namespaces = (array) $namespaces; $this->inflector = $inflector ?: Inflector::getDefault(); } /** * Registers a namespace to check for Iterators * * @param string $namespace Namespace which contains Iterator classes * * @return self */ public function registerNamespace($namespace) { array_unshift($this->namespaces, $namespace); return $this; } protected function getClassName(CommandInterface $command) { $iteratorName = $this->inflector->camel($command->getName()) . 'Iterator'; // Determine the name of the class to load foreach ($this->namespaces as $namespace) { $potentialClassName = $namespace . '\\' . $iteratorName; if (class_exists($potentialClassName)) { return $potentialClassName; } } return false; } }