CurrencyContext   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 28
rs 10
c 0
b 0
f 0
wmc 3
lcom 1
cbo 1

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getCurrency() 0 4 1
A setCurrency() 0 4 1
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