public static final function cast($value): string {
		if (is_string($value)){
			return $value;
		}

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

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

		if ($value instanceof \Generator){
			return self::join('', iterator_to_array($value, false));
		}

		return (string)$value;
	}
public static final function cast($value): string {
		if (is_string($value)){
			return $value;
		}

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

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

		if ($value instanceof \Generator){
			return self::join('', iterator_to_array($value, false));
		}

		return (string)$value;
	}
public static final function cast ( $ value ) : string { if ( is_string ( $ value ) ) { return $ value ; } if ( is_object ( $ value ) && method_exists ( $ value , 'toString' ) ) { return $ value -> toString ( ) ; } if ( is_object ( $ value ) && method_exists ( $ value , '__toString' ) ) { return $ value -> __toString ( ) ; } if ( $ value instanceof \ Generator ) { return self :: join ( '' , iterator_to_array ( $ value , false ) ) ; } return ( string ) $ value ; }
Converts any value into a string.

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

@param mixed $value
@return string
Converts any value into a string .