MoneyExtension::getFilters()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 9
ccs 6
cts 6
cp 1
rs 9.6666
cc 1
eloc 6
nc 1
nop 0
crap 1
1
<?php
2
3
namespace Ivoba\Money\Twig;
4
5
use Ivoba\Money\Formatter\MoneyFormatter;
6
7
class MoneyExtension extends \Twig_Extension
8
{
9
10
    private $moneyFormatter;
11
12
    /**
13
     * @param MoneyFormatter $moneyFormatter
14
     */
15 3
    public function __construct(MoneyFormatter $moneyFormatter)
16
    {
17 3
        $this->moneyFormatter = $moneyFormatter;
18 3
    }
19
20
    /**
21
     * @return array
22
     */
23 3
    public function getFilters()
24
    {
25
        return [
26 3
            new \Twig_SimpleFilter('money_i18n_format', [$this->moneyFormatter, 'formatI18n']),
27 3
            new \Twig_SimpleFilter('money_i18n_decimal', [$this->moneyFormatter, 'formatI18NDecimal']),
28 3
            new \Twig_SimpleFilter('money_currency_symbol', [$this->moneyFormatter, 'formatCurrencyAsSymbol']),
29 3
            new \Twig_SimpleFilter('money_currency_name', [$this->moneyFormatter, 'formatCurrencyAsName']),
30 1
        ];
31
    }
32
33
    /**
34
     * @return string
35
     */
36 1
    public function getName()
37
    {
38 1
        return 'ivoba_sebastian_money_extension';
39
    }
40
41
}
42