Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
28.57% |
2 / 7 |
|
33.33% |
1 / 3 |
CRAP | |
0.00% |
0 / 1 |
TemplateRenderFunctions | |
28.57% |
2 / 7 |
|
33.33% |
1 / 3 |
6.28 | |
0.00% |
0 / 1 |
renderApieCmsData | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
2 | |||
renderStacktrace | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
renderApieComponent | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | namespace Apie\Common\Wrappers; |
3 | |
4 | use Apie\Core\Context\ApieContext; |
5 | use Apie\HtmlBuilders\ErrorHandler\StacktraceRenderer; |
6 | use Apie\HtmlBuilders\Interfaces\ComponentInterface; |
7 | use Throwable; |
8 | |
9 | trait TemplateRenderFunctions |
10 | { |
11 | public function renderApieCmsData( |
12 | mixed $input, |
13 | ApieContext $apieContext = new ApieContext() |
14 | ): string { |
15 | return $this->renderApieComponent( |
16 | $this->fieldDisplayComponentFactory->createDisplayFor($input, $apieContext), |
17 | $apieContext |
18 | ); |
19 | } |
20 | |
21 | public function renderStacktrace(Throwable $throwable): string |
22 | { |
23 | $renderer = new StacktraceRenderer($throwable); |
24 | return (string) $renderer; |
25 | } |
26 | |
27 | public function renderApieComponent( |
28 | ComponentInterface $component, |
29 | ApieContext $apieContext = new ApieContext() |
30 | ): string { |
31 | return $this->renderer->render($component, $apieContext); |
32 | } |
33 | } |