1 | <?php |
||
9 | abstract class TimeSpeller |
||
10 | { |
||
11 | const YEAR = 'year'; |
||
12 | const MONTH = 'month'; |
||
13 | const DAY = 'day'; |
||
14 | const HOUR = 'hour'; |
||
15 | const MINUTE = 'minute'; |
||
16 | const SECOND = 'second'; |
||
17 | |||
18 | const AGO = 'ago'; |
||
19 | const IN = 'in'; |
||
20 | |||
21 | const AND_WORD = 'and'; |
||
22 | |||
23 | const JUST_NOW = 'just now'; |
||
24 | |||
25 | const DIRECTION = 1; |
||
26 | const SEPARATE = 2; |
||
27 | |||
28 | /** |
||
29 | * @abstract |
||
30 | * @param int $count |
||
31 | * @param string $unit |
||
32 | * @return string |
||
33 | */ |
||
34 | public static function spellUnit($count, $unit) { |
||
37 | |||
38 | /** |
||
39 | * @param DateInterval $interval |
||
40 | * @param int $options |
||
41 | * @param int $limit |
||
42 | * @return string |
||
43 | */ |
||
44 | 22 | public static function spellInterval(DateInterval $interval, $options = 0, $limit = 0) |
|
86 | |||
87 | /** |
||
88 | * @param int|string|DateTime $dateTime Unix timestamp |
||
89 | * or datetime in strtotime() format |
||
90 | * or DateTime instance |
||
91 | * |
||
92 | * @param int $options |
||
93 | * @param int $limit |
||
94 | * |
||
95 | * @return string |
||
96 | * @throws \Exception |
||
97 | */ |
||
98 | 6 | public static function spellDifference($dateTime, $options = 0, $limit = 0) |
|
111 | } |
||
112 |