| Total Complexity | 2 |
| Total Lines | 30 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 12 | class DateString implements \Stringable |
||
| 13 | { |
||
| 14 | /** The original date string. */ |
||
| 15 | public string $string; |
||
| 16 | |||
| 17 | /** The parsed date object. */ |
||
| 18 | public DateTime $dateTimeObject; |
||
| 19 | |||
| 20 | /** The machine-readable datetime string. */ |
||
| 21 | public string $datetime; |
||
| 22 | |||
| 23 | /** The human-readable sentence string. */ |
||
| 24 | public string $sentence; |
||
| 25 | |||
| 26 | /** Shorter version of the sentence string. */ |
||
| 27 | public string $short; |
||
| 28 | |||
| 29 | public function __construct(string $string) |
||
| 30 | { |
||
| 31 | $this->string = $string; |
||
| 32 | $this->dateTimeObject = new DateTime($this->string); |
||
| 33 | |||
| 34 | $this->datetime = $this->dateTimeObject->format('c'); |
||
| 35 | $this->sentence = $this->dateTimeObject->format('l M jS, Y, \a\t g:ia'); |
||
| 36 | $this->short = $this->dateTimeObject->format('M jS, Y'); |
||
| 37 | } |
||
| 38 | |||
| 39 | public function __toString(): string |
||
| 42 | } |
||
| 43 | } |
||
| 44 |