Failed Conditions
Push — annotation-metadata ( 414255 )
by Michael
02:42
created

PropertyMetadata   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 64
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 6
eloc 16
dl 0
loc 64
ccs 17
cts 17
cp 1
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A getName() 0 3 1
A isDefault() 0 3 1
A __construct() 0 12 1
A getEnum() 0 3 1
A getType() 0 3 1
A isRequired() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Doctrine\Annotations\Metadata;
6
7
final class PropertyMetadata
8
{
9
    /** @var string */
10
    private $name;
11
12
    /** @var array<string, string>|null */
13
    private $type;
14
15
    /** @var bool */
16
    private $required;
17
18
    /** @var bool */
19
    private $default;
20
21
    /** @var mixed[]|null */
22
    private $enum;
23
24
    /**
25
     * @param array<string, string> $type
26
     * @param mixed[]|null          $enum
27
     */
28 278
    public function __construct(
29
        string $name,
30
        ?array $type,
31
        bool $required = false,
32
        bool $default = false,
33
        ?array $enum = null
34
    ) {
35 278
        $this->name     = $name;
36 278
        $this->type     = $type;
37 278
        $this->required = $required;
38 278
        $this->default  = $default;
39 278
        $this->enum     = $enum;
40 278
    }
41
42 278
    public function getName() : string
43
    {
44 278
        return $this->name;
45
    }
46
47 148
    public function isRequired() : bool
48
    {
49 148
        return $this->required;
50
    }
51
52
    /**
53
     * @return array<string, string>|null
54
     */
55 179
    public function getType() : ?array
56
    {
57 179
        return $this->type;
58
    }
59
60 278
    public function isDefault() : bool
61
    {
62 278
        return $this->default;
63
    }
64
65
    /**
66
     * @return mixed[]|null
67
     */
68 179
    public function getEnum() : ?array
69
    {
70 179
        return $this->enum;
71
    }
72
}
73