MemoryObject::set()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 2
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Ffcms\Core\Cache;
4
5
use Ffcms\Core\Traits\Singleton;
6
7
/**
8
 * Class MemoryObject. Simple singleton-type of magic __set and __get class to store any objects in memory (get and set)
9
 * @package Ffcms\Core\Cache
10
 */
11
class MemoryObject
12
{
13
    use Singleton;
14
15
    protected $data;
16
17
    /**
18
     * Set data to store
19
     * @param string $key
20
     * @param mixed $value
21
     */
22
    public function set($key, $value)
23
    {
24
        $this->data[$key] = $value;
25
    }
26
27
    /**
28
     * Get stored data
29
     * @param string $key
30
     * @return mixed
31
     */
32
    public function get($key)
33
    {
34
        return isset($this->data[$key]) ? $this->data[$key] : null;
35
    }
36
}
37