| 1 | <?php |
||
| 13 | class TimeParser |
||
| 14 | { |
||
| 15 | |||
| 16 | /** |
||
| 17 | * @var integer[] |
||
| 18 | */ |
||
| 19 | private $timeModifier = [ |
||
| 20 | 's' => 1, |
||
| 21 | 'm' => 60, |
||
| 22 | 'h' => 3600, |
||
| 23 | 'd' => 86400, |
||
| 24 | 'w' => 604800, |
||
| 25 | 'y' => 31536000, |
||
| 26 | ]; |
||
| 27 | |||
| 28 | /** |
||
| 29 | * @param string $string |
||
| 30 | * @throws UserException |
||
| 31 | * @return int |
||
| 32 | */ |
||
| 33 | 10 | public function parseString(string $string) |
|
| 53 | |||
| 54 | /** |
||
| 55 | * @param array $matches |
||
| 56 | * @param int $now |
||
| 57 | * @return int |
||
| 58 | * @throws UserException |
||
| 59 | */ |
||
| 60 | 5 | protected function withModifier(array $matches, int $now) |
|
| 69 | } |
||
| 70 |