1 | <?php |
||
9 | class Period |
||
10 | { |
||
11 | /** |
||
12 | * Starting date of the period. |
||
13 | * |
||
14 | * @var string |
||
15 | */ |
||
16 | protected $start; |
||
17 | |||
18 | /** |
||
19 | * Ending date of the period. |
||
20 | * |
||
21 | * @var string |
||
22 | */ |
||
23 | protected $end; |
||
24 | |||
25 | /** |
||
26 | * Interval. |
||
27 | * |
||
28 | * @var string |
||
29 | */ |
||
30 | protected $interval; |
||
31 | |||
32 | /** |
||
33 | * Interval count. |
||
34 | * |
||
35 | * @var int |
||
36 | */ |
||
37 | protected $period = 1; |
||
38 | |||
39 | /** |
||
40 | * Create a new Period instance. |
||
41 | * |
||
42 | * @param string $interval |
||
43 | * @param int $count |
||
44 | * @param string $start |
||
45 | * |
||
46 | * @return void |
||
|
|||
47 | */ |
||
48 | public function __construct($interval = 'month', $count = 1, $start = '') |
||
65 | |||
66 | /** |
||
67 | * Get start date. |
||
68 | * |
||
69 | * @return \Carbon\Carbon |
||
70 | */ |
||
71 | public function getStartDate(): Carbon |
||
75 | |||
76 | /** |
||
77 | * Get end date. |
||
78 | * |
||
79 | * @return \Carbon\Carbon |
||
80 | */ |
||
81 | public function getEndDate(): Carbon |
||
85 | |||
86 | /** |
||
87 | * Get period interval. |
||
88 | * |
||
89 | * @return string |
||
90 | */ |
||
91 | public function getInterval(): string |
||
95 | |||
96 | /** |
||
97 | * Get period interval count. |
||
98 | * |
||
99 | * @return int |
||
100 | */ |
||
101 | public function getIntervalCount(): int |
||
105 | } |
||
106 |
Adding a
@return
annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.Please refer to the PHP core documentation on constructors.