Failed Conditions
Push — type ( c389f1...fc7bda )
by Michael
02:26
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
use Doctrine\Annotations\Type\Type;
8
9
/**
10
 * @internal
11
 */
12
final class PropertyMetadata
13
{
14
    /** @var string */
15
    private $name;
16
17
    /** @var Type */
18
    private $type;
19
20
    /** @var bool */
21
    private $required;
22
23
    /** @var bool */
24
    private $default;
25
26
    /** @var mixed[]|null */
27
    private $enum;
28
29
    /**
30
     * @param mixed[]|null $enum
31
     */
32 291
    public function __construct(
33
        string $name,
34
        Type $type,
35
        bool $required = false,
36
        bool $default = false,
37
        ?array $enum = null
38
    ) {
39 291
        $this->name     = $name;
40 291
        $this->type     = $type;
41 291
        $this->required = $required;
42 291
        $this->default  = $default;
43 291
        $this->enum     = $enum;
44 291
    }
45
46 291
    public function getName() : string
47
    {
48 291
        return $this->name;
49
    }
50
51 204
    public function isRequired() : bool
52
    {
53 204
        return $this->required;
54
    }
55
56 233
    public function getType() : Type
57
    {
58 233
        return $this->type;
59
    }
60
61 290
    public function isDefault() : bool
62
    {
63 290
        return $this->default;
64
    }
65
66
    /**
67
     * @return mixed[]|null
68
     */
69 232
    public function getEnum() : ?array
70
    {
71 232
        return $this->enum;
72
    }
73
}
74