TwigRender::getSupport()   A
last analyzed

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 2
1
<?php
2
3
namespace Starkerxp\CampaignBundle\Render;
4
5
use Twig_Environment;
6
7
class TwigRender extends AbstractRender
8
{
9
    /** @var Twig_Environment */
10
    protected $service;
11
12
    public function __construct(Twig_Environment $twigService)
13
    {
14
        $this->service = $twigService;
15
        $this->service->disableStrictVariables();
16
    }
17
18
    public function render()
19
    {
20
        $twigRender = $this->service->createTemplate($this->contenu);
21
        $renderedTmp = $twigRender->render($this->data);
22
        $rendered = str_replace('  ', ' ', str_replace('  ', ' ', str_replace(' , ', ', ', $renderedTmp)));
23
24
        return $rendered;
25
    }
26
27
    public function getSupport($api, $version)
28
    {
29
        return $api == 'twig';
30
    }
31
}
0 ignored issues
show
Coding Style introduced by
As per coding style, files should not end with a newline character.

This check marks files that end in a newline character, i.e. an empy line.

Loading history...
32