TwigRender   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 3
dl 0
loc 25
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A render() 0 8 1
A getSupport() 0 4 1
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