public static function createFromObject(\Traversable $object): self
    {
        // init
        $array = new static();

        if ($object instanceof self) {
            $objectArray = $object->getGenerator();
        } else {
            $objectArray = $object;
        }

        foreach ($objectArray as $key => $value) {
            $array[$key] = $value;
        }

        return $array;
    }
public static function createFromObject(\Traversable $object): self
    {
        // init
        $array = new static();

        if ($object instanceof self) {
            $objectArray = $object->getGenerator();
        } else {
            $objectArray = $object;
        }

        foreach ($objectArray as $key => $value) {
            $array[$key] = $value;
        }

        return $array;
    }
public static function createFromObject ( \ Traversable $ object ) : self { // init $ array = new static ( ) ; if ( $ object instanceof self ) { $ objectArray = $ object -> getGenerator ( ) ; } else { $ objectArray = $ object ; } foreach ( $ objectArray as $ key => $ value ) { $ array [ $ key ] = $ value ; } return $ array ; }
Create an new instance filled with values from an object that is iterable.

@param \Traversable $object <p>iterable object</p>

@return static
<p>(Immutable) Returns an new instance of the Arrayy object.</p>
Create an new instance filled with values from an object that is iterable .