Property   A
last analyzed

Complexity

Total Complexity 8

Size/Duplication

Total Lines 51
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 8
eloc 14
dl 0
loc 51
ccs 9
cts 9
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A isMultiple() 0 3 1
B __construct() 0 8 7
1
<?php
2
3
namespace BitrixToolkit\BitrixEntityMapper\Annotation\Property;
4
5
use Doctrine\Common\Annotations\Annotation\Enum;
6
use Doctrine\Common\Annotations\Annotation\Required;
7
use Doctrine\Common\Annotations\Annotation\Target;
8
9
/**
10
 * @Annotation
11
 * @Target("PROPERTY")
12
 */
13
final class Property extends AbstractPropertyAnnotation implements PropertyAnnotationInterface
14
{
15
    /**
16
     * @var string
17
     * @Required
18
     */
19
    protected $code;
20
21
    /**
22
     * @var string
23
     * @Required
24
     * @Enum({"string", "boolean", "integer", "float", "datetime", "file", "entity"})
25
     */
26
    protected $type;
27
28
    /**
29
     * @var string
30
     */
31
    protected $name;
32
33
    /**
34
     * @var bool
35
     */
36
    protected $multiple;
37
38
    /**
39
     * @var bool
40
     */
41
    protected $primaryKey;
42
43
    /**
44
     * @var string
45
     */
46
    protected $entity;
47
48 27
    public function __construct(array $values)
49
    {
50 27
        $this->code = isset($values['code']) ? $values['code'] : null;
51 27
        $this->type = isset($values['type']) ? $values['type'] : null;
52 27
        $this->name = isset($values['name']) ? $values['name'] : null;
53 27
        $this->multiple = isset($values['multiple']) ? $values['multiple'] : null;
54 27
        $this->primaryKey = isset($values['primaryKey']) ? (bool)$values['primaryKey'] : false;
55 27
        $this->entity = isset($values['entity']) ? $values['entity'] : null;
56
    }
57
58
    /**
59
     * @return bool|null
60
     */
61 22
    public function isMultiple()
62
    {
63 22
        return $this->multiple;
64
    }
65
}