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