Failed Conditions
Pull Request — new-parser-ast-metadata (#3)
by
unknown
02:29
created

PropertyMetadata::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 6
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 4
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Doctrine\Annotations\Metadata;
6
7
use Doctrine\Annotations\Metadata\Type\Type;
8
9
final class PropertyMetadata
10
{
11
    /** @var string */
12
    private $name;
13
14
    /** @var Type */
15
    private $type;
16
17
    /** @var bool */
18
    private $isRequired;
19
20
    /** @var mixed[] */
21
    private $enumValues;
22
23
    /**
24
     * @param mixed[] $enumValues
25
     */
26 9
    public function __construct(string $name, Type $type, array $enumValues = [], bool $isRequired = false)
27
    {
28 9
        $this->name       = $name;
29 9
        $this->type       = $type;
30 9
        $this->enumValues = $enumValues;
31 9
        $this->isRequired = $isRequired;
32 9
    }
33
34 8
    public function getName() : string
35
    {
36 8
        return $this->name;
37
    }
38
39 6
    public function type() : Type
40
    {
41 6
        return $this->type;
42
    }
43
44 6
    public function isRequired() : bool
45
    {
46 6
        return $this->isRequired;
47
    }
48
49
    /**
50
     * @return mixed[]
51
     */
52 6
    public function enumValues() : array
53
    {
54 6
        return $this->enumValues;
55
    }
56
}
57