ArrayConfig::assign()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
c 0
b 0
f 0
ccs 3
cts 3
cp 1
rs 10
cc 1
nc 1
nop 1
crap 1
1
<?php
2
3
namespace Maketok\DataMigration\Action;
4
5
class ArrayConfig implements ConfigInterface
6
{
7
    /**
8
     * @var array
9
     */
10
    protected $config;
11
12
    /**
13
     * {@inheritdoc}
14
     */
15 20
    public function assign(array $config)
16
    {
17 20
        $this->config = $config;
18 20
    }
19
20
    /**
21
     * {@inheritdoc}
22
     */
23 1
    public function dump()
24
    {
25 1
        return $this->config;
26
    }
27
28
    /**
29
     * {@inheritdoc}
30
     */
31 32
    public function offsetExists($offset)
32
    {
33 32
        return array_key_exists($offset, $this->config);
34
    }
35
36
    /**
37
     * {@inheritdoc}
38
     */
39 32
    public function offsetGet($offset)
40
    {
41 32
        if ($this->offsetExists($offset)) {
42 32
            return $this->config[$offset];
43
        }
44 32
        return null;
45
    }
46
47
    /**
48
     * {@inheritdoc}
49
     */
50 23
    public function offsetSet($offset, $value)
51
    {
52 23
        $this->config[$offset] = $value;
53 23
    }
54
55
    /**
56
     * {@inheritdoc}
57
     */
58 1
    public function offsetUnset($offset)
59
    {
60 1
        if ($this->offsetExists($offset)) {
61 1
            unset($this->config[$offset]);
62 1
        }
63 1
        return null;
64
    }
65
}
66