Completed
Push — master ( ab7347...117100 )
by Paweł
17:01 queued 07:09
created

CheckoutStepsHelper::isPaymentRequired()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
/*
4
 * This file is part of the Sylius package.
5
 *
6
 * (c) Paweł Jędrzejewski
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Sylius\Bundle\CoreBundle\Templating\Helper;
13
14
use Sylius\Component\Core\Checker\OrderPaymentMethodSelectionRequirementCheckerInterface;
15
use Sylius\Component\Core\Checker\OrderShippingMethodSelectionRequirementCheckerInterface;
16
use Sylius\Component\Core\Model\OrderInterface;
17
use Symfony\Component\Templating\Helper\Helper;
18
19
/**
20
 * @author Mateusz Zalewski <[email protected]>
21
 */
22
class CheckoutStepsHelper extends Helper
23
{
24
    /**
25
     * @var OrderPaymentMethodSelectionRequirementCheckerInterface
26
     */
27
    private $orderPaymentMethodSelectionRequirementChecker;
28
29
    /**
30
     * @var OrderShippingMethodSelectionRequirementCheckerInterface
31
     */
32
    private $orderShippingMethodSelectionRequirementChecker;
33
34
    /**
35
     * @param OrderPaymentMethodSelectionRequirementCheckerInterface $orderPaymentMethodSelectionRequirementChecker
36
     * @param OrderShippingMethodSelectionRequirementCheckerInterface $orderShippingMethodSelectionRequirementChecker
37
     */
38
    public function __construct(
39
        OrderPaymentMethodSelectionRequirementCheckerInterface $orderPaymentMethodSelectionRequirementChecker,
40
        OrderShippingMethodSelectionRequirementCheckerInterface $orderShippingMethodSelectionRequirementChecker
41
    ) {
42
        $this->orderPaymentMethodSelectionRequirementChecker = $orderPaymentMethodSelectionRequirementChecker;
43
        $this->orderShippingMethodSelectionRequirementChecker = $orderShippingMethodSelectionRequirementChecker;
44
    }
45
46
    /**
47
     * @param OrderInterface $order
48
     *
49
     * @return bool
50
     */
51
    public function isShippingRequired(OrderInterface $order)
52
    {
53
        return $this->orderShippingMethodSelectionRequirementChecker->isShippingMethodSelectionRequired($order);
54
    }
55
56
    /**
57
     * @param OrderInterface $order
58
     *
59
     * @return bool
60
     */
61
    public function isPaymentRequired(OrderInterface $order)
62
    {
63
        return $this->orderPaymentMethodSelectionRequirementChecker->isPaymentMethodSelectionRequired($order);
64
    }
65
66
    /**
67
     * {@inheritdoc}
68
     */
69
    public function getName()
70
    {
71
        return 'sylius_checkout_steps';
72
    }
73
}
74