Passed
Push — master ( 9d9530...9d60e1 )
by G
07:54
created

ProductVariantsDepositExtension   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 23
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getFunctions() 0 5 1
A __construct() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Gewebe\SyliusProductDepositPlugin\Templating\Helper;
6
7
use Twig\Extension\AbstractExtension;
8
use Twig\TwigFunction;
9
10
/**
11
 * Template extension to show product variant deposit price
12
 */
13
final class ProductVariantsDepositExtension extends AbstractExtension
14
{
15
    /**
16
     * @var ProductVariantsDepositHelper
17
     */
18
    private $productVariantsDepositHelper;
19
20
    /**
21
     * @param ProductVariantsDepositHelper $productVariantsDepositHelper
22
     */
23
    public function __construct(ProductVariantsDepositHelper $productVariantsDepositHelper)
24
    {
25
        $this->productVariantsDepositHelper = $productVariantsDepositHelper;
26
    }
27
28
    /**
29
     * {@inheritdoc}
30
     */
31
    public function getFunctions(): array
32
    {
33
        return [
34
            new TwigFunction('gewebe_calculate_deposit', [$this->productVariantsDepositHelper, 'getDeposit']),
35
            new TwigFunction('gewebe_product_variant_deposit', [$this->productVariantsDepositHelper, 'getDepositsByProduct']),
36
        ];
37
    }
38
}
39