Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
HasDateString | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
2 | |
100.00% |
1 / 1 |
constructDateString | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
2 |
1 | <?php |
2 | |
3 | namespace Hyde\Framework\Concerns; |
4 | |
5 | use Hyde\Framework\Models\DateString; |
6 | |
7 | /** |
8 | * Create a DateString from a Page model's front matter. |
9 | * |
10 | * @see \Hyde\Framework\Models\DateString |
11 | */ |
12 | trait HasDateString |
13 | { |
14 | public ?DateString $date = null; |
15 | |
16 | /** |
17 | * @throws \Hyde\Framework\Exceptions\CouldNotParseDateStringException |
18 | */ |
19 | public function constructDateString(): void |
20 | { |
21 | if (isset($this->matter['date'])) { |
22 | $this->date = new DateString($this->matter['date']); |
23 | } |
24 | } |
25 | } |