Completed
Push — master ( 53f387...6a6ffb )
by James
22:06
created

AuraSessionDriver::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
namespace jamesdb\Cart\Storage;
4
5
use Aura\Session\Session;
6
7
class AuraSessionDriver implements StorageInterface
8
{
9
    /**
10
     * @var \Aura\Session\Session
11
     */
12
    protected $session;
13
14
    /**
15
     * Constructor.
16
     *
17
     * @param \Aura\Session\Session $session
18
     */
19
    public function __construct(Session $session)
20
    {
21
        $this->session = $session->getSegment('jamesdb\Cart');
0 ignored issues
show
Documentation Bug introduced by
It seems like $session->getSegment('jamesdb\\Cart') of type object<Aura\Session\Segment> is incompatible with the declared type object<Aura\Session\Session> of property $session.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
22
    }
23
24
    /**
25
     * {@inheritdoc}
26
     */
27
    public function get($identifier)
28
    {
29
        return $this->session->get($identifier);
0 ignored issues
show
Bug introduced by
The method get() does not seem to exist on object<Aura\Session\Session>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
30
    }
31
32
    /**
33
     * {@inheritdoc}
34
     */
35
    public function store($identifier, $data)
36
    {
37
        $this->session->set($identifier, $data);
0 ignored issues
show
Bug introduced by
The method set() does not seem to exist on object<Aura\Session\Session>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
38
    }
39
40
    /**
41
     * {@inheritdoc}
42
     */
43
    public function clear($identifier)
44
    {
45
        $this->session->clear();
46
    }
47
}
48