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

ProductVariantsDepositExtension::getFunctions()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 5
rs 10
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