Completed
Pull Request — master (#21)
by Aivis
08:26
created

DataCollector::getByKey()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 3
nc 2
nop 1
1
<?php namespace Understand\UnderstandLaravel5;
2
3
class DataCollector
4
{
5
6
    /**
7
     * Current token
8
     *
9
     * @var type
10
     */
11
    protected $data = [];
12
13
    /**
14
     * @param $key
15
     * @param $value
16
     */
17
    public function set($key, $value)
18
    {
19
        $this->data[$key] = $value;
20
    }
21
22
    /**
23
     * @param $key
24
     * @param $value
25
     */
26
    public function setInArray($key, $value)
27
    {
28
        $this->data[$key][] = $value;
29
    }
30
31
    /**
32
     * @param $key
33
     * @return mixed
34
     */
35
    public function getByKey($key)
36
    {
37
        if (isset($this->data[$key]))
38
        {
39
            return $this->data[$key];
40
        }
41
    }
42
}
43