Passed
Push — master ( 4e2a61...b4d3e2 )
by Iman
09:39
created

Chain::get()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
namespace Imanghafoori\HeyMan;
4
5
class Chain
6
{
7
    /**
8
     * @var \Imanghafoori\HeyMan\Chain
9
     */
10
    private $chainInfo = [];
11
12
    public function startChain()
13
    {
14
        $this->chainInfo = [];
0 ignored issues
show
Documentation Bug introduced by
It seems like array() of type array is incompatible with the declared type Imanghafoori\HeyMan\Chain of property $chainInfo.

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...
15
    }
16
17
    public function get($key)
18
    {
19
        return $this->chainInfo[$key] ?? null;
20
    }
21
22
    public function set($key, $value)
23
    {
24
        $this->chainInfo[$key] = $value;
25
    }
26
27
    public function push($key, $value)
28
    {
29
        $this->chainInfo[$key][] = $value;
30
    }
31
32
33
    /**
34
     * ViewEventManager constructor.
35
     *
36
     * @param $manager
37
     * @param array  $values
38
     * @param string $param
39
     *
40
     */
41
    public function init($manager, array $values, string $param = 'default')
42
    {
43
        $this->set('manager', $manager);
44
        $this->set('watchedEntities', $values);
45
        $this->set('event', $param);
46
    }
47
}
48