Passed
Push — master ( 32a4a2...da9bd5 )
by Caen
04:12 queued 14s
created

BladePage::toArray()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Hyde\Pages;
6
7
use Hyde\Markdown\Models\FrontMatter;
8
use Hyde\Pages\Concerns\HydePage;
9
use Illuminate\Support\Facades\View;
10
11
/**
12
 * Page class for Blade pages.
13
 *
14
 * Blade pages are stored in the _pages directory and using the .blade.php extension.
15
 * They will be compiled using the Laravel Blade engine the _site/ directory.
16
 *
17
 * @see https://hydephp.com/docs/master/static-pages#creating-blade-pages
18
 * @see https://laravel.com/docs/master/blade
19
 */
20
class BladePage extends HydePage
21
{
22
    public static string $sourceDirectory = '_pages';
23
    public static string $outputDirectory = '';
24
    public static string $fileExtension = '.blade.php';
25
26
    /** @param  string  $identifier The identifier, which also serves as the view key. */
27
    public function __construct(string $identifier = '', FrontMatter|array $matter = [])
28
    {
29
        parent::__construct($identifier, $matter);
30
    }
31
32
    /** @inheritDoc */
33
    public function getBladeView(): string
34
    {
35
        return $this->identifier;
36
    }
37
38
    /** @inheritDoc */
39
    public function compile(): string
40
    {
41
        return View::make($this->getBladeView())->render();
42
    }
43
}
44