26 if ($description = $client->getDescription()) {
55 foreach ($this->factories as $i => $f) {
61 } elseif (is_string($before)) {
62 if ($f instanceof $before) {
71 $this->factories[] = $factory;
73 array_splice($this->factories, $i, 0, array($factory));
86 public function has($factory)
88 return (
bool) $this->
find($factory);
98 public function remove($factory =
null)
101 $factory = $this->
find($factory);
104 $this->factories = array_values(array_filter($this->factories,
function($f) use ($factory) {
105 return $f !== $factory;
118 public function find($factory)
120 foreach ($this->factories as $f) {
121 if ($factory === $f || (is_string($factory) && $f instanceof $factory)) {
135 public function factory($name, array $args = array())
137 foreach ($this->factories as $factory) {
138 $command = $factory->factory($name, $args);
145 public function count()
147 return count($this->factories);
152 return new \ArrayIterator($this->factories);