Completed
Push — currency-cookie ( 346dee...14f9d4 )
by Kamil
20:35
created

SessionStorage   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 55
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 6
lcom 1
cbo 1
dl 0
loc 55
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A has() 0 4 1
A get() 0 4 1
A set() 0 4 1
A remove() 0 4 1
A all() 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\ResourceBundle\Storage;
13
14
use Symfony\Component\HttpFoundation\Session\SessionInterface;
15
16
/**
17
 * @author Kamil Kokot <[email protected]>
18
 */
19
final class SessionStorage implements StorageInterface
20
{
21
    /**
22
     * @var SessionInterface
23
     */
24
    private $session;
25
26
    /**
27
     * @param SessionInterface $session
28
     */
29
    public function __construct(SessionInterface $session)
30
    {
31
        $this->session = $session;
32
    }
33
34
    /**
35
     * {@inheritdoc}
36
     */
37
    public function has($name)
38
    {
39
        return $this->session->has($name);
40
    }
41
42
    /**
43
     * {@inheritdoc}
44
     */
45
    public function get($name, $default = null)
46
    {
47
        return $this->session->get($name, $default);
48
    }
49
50
    /**
51
     * {@inheritdoc}
52
     */
53
    public function set($name, $value)
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
54
    {
55
        return $this->session->set($name, $value);
56
    }
57
58
    /**
59
     * {@inheritdoc}
60
     */
61
    public function remove($name)
62
    {
63
        $this->session->remove($name);
64
    }
65
66
    /**
67
     * {@inheritdoc}
68
     */
69
    public function all()
70
    {
71
        return $this->session->all();
72
    }
73
}
74