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