Passed
Push — master ( ad6b2a...b41ca0 )
by Caen
07:45 queued 14s
created

DocumentationSearchIndex   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 20
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A compile() 0 3 1
A outputPath() 0 3 1
A __construct() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Hyde\Framework\Features\Documentation;
6
7
use Hyde\Pages\InMemoryPage;
8
use Hyde\Pages\DocumentationPage;
9
use Hyde\Support\Models\RouteKey;
10
use Hyde\Framework\Actions\GeneratesDocumentationSearchIndex;
11
12
/**
13
 * @internal This page is used to render the search index for the documentation.
14
 */
15
class DocumentationSearchIndex extends InMemoryPage
16
{
17
    /**
18
     * Create a new DocumentationSearchPage instance.
19
     */
20
    public function __construct()
21
    {
22
        parent::__construct(DocumentationSearchIndex::outputPath(), [
23
            'navigation' => ['hidden' => true],
24
        ]);
25
    }
26
27
    public function compile(): string
28
    {
29
        return GeneratesDocumentationSearchIndex::handle();
30
    }
31
32
    public static function outputPath(string $identifier = ''): string
33
    {
34
        return RouteKey::fromPage(DocumentationPage::class, 'search').'.json';
35
    }
36
}
37