Passed
Push — master ( b7dddf...303190 )
by Caen
03:32 queued 13s
created

RendersSearchPage::bootIfNotBooted()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 4
c 1
b 0
f 0
nc 2
nop 0
dl 0
loc 6
rs 10
1
<?php
2
3
namespace Hyde\RealtimeCompiler\Actions;
4
5
use Hyde\Hyde;
6
use Hyde\RealtimeCompiler\Concerns\InteractsWithLaravel;
7
use Illuminate\Support\Facades\Blade;
8
9
class RendersSearchPage
10
{
11
    use InteractsWithLaravel;
12
13
    public function __invoke(): string
14
    {
15
        $this->bootIfNotBooted();
16
17
        return Blade::render(file_get_contents(Hyde::vendorPath('resources/views/pages/documentation-search.blade.php')));
18
    }
19
20
    /**
21
     * @internal
22
     * @codeCoverageIgnore
23
     */
24
    private function bootIfNotBooted(): void
25
    {
26
        try {
27
            Hyde::getInstance();
28
        } catch (\Throwable) {
29
            $this->bootApplication();
30
        }
31
    }
32
}
33