protected function castObject($value): array
    {
        if ($value instanceof Traversable && (!isset($this->traversable) || !is_a($value, $this->traversable, true))) {
            return iterator_to_array($value);
        }

        if ($value instanceof stdClass) {
            return call_user_func('get_object_vars', $value);
        }

        return [$value];
    }
protected function castObject($value): array
    {
        if ($value instanceof Traversable && (!isset($this->traversable) || !is_a($value, $this->traversable, true))) {
            return iterator_to_array($value);
        }

        if ($value instanceof stdClass) {
            return call_user_func('get_object_vars', $value);
        }

        return [$value];
    }
protected function castObject ( $ value ) : array { if ( $ value instanceof Traversable && ( ! isset ( $ this -> traversable ) || ! is_a ( $ value , $ this -> traversable , true ) ) ) { return iterator_to_array ( $ value ) ; } if ( $ value instanceof stdClass ) { return call_user_func ( 'get_object_vars' , $ value ) ; } return [ $ value ] ; }
Cast an object to a array

@param mixed $value
@return array
Cast an object to a array