src/Incoming/Structure/Map.php
public static function fromTraversable(Traversable $data): self
    {
        $map = new static();

        foreach ($data as $key => $val) {
            if (!is_scalar($key)) {
                throw new InvalidArgumentException('Map keys must be scalar');
            }

            $map->decorated->offsetSet($key, $val);
        }

        return $map;
    }
public static function fromTraversable(Traversable $data): self
    {
        $map = new static();

        foreach ($data as $key => $val) {
            if (!is_scalar($key)) {
                throw new InvalidArgumentException('Map keys must be scalar');
            }

            $map->decorated->offsetSet($key, $val);
        }

        return $map;
    }
public static function fromTraversable ( Traversable $ data ) : self { $ map = new static ( ) ; foreach ( $ data as $ key => $ val ) { if ( ! is_scalar ( $ key ) ) { throw new InvalidArgumentException ( 'Map keys must be scalar' ) ; } $ map -> decorated -> offsetSet ( $ key , $ val ) ; } return $ map ; }
Create from data in a Traversable instance.

@param Traversable $data The data to create from.
@return static The resulting data-structure.
@throws InvalidArgumentException If the data contains non-scalar keys.
Create from data in a Traversable instance .