ArrayReference   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 33
wmc 4
lcom 1
cbo 0
ccs 11
cts 11
cp 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getValue() 0 10 2
A setValue() 0 6 1
1
<?php
2
3
namespace Cascade\Mapper\Field\Reference;
4
5
class ArrayReference implements ReferenceInterface
6
{
7
    /**
8
     * @var string
9
     */
10
    private $field;
11
12
    /**
13
     * @param string $field
14
     */
15 6
    public function __construct($field)
16
    {
17 6
        $this->field = $field;
18 6
    }
19
20 2
    public function getValue($instance)
21
    {
22 2
        $field = $this->field;
23
24 2
        if (array_key_exists($field, $instance)) {
25 1
            return $instance[$field];
26
        }
27
28 1
        return null;
29
    }
30
31 1
    public function setValue($instance, $value)
32
    {
33 1
        $instance[$this->field] = $value;
34
35 1
        return $instance;
36
    }
37
}
38