AuraSessionDriver   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 1
dl 0
loc 41
ccs 11
cts 11
cp 1
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A get() 0 4 1
A store() 0 4 1
A clear() 0 4 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 6
    public function __construct(Session $session)
20
    {
21 6
        $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 6
    }
23
24
    /**
25
     * {@inheritdoc}
26
     */
27 6
    public function get($identifier)
28
    {
29 6
        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 6
    public function store($identifier, $data)
36
    {
37 6
        $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 6
    }
39
40
    /**
41
     * {@inheritdoc}
42
     */
43 3
    public function clear($identifier)
44
    {
45 3
        $this->session->clear();
46 3
    }
47
}
48