Completed
Push — twig-extension-names ( 820c46...236c5c )
by Kamil
45:16 queued 18:47
created

ProvinceNamingExtension::getProvinceName()   A

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
nc 1
cc 1
eloc 2
nop 1
1
<?php
2
3
/*
4
 * This file is part of the Sylius package.
5
 *
6
 * (c) Paweł Jędrzejewski
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Sylius\Bundle\AddressingBundle\Twig;
13
14
use Sylius\Component\Addressing\Model\AddressInterface;
15
use Sylius\Component\Addressing\Provider\ProvinceNamingProviderInterface;
16
17
/**
18
 * @author Jan Góralski <[email protected]>
19
 */
20
class ProvinceNamingExtension extends \Twig_Extension
21
{
22
    /**
23
     * @var ProvinceNamingProviderInterface
24
     */
25
    private $provinceNamingProvider;
26
27
    /**
28
     * @param ProvinceNamingProviderInterface $provinceNamingProvider
29
     */
30
    public function __construct(ProvinceNamingProviderInterface $provinceNamingProvider)
0 ignored issues
show
Comprehensibility Naming introduced by
The variable name $provinceNamingProvider exceeds the maximum configured length of 20.

Very long variable names usually make code harder to read. It is therefore recommended not to make variable names too verbose.

Loading history...
31
    {
32
        $this->provinceNamingProvider = $provinceNamingProvider;
33
    }
34
35
    /**
36
     * {@inheritdoc}
37
     */
38
    public function getFilters()
39
    {
40
        return [
41
            new \Twig_SimpleFilter('sylius_province_name', [$this->provinceNamingProvider, 'getName']),
42
            new \Twig_SimpleFilter('sylius_province_abbreviation', [$this->provinceNamingProvider, 'getAbbreviation']),
43
        ];
44
    }
45
}
46