Total Complexity | 4 |
Total Lines | 54 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
12 | class DateHandlerMonth extends DateHandler |
||
13 | { |
||
14 | /** |
||
15 | * Constructor |
||
16 | * |
||
17 | * @param integer $offset Date offset |
||
18 | */ |
||
19 | public function __construct(int $offset) |
||
20 | { |
||
21 | $this->offset = $offset; |
||
22 | } |
||
23 | |||
24 | |||
25 | /** |
||
26 | * @param int $epoch |
||
27 | * @param int $slotsize |
||
28 | * @return int |
||
29 | */ |
||
30 | public function toSlot(int $epoch, int $slotsize): int |
||
36 | } |
||
37 | |||
38 | |||
39 | /** |
||
40 | * @param int $slot |
||
41 | * @param int $slotsize |
||
42 | * @return int |
||
43 | */ |
||
44 | public function fromSlot(int $slot, ?int $slotsize): int |
||
45 | { |
||
46 | Assert::null($slotsize); // Only the upstream DateHandler uses this |
||
47 | |||
48 | $month = ($slot % 12); |
||
49 | $year = 2000 + intval(floor($slot / 12)); |
||
50 | return mktime(0, 0, 0, $month + 1, 1, $year); |
||
51 | } |
||
52 | |||
53 | |||
54 | /** |
||
55 | * @param int $from |
||
56 | * @param int $to |
||
57 | * @param int $slotsize |
||
58 | * @param string $dateformat |
||
59 | * @return string |
||
60 | */ |
||
61 | public function prettyHeader(int $from, int $to, int $slotsize, string $dateformat): string |
||
66 | } |
||
67 | } |
||
68 |