Completed
Push — master ( 5ff861...d98db0 )
by Kamil
14s
created

ShopperContext   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 72
Duplicated Lines 0 %

Coupling/Cohesion

Components 4
Dependencies 4

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 5
c 1
b 0
f 1
lcom 4
cbo 4
dl 0
loc 72
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 11 1
A getChannel() 0 4 1
A getCurrencyCode() 0 4 1
A getLocaleCode() 0 4 1
A getCustomer() 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\Component\Core\Context;
13
14
use Sylius\Component\Channel\Context\ChannelContextInterface;
15
use Sylius\Component\Currency\Context\CurrencyContextInterface;
16
use Sylius\Component\Locale\Context\LocaleContextInterface;
17
use Sylius\Component\User\Context\CustomerContextInterface;
18
19
/**
20
 * @author Paweł Jędrzejewski <[email protected]>
21
 */
22
final class ShopperContext implements ShopperContextInterface
23
{
24
    /**
25
     * @var ChannelContextInterface
26
     */
27
    private $channelContext;
28
29
    /**
30
     * @var CurrencyContextInterface
31
     */
32
    private $currencyContext;
33
34
    /**
35
     * @var LocaleContextInterface
36
     */
37
    private $localeContext;
38
39
    /**
40
     * @var CustomerContextInterface
41
     */
42
    private $customerContext;
43
44
    /**
45
     * @param ChannelContextInterface $channelContext
46
     * @param CurrencyContextInterface $currencyContext
47
     * @param LocaleContextInterface $localeContext
48
     * @param CustomerContextInterface $customerContext
49
     */
50
    public function __construct(
51
        ChannelContextInterface $channelContext,
52
        CurrencyContextInterface $currencyContext,
53
        LocaleContextInterface $localeContext,
54
        CustomerContextInterface $customerContext
55
    ) {
56
        $this->channelContext = $channelContext;
57
        $this->currencyContext = $currencyContext;
58
        $this->localeContext = $localeContext;
59
        $this->customerContext = $customerContext;
60
    }
61
62
    /**
63
     * {@inheritdoc}
64
     */
65
    public function getChannel()
66
    {
67
        return $this->channelContext->getChannel();
68
    }
69
70
    /**
71
     * {@inheritdoc}
72
     */
73
    public function getCurrencyCode()
74
    {
75
        return $this->currencyContext->getCurrency();
76
    }
77
78
    /**
79
     * {@inheritdoc}
80
     */
81
    public function getLocaleCode()
82
    {
83
        return $this->localeContext->getCurrentLocale();
84
    }
85
86
    /**
87
     * {@inheritdoc}
88
     */
89
    public function getCustomer()
90
    {
91
        return $this->customerContext->getCustomer();
92
    }
93
}
94