Total Complexity | 4 |
Total Lines | 33 |
Duplicated Lines | 0 % |
Changes | 4 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
15 | class SourceFile extends ProjectFile |
||
16 | { |
||
17 | /** |
||
18 | * The associated page class string. |
||
19 | * |
||
20 | * @var class-string<\Hyde\Pages\Concerns\HydePage> |
||
|
|||
21 | */ |
||
22 | public readonly string $model; |
||
23 | |||
24 | /** @param class-string<\Hyde\Pages\Concerns\HydePage> $pageClass */ |
||
25 | public static function make(string $path, string $pageClass = HydePage::class): static |
||
26 | { |
||
27 | return new static($path, $pageClass); |
||
28 | } |
||
29 | |||
30 | /** @param class-string<\Hyde\Pages\Concerns\HydePage> $pageClass */ |
||
31 | public function __construct(string $path, string $pageClass = HydePage::class) |
||
32 | { |
||
33 | parent::__construct($path); |
||
34 | $this->model = $pageClass; |
||
35 | } |
||
36 | |||
37 | public function toArray(): array |
||
38 | { |
||
39 | return array_merge(parent::toArray(), [ |
||
40 | 'model' => $this->model, |
||
41 | ]); |
||
42 | } |
||
43 | |||
44 | public function withoutDirectoryPrefix(): string |
||
48 | } |
||
49 | } |
||
50 |