| 1 | <?php |
||
| 9 | class Clock |
||
| 10 | { |
||
| 11 | /** |
||
| 12 | * @var \DateTime |
||
| 13 | */ |
||
| 14 | private $currentDate; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * Construct |
||
| 18 | */ |
||
| 19 | public function __construct() |
||
| 23 | |||
| 24 | /** |
||
| 25 | * use given date as mock |
||
| 26 | * |
||
| 27 | * @param string|\DateTime $date |
||
| 28 | */ |
||
| 29 | protected function mock($date) |
||
| 36 | |||
| 37 | /** |
||
| 38 | * return current date |
||
| 39 | * |
||
| 40 | * @param string $format optionnal date format |
||
| 41 | * |
||
| 42 | * @return \DateTime |
||
| 43 | */ |
||
| 44 | public function now($format = null) |
||
| 53 | } |
||
| 54 |