MoneyExtension   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 1
cbo 2
dl 0
loc 35
ccs 11
cts 11
cp 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getFilters() 0 9 1
A getName() 0 4 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