Completed
Branch master (734dbe)
by G
12:13
created

DepositExtension   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 5
c 0
b 0
f 0
dl 0
loc 22
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getFilters() 0 4 1
A __construct() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Gweb\SyliusProductDepositPlugin\Templating\Helper;
6
7
use Symfony\Component\Templating\Helper\Helper;
8
use Twig\Extension\AbstractExtension;
9
use Twig\TwigFilter;
10
11
/**
12
 * Template extension to get deposit fee
13
 *
14
 * @author Gerd Weitenberg <[email protected]>
15
 */
16
class DepositExtension extends AbstractExtension
17
{
18
    /**
19
     * @var Helper
20
     */
21
    private $helper;
22
23
    /**
24
     * @param Helper $helper
25
     */
26
    public function __construct(Helper $helper)
27
    {
28
        $this->helper = $helper;
29
    }
30
31
    /**
32
     * {@inheritdoc}
33
     */
34
    public function getFilters(): array
35
    {
36
        return [
37
          new TwigFilter('gweb_calculate_deposit', [$this->helper, 'getPrice']),
38
        ];
39
    }
40
}
41