src/Interval.php
/**
	 * Returns a DateInterval from an int, string, or existing instance.
	 *
	 * @throws InvalidArgumentException if $interval is not a string, int, or DateInterval
	 * 
	 * @param DateInterval|string|int $interval If string, interpreted as a
	 * 		relative date string using DateInterval::createFromDateString(). If
	 *		int, interpreted as the number of days in the interval.
	 * 		
	 * @return DateInterval
	 */
Returns a DateInterval from an int, string, or existing instance.
@throws InvalidArgumentException if $interval is not a string, int, or DateInterval

@param DateInterval|string|int $interval If string, interpreted as a
relative date string using DateInterval::createFromDateString(). If
int, interpreted as the number of days in the interval.


Returns a DateInterval from an int string or existing instance . @throws InvalidArgumentException if $interval is not a string int or DateInterval @param DateInterval|string|int $interval If string interpreted as a relative date string using DateInterval :: createFromDateString () . If int interpreted as the number of days in the interval .
public static function of($interval): DateInterval
	{
		if ($interval instanceof DateInterval) {
			return $interval;
		} else if (is_int($interval)) {
			return new DateInterval("P{$interval}D");
		} else if (is_string($interval)) {
			return DateInterval::createFromDateString($interval);
		}
		throw new InvalidArgumentException(sprintf(
			"Interval must be DateInterval, integer, or string, given: %s",
			is_object($interval) ? get_class($interval) : gettype($interval)
		));
	}
public static function of ( $ interval ) : DateInterval { if ( $ interval instanceof DateInterval ) { return $ interval ; } else if ( is_int ( $ interval ) ) { return new DateInterval ( " P { $ interval } D " ) ; } else if ( is_string ( $ interval ) ) { return DateInterval :: createFromDateString ( $ interval ) ; } throw new InvalidArgumentException ( sprintf ( " Interval must be DateInterval, integer, or string, given: %s " , is_object ( $ interval ) ? get_class ( $ interval ) : gettype ( $ interval ) ) ) ; }
Returns a DateInterval from an int, string, or existing instance.
Returns a DateInterval from an int string or existing instance .