src/Spy/IterableSpyFactory.php
public function create(Call $call, $iterable): IterableSpy
    {
        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)
        );
    }
public function create(Call $call, $iterable): IterableSpy
    {
        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)
        );
    }
public function create ( Call $ call , $ iterable ) : IterableSpy { 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 ) ) ; }
Create a new iterable spy.

@param Call     $call     The call from which the iterable originated.
@param iterable $iterable The iterable.

@return IterableSpy              The newly created iterable spy.
@throws InvalidArgumentException If the supplied iterable is invalid.
Create a new iterable spy .