CurrencyContext::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * @author Rafał Muszyński <[email protected]>
5
 * @copyright 2015 Sourcefabric z.ú.
6
 * @license http://www.gnu.org/licenses/gpl-3.0.txt
7
 */
8
9
namespace Newscoop\PaywallBundle\Currency\Context;
10
11
use Symfony\Component\HttpFoundation\Session\SessionInterface;
12
13
/**
14
 * Currency Context class.
15
 */
16
class CurrencyContext implements CurrencyContextInterface
17
{
18
    protected $session;
19
20
    /**
21
     * @param SessionInterface $session
22
     */
23
    public function __construct(SessionInterface $session)
24
    {
25
        $this->session = $session;
26
    }
27
28
    /**
29
     * {@inheritdoc}
30
     */
31
    public function getCurrency()
32
    {
33
        return $this->session->get(self::CURRENCY_KEY);
34
    }
35
36
    /**
37
     * {@inheritdoc}
38
     */
39
    public function setCurrency($currency)
40
    {
41
        return $this->session->set(self::CURRENCY_KEY, strtoupper($currency));
42
    }
43
}
44