1 | <?php |
||
9 | class WeekInterval |
||
10 | { |
||
11 | /** |
||
12 | * @var DateTime $startDate |
||
13 | */ |
||
14 | private $startDate; |
||
15 | |||
16 | /** |
||
17 | * @var DateTime $endDate |
||
18 | */ |
||
19 | private $endDate; |
||
20 | |||
21 | /** |
||
22 | * @var DatesConfig $config |
||
23 | */ |
||
24 | private $config; |
||
25 | |||
26 | /** |
||
27 | * WeekInterval constructor. |
||
28 | * |
||
29 | * @param DateTime $startDate |
||
30 | * @param DateTime $endDate |
||
31 | * @param DatesConfig $config |
||
32 | */ |
||
33 | 6 | public function __construct(DateTime $startDate, DateTime $endDate, DatesConfig $config) |
|
39 | |||
40 | /** |
||
41 | * @return DateTime |
||
42 | */ |
||
43 | public function getStartDate(): DateTime |
||
47 | |||
48 | /** |
||
49 | * @return DateTime |
||
50 | */ |
||
51 | public function getEndDate(): DateTime |
||
55 | |||
56 | /** |
||
57 | * @return int |
||
58 | */ |
||
59 | 6 | public function getBusinessDays(): int |
|
63 | |||
64 | /** |
||
65 | * @return int |
||
66 | */ |
||
67 | 6 | public function getTotalDays(): int |
|
71 | |||
72 | /** |
||
73 | * @return string |
||
74 | */ |
||
75 | public function getWeekNumber(): string |
||
79 | |||
80 | /** |
||
81 | * @return string |
||
82 | */ |
||
83 | public function getYearWeek(): string |
||
87 | |||
88 | /** |
||
89 | * @return string |
||
90 | */ |
||
91 | public function getYearMonth(): string |
||
95 | |||
96 | 6 | private function countBusinessDays() |
|
111 | |||
112 | /** |
||
113 | * @param DayNumber $day |
||
114 | * @return bool |
||
115 | */ |
||
116 | 6 | private function isBusinessDay(DayNumber $day) |
|
126 | |||
127 | /** |
||
128 | * @param DateTime $day |
||
129 | * @return bool|DayNumber |
||
130 | */ |
||
131 | 6 | private function makeDayNumber(DateTime $day) |
|
142 | |||
143 | /** |
||
144 | * @param DateTime $date |
||
145 | * @return DateTime |
||
146 | * @throws Exception |
||
147 | */ |
||
148 | 6 | private function incrementDay(DateTime $date) |
|
165 | } |
||
166 |
This check looks at variables that are passed out again to other methods.
If the outgoing method call has stricter type requirements than the method itself, an issue is raised.
An additional type check may prevent trouble.