Completed
Push — master ( 35f668...d57f4e )
by G
03:55
created

ProductVariantsDepositExtension   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 23
rs 10
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 Gweb\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
 * @author Gerd Weitenberg <[email protected]>
14
 */
15
final class ProductVariantsDepositExtension extends AbstractExtension
16
{
17
    /**
18
     * @var ProductVariantsDepositHelper
19
     */
20
    private $helproductVariantsDepositHelperer;
21
22
    /**
23
     * @param ProductVariantsDepositHelper $productVariantsDepositHelper
24
     */
25
    public function __construct(ProductVariantsDepositHelper $productVariantsDepositHelper)
26
    {
27
        $this->helproductVariantsDepositHelperer = $productVariantsDepositHelper;
28
    }
29
30
    /**
31
     * {@inheritdoc}
32
     */
33
    public function getFunctions(): array
34
    {
35
        return [
36
            new TwigFunction('gweb_calculate_deposit', [$this->helproductVariantsDepositHelperer, 'getDeposit']),
37
            new TwigFunction('gweb_product_variant_deposit', [$this->helproductVariantsDepositHelperer, 'getDepositsByProduct']),
38
        ];
39
    }
40
}
41