Total Complexity | 6 |
Total Lines | 64 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
12 | final class PropertyMetadataBuilder |
||
13 | { |
||
14 | /** @var string */ |
||
15 | private $name; |
||
16 | |||
17 | /** @var string[]|null */ |
||
18 | private $type; |
||
19 | |||
20 | /** @var bool */ |
||
21 | private $required = false; |
||
22 | |||
23 | /** @var bool */ |
||
24 | private $default = false; |
||
25 | |||
26 | /** @var array<int|float|string|bool>|null */ |
||
27 | private $enum; |
||
28 | |||
29 | 239 | public function __construct(string $name) |
|
32 | 239 | } |
|
33 | |||
34 | /** |
||
35 | * @param string[] $type |
||
36 | */ |
||
37 | 174 | public function withType(array $type) : self |
|
42 | } |
||
43 | |||
44 | 4 | public function withBeingRequired() : self |
|
45 | { |
||
46 | 4 | $this->required = true; |
|
47 | |||
48 | 4 | return $this; |
|
49 | } |
||
50 | |||
51 | 169 | public function withBeingDefault() : self |
|
52 | { |
||
53 | 169 | $this->default = true; |
|
54 | |||
55 | 169 | return $this; |
|
56 | } |
||
57 | |||
58 | /** |
||
59 | * @param array<int|float|string|bool>|null $enum |
||
60 | */ |
||
61 | 4 | public function withEnum(array $enum) : self |
|
62 | { |
||
63 | 4 | $this->enum = $enum; |
|
64 | |||
65 | 4 | return $this; |
|
66 | } |
||
67 | |||
68 | 237 | public function build() : PropertyMetadata |
|
76 | ); |
||
77 | } |
||
78 | } |
||
79 |