Completed
Push — master ( 160801...bd59d4 )
by Andreas
27:08
created

nullcontainer::set_value()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
ccs 0
cts 2
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * @copyright CONTENT CONTROL GmbH, http://www.contentcontrol-berlin.de
4
 */
5
6
namespace midcom\datamanager\storage\container;
7
8
use midcom\datamanager\storage\transientnode;
9
use midcom\datamanager\schema;
10
11
/**
12
 * Experimental storage class
13
 */
14
class nullcontainer extends container
15
{
16
    /**
17
     *
18
     * @var mixed
19
     */
20
    protected $value;
21
22 12
    public function __construct(schema $schema, array $defaults)
23
    {
24 12
        $this->schema = $schema;
25
26 12
        foreach ($this->schema->get('fields') as $name => $config) {
27 10
            if (array_key_exists($name, $defaults)) {
28 7
                $config['default'] = $defaults[$name];
29
            }
30 10
            $config['name'] = $name;
31 10
            $this->fields[$name] = new transientnode($config);
32 10
            if (isset($config['default'])) {
33 10
                $this->fields[$name]->set_value($config['default']);
34
            }
35
        }
36 12
    }
37
38 11
    public function lock() : bool
39
    {
40 11
        return true;
41
    }
42
43 3
    public function unlock() : bool
44
    {
45 3
        return true;
46
    }
47
48 11
    public function is_locked() : bool
49
    {
50 11
        return false;
51
    }
52
53
    public function set_value($value)
54
    {
55
        $this->value = $value;
56
    }
57
58
    public function get_value()
59
    {
60
        return $this->value;
61
    }
62
63 2
    public function save()
64
    {
65 2
    }
66
}
67