• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

ICanBoogie / View / 4118689638

pending completion
4118689638

push

github

Olivier Laviale
View overhaul

47 of 47 new or added lines in 5 files covered. (100.0%)

68 of 89 relevant lines covered (76.4%)

1.25 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/lib/ViewProvider/Basic.php
1
<?php
2

3
/*
4
 * This file is part of the ICanBoogie package.
5
 *
6
 * (c) Olivier Laviale <olivier.laviale@gmail.com>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11

12
namespace ICanBoogie\View\ViewProvider;
13

14
use ICanBoogie\Render\Renderer;
15
use ICanBoogie\Routing\ControllerAbstract;
16
use ICanBoogie\Routing\Route;
17
use ICanBoogie\View\LayoutResolver;
18
use ICanBoogie\View\View;
19
use ICanBoogie\View\ViewProvider;
20

21
use function ICanBoogie\emit;
22

23
final class Basic implements ViewProvider
24
{
25
    public function __construct(
26
        private readonly Renderer $renderer,
27
        private readonly LayoutResolver $layout_resolver,
28
    ) {
29
    }
×
30

31
    public function view_for_controller(ControllerAbstract $controller): View
32
    {
33
        $view = new View($this->renderer);
×
34

35
        emit(new View\AlterEvent($view, $controller));
×
36

37
        $route = $controller->route;
×
38
        $view->template ??= $this->resolve_template($route);
×
39
        $view->layout ??= $this->resolve_layout($route);
×
40

41
        return $view;
×
42
    }
43

44
    private function resolve_template(Route $route): string
45
    {
46
        return strtr($route->action, Route::ACTION_SEPARATOR, '/');
×
47
    }
48

49
    private function resolve_layout(Route $route): string
50
    {
51
        return $this->layout_resolver->resolve_layout($route);
×
52
    }
53
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc