1 | <?php |
||
15 | trait FormatsTrends |
||
16 | { |
||
17 | /* ----------------------------------------------------------------- |
||
18 | | Main Methods |
||
19 | | ----------------------------------------------------------------- |
||
20 | */ |
||
21 | |||
22 | /** |
||
23 | * Format aggregate key. |
||
24 | * |
||
25 | * @param \Cake\Chronos\Chronos $date |
||
26 | * @param string $unit |
||
27 | * |
||
28 | * @return string |
||
29 | */ |
||
30 | 36 | protected static function formatAggregateKey(Chronos $date, string $unit): string |
|
52 | |||
53 | /** |
||
54 | * Format the label. |
||
55 | * |
||
56 | * @param \Cake\Chronos\Chronos $date |
||
57 | * @param string $unit |
||
58 | * @param bool $twelveHourTime |
||
59 | * |
||
60 | * @return string |
||
61 | */ |
||
62 | 36 | protected static function formatLabelBy(Chronos $date, string $unit, bool $twelveHourTime = false): string |
|
84 | |||
85 | /* ----------------------------------------------------------------- |
||
86 | | Formatters |
||
87 | | ----------------------------------------------------------------- |
||
88 | */ |
||
89 | |||
90 | /** |
||
91 | * Format the given date by months. |
||
92 | * |
||
93 | * @param \Cake\Chronos\Chronos $date |
||
94 | * |
||
95 | * @return string |
||
96 | */ |
||
97 | 20 | protected static function formatAggregateKeyByMonths(Chronos $date): string |
|
101 | |||
102 | /** |
||
103 | * Format the given date by weeks. |
||
104 | * |
||
105 | * @param \Cake\Chronos\Chronos $date |
||
106 | * |
||
107 | * @return string |
||
108 | */ |
||
109 | 4 | protected static function formatAggregateKeyByWeeks(Chronos $date): string |
|
116 | |||
117 | /** |
||
118 | * Format the given date by days. |
||
119 | * |
||
120 | * @param \Cake\Chronos\Chronos $date |
||
121 | * |
||
122 | * @return string |
||
123 | */ |
||
124 | 8 | protected static function formatAggregateKeyByDays(Chronos $date): string |
|
128 | |||
129 | /** |
||
130 | * Format the given date by hours. |
||
131 | * |
||
132 | * @param \Cake\Chronos\Chronos $date |
||
133 | * |
||
134 | * @return string |
||
135 | */ |
||
136 | 4 | protected static function formatAggregateKeyByHours(Chronos $date): string |
|
140 | |||
141 | /** |
||
142 | * Format the given date by minutes. |
||
143 | * |
||
144 | * @param \Cake\Chronos\Chronos $date |
||
145 | * |
||
146 | * @return string |
||
147 | */ |
||
148 | 4 | protected static function formatAggregateKeyByMinutes(Chronos $date): string |
|
152 | |||
153 | /** |
||
154 | * Get the label by Months. |
||
155 | * |
||
156 | * @param \Cake\Chronos\Chronos $date |
||
157 | * |
||
158 | * @return string |
||
159 | */ |
||
160 | 20 | protected static function formatLabelByMonths(Chronos $date): string |
|
164 | |||
165 | /** |
||
166 | * Get the label by Weeks. |
||
167 | * |
||
168 | * @param \Cake\Chronos\Chronos $date |
||
169 | * |
||
170 | * @return string |
||
171 | */ |
||
172 | 4 | protected static function formatLabelByWeeks(Chronos $date): string |
|
182 | |||
183 | /** |
||
184 | * Get the label by Days. |
||
185 | * |
||
186 | * @param \Cake\Chronos\Chronos $date |
||
187 | * |
||
188 | * @return string |
||
189 | */ |
||
190 | 4 | protected static function formatLabelByDays(Chronos $date): string |
|
194 | |||
195 | /** |
||
196 | * Get the label by Hours. |
||
197 | * |
||
198 | * @param \Cake\Chronos\Chronos $date |
||
199 | * @param bool $twelveHourTime |
||
200 | * |
||
201 | * @return string |
||
202 | */ |
||
203 | 4 | protected static function formatLabelByHours(Chronos $date, bool $twelveHourTime = false): string |
|
211 | |||
212 | /** |
||
213 | * Get the label by Minutes. |
||
214 | * |
||
215 | * @param \Cake\Chronos\Chronos $date |
||
216 | * @param bool $twelveHourTime |
||
217 | * |
||
218 | * @return string |
||
219 | */ |
||
220 | 4 | protected static function formatLabelByMinutes(Chronos $date, bool $twelveHourTime): string |
|
228 | } |
||
229 |
This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.
Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.