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

PropertyMetadata::getEnum()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 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