ApplePayDirectEnabled   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

Changes 2
Bugs 1 Features 0
Metric Value
eloc 8
c 2
b 1
f 0
dl 0
loc 17
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A getFunctions() 0 7 1
1
<?php
2
3
/*
4
 * This file has been created by developers from BitBag.
5
 * Feel free to contact us once you face any issues or want to start
6
 * You can find more information about us on https://bitbag.io and write us
7
 * an email on [email protected].
8
 */
9
10
declare(strict_types=1);
11
12
namespace BitBag\SyliusMolliePlugin\Twig\Extension;
13
14
use BitBag\SyliusMolliePlugin\Checker\ApplePay\ApplePayEnabledCheckerInterface;
15
use Twig\Extension\AbstractExtension;
16
use Twig\TwigFunction;
17
18
final class ApplePayDirectEnabled extends AbstractExtension
19
{
20
    /** @var ApplePayEnabledCheckerInterface */
21
    private $applePayEnabledChecker;
22
23
    public function __construct(ApplePayEnabledCheckerInterface $applePayEnabledChecker)
24
    {
25
        $this->applePayEnabledChecker = $applePayEnabledChecker;
26
    }
27
28
    public function getFunctions(): array
29
    {
30
        return [
31
            new TwigFunction(
32
                'bitbag_render_apple_pay_direct',
33
                [$this->applePayEnabledChecker, 'isEnabled'],
34
                ['is_safe' => ['html']]
35
            ),
36
        ];
37
    }
38
}
39