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

DataStorageTrait::getData()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
c 0
b 0
f 0
cc 2
eloc 2
nc 2
nop 2
crap 6
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
}