Completed
Push — dev ( 845ef5...8eacd8 )
by
unknown
02:50
created

DataStorageTrait   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 0
dl 0
loc 29
ccs 0
cts 5
cp 0
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setData() 0 4 1
A getData() 0 4 2
1
<?php
2
3
namespace eXpansion\Framework\Core\Model\Data;
4
5
6
/**
7
 * trait DataStorageTrait
8
 *
9
 * @package eXpansion\Framework\Core\Model\Data;
10
 * @author  oliver de Cramer <[email protected]>
11
 */
12
trait DataStorageTrait
13
{
14
    /** @var  array */
15
    protected $data;
16
17
    /**
18
     * Set a certain data.
19
     *
20
     * @param $key
21
     * @param $value
22
     */
23
    public function setData($key, $value)
24
    {
25
        $this->data[$key] = $value;
26
    }
27
28
    /**
29
     * Get a certain data.
30
     *
31
     * @param      $key
32
     * @param null $default
33
     *
34
     * @return null
35
     */
36
    public function getData($key, $default = null)
37
    {
38
        return isset($this->data[$key]) ? $this->data[$key] : $default;
39
    }
40
}