Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
6 / 6 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
| ComponentExtension | |
100.00% |
6 / 6 |
|
100.00% |
2 / 2 |
2 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getFunctions | |
100.00% |
5 / 5 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | namespace Apie\ApieBundle\Twig; |
| 3 | |
| 4 | use Apie\Common\Wrappers\TemplateRenderFunctions; |
| 5 | use Apie\HtmlBuilders\Factories\FieldDisplayComponentFactory; |
| 6 | use Apie\HtmlBuilders\Interfaces\ComponentRendererInterface; |
| 7 | use Twig\Extension\AbstractExtension; |
| 8 | use Twig\TwigFunction; |
| 9 | |
| 10 | class ComponentExtension extends AbstractExtension |
| 11 | { |
| 12 | use TemplateRenderFunctions; |
| 13 | |
| 14 | public function __construct( |
| 15 | private readonly ComponentRendererInterface $renderer, |
| 16 | private readonly FieldDisplayComponentFactory $fieldDisplayComponentFactory |
| 17 | ) { |
| 18 | } |
| 19 | |
| 20 | public function getFunctions(): array |
| 21 | { |
| 22 | return [ |
| 23 | new TwigFunction('renderApieComponent', [$this, 'renderApieComponent'], ['is_safe' => ['all']]), |
| 24 | new TwigFunction('renderStacktrace', [$this, 'renderStacktrace'], ['is_safe' => ['all']]), |
| 25 | new TwigFunction('renderApieCmsData', [$this, 'renderApieCmsData'], ['is_safe' => ['all']]) |
| 26 | ]; |
| 27 | } |
| 28 | } |