Accessor   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 4
Bugs 2 Features 0
Metric Value
wmc 5
c 4
b 2
f 0
lcom 1
cbo 0
dl 0
loc 35
ccs 13
cts 13
cp 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 10 3
A getName() 0 4 1
A getValue() 0 4 1
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