Passed
Push — master ( c2e69f...e5bfaf )
by Samuel
43s
created

Recurrence::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace Recurrence;
4
5
/**
6
 * Class Recurrence
7
 * @package Recurrence
8
 */
9
class Recurrence
10
{
11
    /**
12
     * @var Frequency
13
     */
14
    private $frequency;
15
16
    /**
17
     * @var \Datetime
18
     */
19
    private $periodStartAt;
20
21
    /**
22
     * @var \Datetime
23
     */
24
    private $periodEndAt;
25
26
    /**
27
     * @var integer
28
     */
29
    private $interval = 1;
30
31
    /**
32
     * @var integer
33
     */
34
    private $count;
35
36
    /**
37
     * Recurrence constructor.
38
     */
39
    public function __construct()
40
    {
41
        $this->setPeriodStartAt(new \DateTime());
42
    }
43
44
    /**
45
     * @param \Datetime $periodStartAt
46
     * @return $this
47
     */
48
    public function setPeriodStartAt(\Datetime $periodStartAt)
49
    {
50
        $this->periodStartAt = $periodStartAt;
51
52
        return $this;
53
    }
54
55
    /**
56
     * @return \Datetime
57
     */
58
    public function getPeriodStartAt()
59
    {
60
        return $this->periodStartAt;
61
    }
62
63
    /**
64
     * @param \Datetime $periodEndAt
65
     * @return $this
66
     */
67
    public function setPeriodEndAt(\Datetime $periodEndAt)
68
    {
69
        $this->periodEndAt = $periodEndAt;
70
71
        return $this;
72
    }
73
74
    /**
75
     * @return \Datetime
76
     */
77
    public function getPeriodEndAt()
78
    {
79
        return $this->periodEndAt;
80
    }
81
82
    /**
83
     * @param Frequency $frequency
84
     * @return $this
85
     */
86
    public function setFrequency(Frequency $frequency)
87
    {
88
        $this->frequency = $frequency;
89
90
        return $this;
91
    }
92
93
    /**
94
     * @return Frequency
95
     */
96
    public function getFrequency()
97
    {
98
        return $this->frequency;
99
    }
100
101
    /**
102
     * @return int
103
     */
104
    public function getInterval()
105
    {
106
        return $this->interval;
107
    }
108
109
    /**
110
     * @param int $interval
111
     * @return $this
112
     */
113
    public function setInterval($interval)
114
    {
115
        $this->interval = $interval;
116
117
        return $this;
118
    }
119
120
    /**
121
     * @return int
122
     */
123
    public function getCount()
124
    {
125
        return $this->count;
126
    }
127
128
    /**
129
     * @return int
130
     */
131
    public function hasCount()
132
    {
133
        return ($this->count !== null);
134
    }
135
136
    /**
137
     * @param int $count
138
     * @return $this
139
     */
140
    public function setCount($count)
141
    {
142
        $this->count = $count;
143
144
        return $this;
145
    }
146
}
147