InvalidLink   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 9
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 0
dl 0
loc 9
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A invalidDateRange() 0 4 1
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