Completed
Push — master ( 925ecf...691399 )
by Aivis
08:17 queued 02:32
created

DataCollector   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 0
dl 0
loc 40
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A set() 0 4 1
A setInArray() 0 4 1
A getByKey() 0 7 2
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