src/Incoming/Structure/RecursiveInputStructureFactory.php
protected static function buildFromTraversableLike($data): Structure
    {
        if (is_array($data)) {
            return static::buildFromArray($data);
        } elseif ($data instanceof Traversable) {
            return static::buildFromTraversable($data);
        }

        throw InvalidStructuralTypeException::withTypeInfo($data);
    }
protected static function buildFromTraversableLike($data): Structure
    {
        if (is_array($data)) {
            return static::buildFromArray($data);
        } elseif ($data instanceof Traversable) {
            return static::buildFromTraversable($data);
        }

        throw InvalidStructuralTypeException::withTypeInfo($data);
    }
protected static function buildFromTraversableLike ( $ data ) : Structure { if ( is_array ( $ data ) ) { return static :: buildFromArray ( $ data ) ; } elseif ( $ data instanceof Traversable ) { return static :: buildFromTraversable ( $ data ) ; } throw InvalidStructuralTypeException :: withTypeInfo ( $ data ) ; }
Build a structure from "Traversable-like" data.

This allows to build from data that is either an array or Traversable, as
PHP's array type works JUST like a Traversable instance but doesn't
actually implement any interfaces.

@param Traversable|array $data The input data.
@throws InvalidStructuralTypeException If the data type isn't supported.
@return Structure The built structure.
Build a structure from Traversable - like data .