Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
83.33% |
5 / 6 |
|
66.67% |
2 / 3 |
CRAP | |
0.00% |
0 / 1 |
DocumentationPage | |
83.33% |
5 / 6 |
|
66.67% |
2 / 3 |
4.07 | |
0.00% |
0 / 1 |
__construct | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
getCurrentPagePath | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getOnlineSourcePath | |
66.67% |
2 / 3 |
|
0.00% |
0 / 1 |
2.15 |
1 | <?php |
2 | |
3 | namespace Hyde\Framework\Models; |
4 | |
5 | use Hyde\Framework\Concerns\HasTableOfContents; |
6 | use Hyde\Framework\Hyde; |
7 | use Hyde\Framework\Models\Parsers\DocumentationPageParser; |
8 | |
9 | class DocumentationPage extends MarkdownDocument |
10 | { |
11 | use HasTableOfContents; |
12 | |
13 | public static string $sourceDirectory = '_docs'; |
14 | public static string $parserClass = DocumentationPageParser::class; |
15 | |
16 | public function __construct(array $matter, string $body, string $title = '', string $slug = '') |
17 | { |
18 | parent::__construct($matter, $body, $title, $slug); |
19 | |
20 | $this->constructTableOfContents(); |
21 | } |
22 | |
23 | public function getCurrentPagePath(): string |
24 | { |
25 | return trim(Hyde::docsDirectory().'/'.$this->slug, '/'); |
26 | } |
27 | |
28 | /** @internal */ |
29 | public function getOnlineSourcePath(): string|false |
30 | { |
31 | if (config('docs.source_file_location_base', null) === null) { |
32 | return false; |
33 | } |
34 | |
35 | return trim(config('docs.source_file_location_base'), '/').'/'.$this->slug.'.md'; |
36 | } |
37 | } |