Completed
Push — master ( 0f74a6...eca3e7 )
by Kamil
20:39
created

TaxCalculationStrategy   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
lcom 1
cbo 2
dl 0
loc 27
rs 10
c 1
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A supports() 0 4 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\Taxation\Strategy;
13
14
use Sylius\Bundle\SettingsBundle\Model\SettingsInterface;
15
use Sylius\Component\Addressing\Model\ZoneInterface;
16
use Sylius\Component\Core\Model\OrderInterface;
17
use Sylius\Component\Core\Taxation\Applicator\OrderTaxesApplicatorInterface;
18
use Sylius\Component\Core\Taxation\Strategy\AbstractTaxCalculationStrategy;
19
20
/**
21
 * @author Mark McKelvie <[email protected]>
22
 */
23
class TaxCalculationStrategy extends AbstractTaxCalculationStrategy
24
{
25
    /**
26
     * @var SettingsInterface
27
     */
28
    protected $settings;
29
30
    /**
31
     * @param string $type
32
     * @param OrderTaxesApplicatorInterface[] $applicators
33
     * @param SettingsInterface $settings
34
     */
35
    public function __construct($type, array $applicators, SettingsInterface $settings)
36
    {
37
        parent::__construct($type, $applicators);
38
39
        $this->settings = $settings;
40
    }
41
42
    /**
43
     * {@inheritdoc}
44
     */
45
    public function supports(OrderInterface $order, ZoneInterface $zone)
46
    {
47
        return $this->settings->get('default_tax_calculation_strategy') === $this->type;
48
    }
49
}
50