| 1 | <?php |
||
| 15 | trait TimeFormatTrait |
||
| 16 | { |
||
| 17 | /** |
||
| 18 | * @var bool|string Custom time format |
||
| 19 | */ |
||
| 20 | private $timeFormat; |
||
| 21 | |||
| 22 | /** |
||
| 23 | * Sets time format. |
||
| 24 | * |
||
| 25 | * Set format string supported by PHP's date() function or set TRUE to get |
||
| 26 | * time as \DateTime object. |
||
| 27 | * |
||
| 28 | * @param bool|string $timeFormat |
||
| 29 | */ |
||
| 30 | public function setTimeFormat($timeFormat) |
||
| 34 | |||
| 35 | /** |
||
| 36 | * Converts time to previously set format. |
||
| 37 | * |
||
| 38 | * @param string $time |
||
| 39 | * |
||
| 40 | * @return \DateTime|string |
||
| 41 | */ |
||
| 42 | public function formatTime($time) |
||
| 56 | } |
||
| 57 |