public create ( Eloquent\Phony\Call\Call $call, Traversabl\Traversable | array $iterable ) : Traversable | ||
$call | Eloquent\Phony\Call\Call | The call from which the iterable originated. |
$iterable | Traversabl\Traversable | array | The iterable. |
Résultat | Traversable | The newly created iterable spy. |
public function create(Call $call, $iterable)
{
if ($iterable instanceof Traversable) {
return new TraversableSpy($call, $iterable, $this->callEventFactory);
}
if (is_array($iterable)) {
return new ArraySpy($call, $iterable, $this->callEventFactory);
}
if (is_object($iterable)) {
$type = var_export(get_class($iterable), true);
} else {
$type = gettype($iterable);
}
throw new InvalidArgumentException(sprintf('Unsupported iterable of type %s.', $type));
}