We create the context ourselves

This commit is contained in:
Robin Appelman 2014-08-27 12:21:32 +02:00
commit 7bde877610

View file

@ -45,9 +45,9 @@ class IteratorDirectory implements Directory {
} else { } else {
throw new \BadMethodCallException('Invalid context, "' . $name . '" options not set'); throw new \BadMethodCallException('Invalid context, "' . $name . '" options not set');
} }
if (isset($context['iterator']) and $context['iterator'] instanceof \Iterator) { if (isset($context['iterator'])) {
$this->iterator = $context['iterator']; $this->iterator = $context['iterator'];
} else if (isset($context['array']) and is_array($context['array'])) { } else if (isset($context['array'])) {
$this->iterator = new \ArrayIterator($context['array']); $this->iterator = new \ArrayIterator($context['array']);
} else { } else {
throw new \BadMethodCallException('Invalid context, iterator or array not set'); throw new \BadMethodCallException('Invalid context, iterator or array not set');