Trimester::first()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 0
cts 2
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Adlogix\EventScheduler\TemporalExpression;
6
7
use Adlogix\EventScheduler\ValueObject\Trimester as TrimesterValueObject;
8
use DateTimeInterface;
9
10
/**
11
 * @author Toni Van de Voorde <[email protected]>
12
 */
13
final class Trimester implements TemporalExpressionInterface
14
{
15
    /**
16
     * @var TrimesterValueObject
17
     */
18
    protected $trimester;
19
20
    /**
21
     * @param TrimesterValueObject $trimester
22
     */
23
    public function __construct(TrimesterValueObject $trimester)
24
    {
25
        $this->trimester = $trimester;
26
    }
27
28
    /**
29
     * @return Trimester
30
     */
31
    public static function first(): self
32
    {
33
        return new self(TrimesterValueObject::first());
34
    }
35
36
    /**
37
     * @return Trimester
38
     */
39
    public static function second(): self
40
    {
41
        return new self(TrimesterValueObject::second());
42
    }
43
44
    /**
45
     * @return Trimester
46
     */
47
    public static function third(): self
48
    {
49
        return new self(TrimesterValueObject::third());
50
    }
51
52
    /**
53
     * @return Trimester
54
     */
55
    public static function fourth(): self
56
    {
57
        return new self(TrimesterValueObject::fourth());
58
    }
59
60
    /**
61
     * {@inheritdoc}
62
     */
63 16
    public function includes(DateTimeInterface $date): bool
64
    {
65 16
        return $this->trimester->equals(TrimesterValueObject::fromNDateTime($date));
66
    }
67
}
68