Completed
Pull Request — master (#24)
by Rafał
03:08
created

PaymentMethodContext   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getMethod() 0 4 1
A setMethod() 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
namespace Newscoop\PaywallBundle\Services;
9
10
use Symfony\Component\HttpFoundation\Session\SessionInterface;
11
12
/**
13
 * Payment Context class.
14
 */
15
class PaymentMethodContext implements PaymentMethodInterface
16
{
17
    protected $session;
18
19
    /**
20
     * @param SessionInterface $session
21
     */
22
    public function __construct(SessionInterface $session)
23
    {
24
        $this->session = $session;
25
    }
26
27
    /**
28
     * {@inheritdoc}
29
     */
30
    public function getMethod()
31
    {
32
        return $this->session->get(self::METHOD_KEY);
33
    }
34
35
    /**
36
     * {@inheritdoc}
37
     */
38
    public function setMethod($method = null)
39
    {
40
        return $this->session->set(self::METHOD_KEY, $method);
41
    }
42
}
43