Total Complexity | 4 |
Total Lines | 35 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
16 | trait InteractsWithFrontMatter |
||
17 | { |
||
18 | /** |
||
19 | * Get a value from the computed page data, or fallback to the page's front matter, then to the default value. |
||
20 | * |
||
21 | * @return \Hyde\Markdown\Models\FrontMatter|mixed |
||
22 | */ |
||
23 | public function data(?string $key = null, mixed $default = null): mixed |
||
24 | { |
||
25 | return Arr::get(array_filter(array_merge( |
||
26 | $this->matter->toArray(), |
||
27 | (array) $this, |
||
28 | )), $key, $default); |
||
29 | } |
||
30 | |||
31 | /** |
||
32 | * Get the front matter object, or a value from within. |
||
33 | * |
||
34 | * @return \Hyde\Markdown\Models\FrontMatter|mixed |
||
35 | */ |
||
36 | public function matter(?string $key = null, mixed $default = null): mixed |
||
43 | } |
||
44 | |||
45 | /** |
||
46 | * See if a value exists in the computed page data or the front matter. |
||
47 | */ |
||
48 | public function has(string $key): bool |
||
53 |