Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
4 / 4 |
|
100.00% |
3 / 3 |
CRAP | |
100.00% |
1 / 1 |
| BladePage | |
100.00% |
4 / 4 |
|
100.00% |
3 / 3 |
3 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| get | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getCurrentPagePath | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace Hyde\Framework\Models; |
| 4 | |
| 5 | use Hyde\Framework\Contracts\AbstractPage; |
| 6 | |
| 7 | /** |
| 8 | * A basic wrapper for the custom Blade View compiler. |
| 9 | */ |
| 10 | class BladePage extends AbstractPage |
| 11 | { |
| 12 | /** |
| 13 | * The name of the Blade View to compile. |
| 14 | * |
| 15 | * @var string |
| 16 | * |
| 17 | * Must be a top level file relative to |
| 18 | * resources\views\pages\ and ending |
| 19 | * in .blade.php to be compiled. |
| 20 | */ |
| 21 | public string $view; |
| 22 | |
| 23 | /** |
| 24 | * The page slug for compatibility. |
| 25 | * |
| 26 | * @var string |
| 27 | */ |
| 28 | public string $slug; |
| 29 | |
| 30 | /** |
| 31 | * @param string $view |
| 32 | */ |
| 33 | public function __construct(string $view) |
| 34 | { |
| 35 | $this->view = $view; |
| 36 | $this->slug = $view; |
| 37 | } |
| 38 | |
| 39 | public static string $sourceDirectory = '_pages'; |
| 40 | public static string $fileExtension = '.blade.php'; |
| 41 | public static string $parserClass = self::class; |
| 42 | |
| 43 | /** |
| 44 | * Since this model also acts as a Blade View compiler, |
| 45 | * we implement the get method for compatability. |
| 46 | */ |
| 47 | public function get(): BladePage |
| 48 | { |
| 49 | return $this; |
| 50 | } |
| 51 | |
| 52 | public function getCurrentPagePath(): string |
| 53 | { |
| 54 | return $this->view; |
| 55 | } |
| 56 | } |