TypographTwigExtension::applyTypograph()   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 Fenrizbes\TypographBundle\Twig;
4
5
use Fenrizbes\TypographBundle\Service\TypographService;
6
7
class TypographTwigExtension extends \Twig_Extension
8
{
9
    protected $typograph;
10
11
    public function __construct(TypographService $typograph)
12
    {
13
        $this->typograph = $typograph;
14
    }
15
16
    public function getName()
17
    {
18
        return 'FenrizbesTypograph';
19
    }
20
21
    public function getFilters()
22
    {
23
        return array(
24
            new \Twig_SimpleFilter('typograph', array($this, 'applyTypograph'), array('is_safe' => array('html')))
25
        );
26
    }
27
28
    public function applyTypograph($string, $config = null)
29
    {
30
        return $this->typograph->apply($string, $config);
31
    }
32
}