DateSolarTrait::getYear()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Popy\Calendar\ValueObject\DateRepresentation;
4
5
/**
6
 * Popy\Calendar\ValueObject\DateSolarRepresentationInterface implementatuon.
7
 */
8
trait DateSolarTrait
9
{
10
    /**
11
     * Year
12
     *
13
     * @var integer|null
14
     */
15
    protected $year;
16
17
    /**
18
     * Is leap year
19
     *
20
     * @var boolean|null
21
     */
22
    protected $leapYear;
23
24
    /**
25
     * Day Index
26
     *
27
     * @var integer|null
28
     */
29
    protected $dayIndex;
30
31
    /**
32
     * Day Index
33
     *
34
     * @var integer|null
35
     */
36
    protected $eraDayIndex;
37
38
    /**
39
     * @inheritDoc
40
     */
41
    public function getYear()
42
    {
43
        return $this->year;
44
    }
45
46
    /**
47
     * @inheritDoc
48
     */
49
    public function isLeapYear()
50
    {
51
        return $this->leapYear;
52
    }
53
54
    /**
55
     * @inheritDoc
56
     */
57
    public function getDayIndex()
58
    {
59
        return $this->dayIndex;
60
    }
61
62
    /**
63
     * @inheritDoc
64
     */
65
    public function getEraDayIndex()
66
    {
67
        return $this->eraDayIndex;
68
    }
69
70
    /**
71
     * @inheritDoc
72
     */
73
    public function withYear($year, $isLeap)
74
    {
75
        $res = clone $this;
76
        $res->year = $year;
77
        $res->leapYear = $isLeap;
78
79
        return $res;
80
    }
81
82
    /**
83
     * @inheritDoc
84
     */
85
    public function withDayIndex($dayIndex, $eraDayIndex)
86
    {
87
        $res = clone $this;
88
        $res->dayIndex = $dayIndex;
89
        $res->eraDayIndex = $eraDayIndex;
90
        
91
        return $res;
92
    }
93
}
94