| Total Complexity | 7 |
| Total Lines | 36 |
| Duplicated Lines | 0 % |
| Changes | 3 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 12 | class FrontMatter implements Arrayable |
||
| 13 | { |
||
| 14 | public array $matter; |
||
| 15 | |||
| 16 | public function __construct(array $matter = []) |
||
| 17 | { |
||
| 18 | $this->matter = $matter; |
||
| 19 | } |
||
| 20 | |||
| 21 | public function __toString(): string |
||
| 22 | { |
||
| 23 | return (new ConvertsArrayToFrontMatter())->execute($this->matter); |
||
| 24 | } |
||
| 25 | |||
| 26 | public function __get(string $key): mixed |
||
| 27 | { |
||
| 28 | return $this->get($key); |
||
| 29 | } |
||
| 30 | |||
| 31 | public function get(string $key = null, mixed $default = null): mixed |
||
| 32 | { |
||
| 33 | if ($key) { |
||
| 34 | return Arr::get($this->matter, $key, $default); |
||
| 35 | } |
||
| 36 | |||
| 37 | return $this->matter; |
||
| 38 | } |
||
| 39 | |||
| 40 | public function toArray(): array |
||
| 43 | } |
||
| 44 | |||
| 45 | public static function fromArray(array $matter): static |
||
| 48 | } |
||
| 49 | } |
||
| 50 |