Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | n/a |
0 / 0 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
|||
PageDataFactory | n/a |
0 / 0 |
n/a |
0 / 0 |
0 | n/a |
0 / 0 |
|||
toArray | n/a |
0 / 0 |
n/a |
0 / 0 |
0 |
1 | <?php |
2 | |
3 | declare(strict_types=1); |
4 | |
5 | namespace Hyde\Framework\Factories\Concerns; |
6 | |
7 | use Illuminate\Contracts\Support\Arrayable; |
8 | |
9 | /** |
10 | * Streamlines the data dynamic construction specific to a HydePHP page. |
11 | * |
12 | * Simply pass along the data the class needs to run, then access the parsed data using the toArray() method. |
13 | * |
14 | * Commonly, all data can be set using front matter in the page source file. |
15 | * |
16 | * However, as all front matter is optional in Hyde, if no front matter is set for the given key, |
17 | * the factory may attempt to generate and discover the values based on the page's contents, |
18 | * as well as the project's overall configuration. |
19 | * |
20 | * In other words, this is where the magic happens. |
21 | */ |
22 | abstract class PageDataFactory implements Arrayable |
23 | { |
24 | /** |
25 | * The front matter properties supported by this factory. |
26 | * |
27 | * @var array<string, string|array> |
28 | */ |
29 | public const SCHEMA = []; |
30 | |
31 | /** |
32 | * Get the generated data as an associative array. |
33 | * |
34 | * @return array<string, mixed> |
35 | * |
36 | * @codeCoverageIgnore |
37 | */ |
38 | abstract public function toArray(): array; |
39 | } |