Total Complexity | 5 |
Total Lines | 52 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
16 | class Date |
||
17 | { |
||
18 | /** |
||
19 | * Create an interval of dates from two integers and a value. |
||
20 | * |
||
21 | * @param $start |
||
22 | * @param $end |
||
23 | * @param mixed $value |
||
24 | * @return array |
||
25 | */ |
||
26 | public static function intv(int $start, int $end, $value = null) |
||
27 | { |
||
28 | try { |
||
29 | $start = new DateTime("today + $start days"); |
||
30 | $end = (new DateTime("today + $end days"))->setTime(23,59,59); |
||
31 | } catch (Exception $e) {} |
||
|
|||
32 | |||
33 | return [$start, $end, $value]; |
||
34 | } |
||
35 | |||
36 | /** |
||
37 | * Create an IntervalGraph for handling dates. |
||
38 | * |
||
39 | * @param $args |
||
40 | * @return IntervalGraph |
||
41 | */ |
||
42 | public static function intvg($args) { |
||
53 | } |
||
54 | |||
55 | /** |
||
56 | * Generate a random date. |
||
57 | * |
||
58 | * @param int $min |
||
59 | * @param int $max |
||
60 | * @return DateTime |
||
61 | */ |
||
62 | public static function rdm($min = 1514764800, $max = 1577750400) |
||
70 | } |