Completed
Push — development ( ef9e73...b2c3e4 )
by Andrij
20:27
created

TwigExtension::getFunctions()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 5
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 7
rs 9.4285
1
<?php namespace CMSFactory\Templating\Twig\Extension;
2
3
use CMSFactory\Services\Morphy\Morphy;
4
use Twig_Extension;
5
6
class TwigExtension extends Twig_Extension
7
{
0 ignored issues
show
introduced by
Opening brace of a class must be on the same line as the definition
Loading history...
8
9
    private $morphy;
10
11
    public function __construct(Morphy $morphy) {
12
        $this->morphy = $morphy;
13
    }
14
15
    public function getFilters() {
16
        return [
17
                new \Twig_SimpleFilter('translit', 'translit'),
18
                new \Twig_SimpleFilter('morphy', [$this->morphy, 'morphy']),
19
                new \Twig_SimpleFilter('dump', 'dump'),
20
                new \Twig_SimpleFilter('dd', 'dd'),
21
                new \Twig_SimpleFilter('lang', 'lang'),
22
               ];
23
    }
24
25
    public function getFunctions() {
26
        return [
27
                new \Twig_SimpleFunction('dump', 'dump'),
28
                new \Twig_SimpleFunction('dd', 'dd'),
29
                new \Twig_SimpleFunction('lang', 'lang'),
30
               ];
31
    }
32
33
    /**
34
     * Returns the name of the extension.
35
     *
36
     * @return string The extension name
37
     */
38
    public function getName() {
39
        return 'icms';
40
    }
41
}