Total Complexity | 5 |
Total Lines | 51 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
12 | final class AnnotationMetadataBuilder |
||
13 | { |
||
14 | /** @var string */ |
||
15 | private $name; |
||
16 | |||
17 | /** @var AnnotationTarget */ |
||
18 | private $target; |
||
19 | |||
20 | /** @var PropertyMetadata[] */ |
||
21 | private $properties = []; |
||
22 | |||
23 | /** @var bool */ |
||
24 | private $usesConstructor = false; |
||
25 | |||
26 | 261 | public function __construct(string $name) |
|
27 | { |
||
28 | 261 | $this->name = $name; |
|
29 | 261 | $this->target = AnnotationTarget::all(); |
|
30 | 261 | } |
|
31 | |||
32 | 204 | public function withTarget(AnnotationTarget $target) : self |
|
33 | { |
||
34 | 204 | $new = clone $this; |
|
35 | 204 | $new->target = $target; |
|
36 | |||
37 | 204 | return $new; |
|
38 | } |
||
39 | |||
40 | 90 | public function withUsingConstructor() : self |
|
41 | { |
||
42 | 90 | $new = clone $this; |
|
43 | 90 | $new->usesConstructor = true; |
|
44 | |||
45 | 90 | return $new; |
|
46 | } |
||
47 | |||
48 | 236 | public function withProperty(PropertyMetadata $property) : self |
|
49 | { |
||
50 | 236 | $new = clone $this; |
|
51 | 236 | $new->properties[] = $property; |
|
52 | |||
53 | 236 | return $new; |
|
54 | } |
||
55 | |||
56 | 253 | public function build() : AnnotationMetadata |
|
63 | ); |
||
64 | } |
||
65 | } |
||
66 |