Accessor::__construct()   A
last analyzed

Complexity

Conditions 3
Paths 4

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 9
CRAP Score 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 10
ccs 9
cts 9
cp 1
rs 9.4285
cc 3
eloc 6
nc 4
nop 1
crap 3
1
<?php
2
3
namespace Happyr\SerializerBundle\Annotation;
4
5
/**
6
 * @Annotation
7
 * @Target({"PROPERTY"})
8
 *
9
 * @author Tobias Nyholm <[email protected]>
10
 */
11
final class Accessor implements SerializerAnnotation
12
{
13
    /**
14
     * @var string
15
     */
16
    public $getter;
17
    /**
18
     * @var string
19
     */
20
    public $setter;
21
22
    /**
23
     * @param array $values
24
     */
25 23
    public function __construct(array $values)
26
    {
27 23
        $values = $values['value'];
28 23
        if (!empty($values['getter'])) {
29 23
            $this->getter = $values['getter'];
30 23
        }
31 23
        if (!empty($values['setter'])) {
32 23
            $this->setter = $values['setter'];
33 23
        }
34 23
    }
35
36 23
    public function getName()
37
    {
38 23
        return 'accessor';
39
    }
40
41 23
    public function getValue()
42
    {
43 23
        return ['setter' => $this->setter, 'getter' => $this->getter];
44
    }
45
}
46