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