Passed
Push — master ( 99cab5...2782fc )
by Caen
04:06 queued 13s
created

GenerateSearch   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 18
rs 10
c 0
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A handle() 0 6 2
A printFinishMessage() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Hyde\Framework\Actions\PostBuildTasks;
6
7
use Hyde\Framework\Concerns\InteractsWithDirectories;
8
use Hyde\Framework\Features\BuildTasks\PostBuildTask;
9
use Hyde\Framework\Features\Documentation\DocumentationSearchPage;
10
use Hyde\Framework\Services\DocumentationSearchService;
11
12
class GenerateSearch extends PostBuildTask
13
{
14
    use InteractsWithDirectories;
15
16
    public static string $message = 'Generating search index';
17
18
    public function handle(): void
19
    {
20
        DocumentationSearchService::generate();
21
22
        if (DocumentationSearchPage::enabled()) {
23
            $this->createdSiteFile(DocumentationSearchPage::generate());
24
        }
25
    }
26
27
    public function printFinishMessage(): void
28
    {
29
        $this->createdSiteFile(DocumentationSearchService::getFilePath())->withExecutionTime();
30
    }
31
}
32