| 1 | <?php |
||
| 9 | final class Timestamp implements ValueObjectInterface |
||
| 10 | { |
||
| 11 | /** |
||
| 12 | * @var string |
||
| 13 | */ |
||
| 14 | public const NATIVE_FORMAT = "Y-m-d\\TH:i:s.uP"; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * @var null |
||
| 18 | */ |
||
| 19 | private const NIL = null; |
||
| 20 | |||
| 21 | /** |
||
| 22 | * @var DateTimeImmutable|null |
||
| 23 | */ |
||
| 24 | private $value; |
||
| 25 | |||
| 26 | public static function now(): self |
||
| 30 | |||
| 31 | 16 | public static function createFromString(string $date, string $format = self::NATIVE_FORMAT): self |
|
| 36 | |||
| 37 | /** |
||
| 38 | * @param string|null $nativeValue |
||
| 39 | * @return self |
||
| 40 | */ |
||
| 41 | 16 | public static function fromNative($nativeValue): self |
|
| 46 | |||
| 47 | 4 | public function toNative(): ?string |
|
| 51 | |||
| 52 | 1 | public function equals(ValueObjectInterface $otherValue): bool |
|
| 56 | |||
| 57 | 1 | public function __toString(): string |
|
| 61 | |||
| 62 | 16 | private function __construct(DateTimeImmutable $value = null) |
|
| 66 | } |
||
| 67 |