Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
4 / 4 |
|
100.00% |
4 / 4 |
CRAP | |
100.00% |
1 / 1 |
| ManagesViewData | |
100.00% |
4 / 4 |
|
100.00% |
4 / 4 |
4 | |
100.00% |
1 / 1 |
| shareViewData | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| currentRouteKey | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| currentRoute | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| currentPage | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace Hyde\Foundation\Concerns; |
| 6 | |
| 7 | use Hyde\Pages\Concerns\HydePage; |
| 8 | use Hyde\Support\Facades\Render; |
| 9 | use Hyde\Support\Models\Route; |
| 10 | |
| 11 | /** |
| 12 | * @internal Single-use trait for the HydeKernel class. |
| 13 | * |
| 14 | * @see \Hyde\Foundation\HydeKernel |
| 15 | */ |
| 16 | trait ManagesViewData |
| 17 | { |
| 18 | /** |
| 19 | * Share data for the page being rendered. |
| 20 | */ |
| 21 | public function shareViewData(HydePage $page): void |
| 22 | { |
| 23 | Render::setPage($page); |
| 24 | } |
| 25 | |
| 26 | /** |
| 27 | * Get the route key for the page being rendered. |
| 28 | */ |
| 29 | public function currentRouteKey(): ?string |
| 30 | { |
| 31 | return Render::getRouteKey(); |
| 32 | } |
| 33 | |
| 34 | /** |
| 35 | * Get the route for the page being rendered. |
| 36 | */ |
| 37 | public function currentRoute(): ?Route |
| 38 | { |
| 39 | return Render::getRoute(); |
| 40 | } |
| 41 | |
| 42 | /** |
| 43 | * Get the page being rendered. |
| 44 | */ |
| 45 | public function currentPage(): ?HydePage |
| 46 | { |
| 47 | return Render::getPage(); |
| 48 | } |
| 49 | } |