Completed
Push — master ( d11b01...1c170b )
by Daniel
17:01 queued 13:33
created

ContentTypeExtension::renderContent()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
namespace Psi\Bridge\ContentType\Twig;
4
5
use Psi\Component\ContentType\View\View;
6
7
class ContentTypeExtension extends \Twig_Extension
8
{
9
    private $renderer;
10
11
    public function __construct(TwigRenderer $renderer)
12
    {
13
        $this->renderer = $renderer;
14
    }
15
16
    public function getFunctions()
17
    {
18
        return [
19
            new \Twig_SimpleFunction('psi_content_render', [$this, 'renderContent'], ['is_safe' => ['html']]),
20
        ];
21
    }
22
23
    public function renderContent(View $view)
24
    {
25
        return $this->renderer->render($view);
26
    }
27
}
28