InvalidLink::invalidDateRange()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
1
<?php
2
3
namespace Spatie\CalendarLinks\Exceptions;
4
5
use DateTimeInterface;
6
use InvalidArgumentException;
7
8
class InvalidLink extends InvalidArgumentException
9
{
10
    private const DATETIME_FORMAT = 'Y-m-d H:i:s';
11
12
    public static function invalidDateRange(DateTimeInterface $to, DateTimeInterface $from): self
13
    {
14
        return new self("TO time (`{$to->format(self::DATETIME_FORMAT)}`) must be greater than FROM time (`{$from->format(self::DATETIME_FORMAT)}`)");
15
    }
16
}
17