| Conditions | 4 |
| Paths | 2 |
| Total Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 17 | function smarty_modifier_date($input) |
||
|
|
|||
| 18 | { |
||
| 19 | if (gettype($input) === 'object' |
||
| 20 | && (get_class($input) === DateTime::class || get_class($input) === DateTimeImmutable::class) |
||
| 21 | ) { |
||
| 22 | /** @var $date DateTime|DateTimeImmutable */ |
||
| 23 | $date = $input; |
||
| 24 | $dateString = $date->format('Y-m-d H:i:s'); |
||
| 25 | |||
| 26 | return $dateString; |
||
| 27 | } |
||
| 28 | else { |
||
| 29 | return $input; |
||
| 30 | } |
||
| 31 | } |
||