Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
3 / 3
CRAP
100.00% covered (success)
100.00%
1 / 1
BladePage
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
3 / 3
3
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getBladeView
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 compile
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3declare(strict_types=1);
4
5namespace Hyde\Pages;
6
7use Hyde\Markdown\Models\FrontMatter;
8use Hyde\Pages\Concerns\HydePage;
9use 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 to the _site/ directory.
16 *
17 * @see https://hydephp.com/docs/1.x/static-pages#creating-blade-pages
18 * @see https://laravel.com/docs/1.x/blade
19 */
20class 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}