public static final function cast($value): array {
		if (is_array($value)){
			return $value;
		}

		if (is_object($value) && method_exists($value, 'toArray')){
			return $value->toArray();
		}

		if ($value instanceof \Generator){
			return iterator_to_array($value);
		}

		return [$value];
	}
public static final function cast($value): array {
		if (is_array($value)){
			return $value;
		}

		if (is_object($value) && method_exists($value, 'toArray')){
			return $value->toArray();
		}

		if ($value instanceof \Generator){
			return iterator_to_array($value);
		}

		return [$value];
	}
public static final function cast ( $ value ) : array { if ( is_array ( $ value ) ) { return $ value ; } if ( is_object ( $ value ) && method_exists ( $ value , 'toArray' ) ) { return $ value -> toArray ( ) ; } if ( $ value instanceof \ Generator ) { return iterator_to_array ( $ value ) ; } return [ $ value ] ; }
Converts any value into an array.

@attention This method throws an exception if the given value
cannot be represented as an array.

@param mixed $value
@return array
Converts any value into an array .