League\Period\Period::createFromDatepoints PHP Method

createFromDatepoints() protected static method

The datepoints will be used as to allow the creation of a Period object
protected static createFromDatepoints ( DateTimeInterfac\DateTimeInterface | string $datePoint1, DateTimeInterfac\DateTimeInterface | string $datePoint2 ) : Period
$datePoint1 DateTimeInterfac\DateTimeInterface | string datepoint
$datePoint2 DateTimeInterfac\DateTimeInterface | string datepoint
return Period
    protected static function createFromDatepoints($datePoint1, $datePoint2)
    {
        $startDate = static::filterDatePoint($datePoint1);
        $endDate = static::filterDatePoint($datePoint2);
        if ($startDate > $endDate) {
            return new static($endDate, $startDate);
        }
        return new static($startDate, $endDate);
    }