Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
12 / 12 |
|
100.00% |
4 / 4 |
CRAP | |
100.00% |
1 / 1 |
RendererServiceProvider | |
100.00% |
12 / 12 |
|
100.00% |
4 / 4 |
5 | |
100.00% |
1 / 1 |
register | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
boot | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
2 | |||
registerRenderer | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
1 | |||
registerHtmlEngine | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
1 |
1 | <?php |
2 | |
3 | declare(strict_types=1); |
4 | |
5 | namespace Engelsystem\Renderer; |
6 | |
7 | use Engelsystem\Container\ServiceProvider; |
8 | |
9 | class RendererServiceProvider extends ServiceProvider |
10 | { |
11 | public function register(): void |
12 | { |
13 | $this->registerRenderer(); |
14 | $this->registerHtmlEngine(); |
15 | } |
16 | |
17 | public function boot(): void |
18 | { |
19 | $renderer = $this->app->get('renderer'); |
20 | |
21 | foreach ($this->app->tagged('renderer.engine') as $engine) { |
22 | $renderer->addRenderer($engine); |
23 | } |
24 | } |
25 | |
26 | protected function registerRenderer(): void |
27 | { |
28 | $renderer = $this->app->make(Renderer::class); |
29 | $this->app->instance(Renderer::class, $renderer); |
30 | $this->app->instance('renderer', $renderer); |
31 | } |
32 | |
33 | protected function registerHtmlEngine(): void |
34 | { |
35 | $htmlEngine = $this->app->make(HtmlEngine::class); |
36 | $this->app->instance(HtmlEngine::class, $htmlEngine); |
37 | $this->app->instance('renderer.htmlEngine', $htmlEngine); |
38 | $this->app->tag('renderer.htmlEngine', ['renderer.engine']); |
39 | } |
40 | } |