1 | <?php namespace Arcanedev\LaravelMetrics\Helpers; |
||
14 | class TrendDatePeriod |
||
15 | { |
||
16 | /* ----------------------------------------------------------------- |
||
17 | | Main Methods |
||
18 | | ----------------------------------------------------------------- |
||
19 | */ |
||
20 | |||
21 | /** |
||
22 | * Make date period (range) for the trend metric. |
||
23 | * |
||
24 | * @param \Cake\Chronos\Chronos $start |
||
25 | * @param \Cake\Chronos\Chronos $end |
||
26 | * @param string $unit |
||
27 | * @param mixed|null $timezone |
||
28 | * |
||
29 | * @return \Illuminate\Support\Collection |
||
30 | */ |
||
31 | 36 | public static function make(Chronos $start, Chronos $end, string $unit, $timezone = null) |
|
52 | |||
53 | /** |
||
54 | * Get the starting date. |
||
55 | * |
||
56 | * @param string $unit |
||
57 | * @param mixed|null $range |
||
58 | * |
||
59 | * @return \Cake\Chronos\Chronos |
||
60 | */ |
||
61 | 36 | public static function getStartingDate(string $unit, $range = null): Chronos |
|
90 | |||
91 | /* ----------------------------------------------------------------- |
||
92 | | Other Methods |
||
93 | | ----------------------------------------------------------------- |
||
94 | */ |
||
95 | |||
96 | /** |
||
97 | * Get next date. |
||
98 | * |
||
99 | * @param string $unit |
||
100 | * @param \Cake\Chronos\Chronos $next |
||
101 | * |
||
102 | * @return \Cake\Chronos\Chronos |
||
103 | */ |
||
104 | 36 | private static function getNextDate(string $unit, Chronos $next): Chronos |
|
126 | } |
||
127 |
Let’s assume you have a class which uses late-static binding:
}
The code above will run fine in your PHP runtime. However, if you now create a sub-class and call the
getSomeVariable()
on that sub-class, you will receive a runtime error:In the case above, it makes sense to update
SomeClass
to useself
instead: