Failed Conditions
Pull Request — new-parser-ast-metadata (#3)
by
unknown
06:33 queued 04:54
created

PropertyMetadata::isRequired()   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\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
    /** @var bool */
24
    private $default;
25
26
    /**
27
     * @param mixed[] $enumValues
28
     */
29 9
    public function __construct(string $name, Type $type, bool $isDefault = false, array $enumValues = [], bool $isRequired = false)
30
    {
31 9
        $this->name       = $name;
32 9
        $this->type       = $type;
33 9
        $this->enumValues = $enumValues;
34 9
        $this->isRequired = $isRequired;
35 9
        $this->default    = $isDefault;
36 9
    }
37
38 8
    public function getName() : string
39
    {
40 8
        return $this->name;
41
    }
42
43 6
    public function type() : Type
44
    {
45 6
        return $this->type;
46
    }
47
48 6
    public function isRequired() : bool
49
    {
50 6
        return $this->isRequired;
51
    }
52
53 7
    public function isDefault() : bool
54
    {
55 7
        return $this->default;
56
    }
57
58
    /**
59
     * @return mixed[]
60
     */
61 6
    public function enumValues() : array
62
    {
63 6
        return $this->enumValues;
64
    }
65
}
66