1 | <?php |
||
11 | class PropertyMetadata extends BasePropertyMetadata implements MergeableInterface |
||
12 | { |
||
13 | 84 | public function __construct($class, $name) |
|
14 | { |
||
15 | try { |
||
16 | 84 | parent::__construct($class, $name); |
|
17 | 30 | } catch (\ReflectionException $e) { |
|
1 ignored issue
–
show
|
|||
18 | /* Ignore missing property definition as they might just be overridden and therefore only exist in the |
||
19 | parent class. They will be accessible after merging. */ |
||
20 | } |
||
21 | 84 | } |
|
22 | |||
23 | /** |
||
24 | * @var string|null |
||
25 | */ |
||
26 | private $type; |
||
27 | |||
28 | /** |
||
29 | * @var bool |
||
30 | */ |
||
31 | private $excluded; |
||
32 | |||
33 | /** |
||
34 | * @var Postable|null |
||
35 | */ |
||
36 | private $postable; |
||
37 | |||
38 | /** |
||
39 | * @var Puttable|null |
||
40 | */ |
||
41 | private $puttable; |
||
42 | |||
43 | /** |
||
44 | * @var bool |
||
45 | */ |
||
46 | private $includable; |
||
47 | |||
48 | /** |
||
49 | * @var string[]|null |
||
50 | */ |
||
51 | private $includablePaths; |
||
52 | |||
53 | /** |
||
54 | * @var bool |
||
55 | */ |
||
56 | private $subResource; |
||
57 | |||
58 | /** |
||
59 | * @var Method[]|null |
||
60 | */ |
||
61 | private $methods; |
||
62 | |||
63 | /** |
||
64 | * @var bool |
||
65 | */ |
||
66 | private $association; |
||
67 | |||
68 | /** |
||
69 | * @var bool |
||
70 | */ |
||
71 | private $collection; |
||
72 | |||
73 | /** |
||
74 | * @var bool |
||
75 | */ |
||
76 | private $virtual; |
||
77 | |||
78 | /** |
||
79 | * @var string|null |
||
80 | */ |
||
81 | private $subResourcePath; |
||
82 | |||
83 | 12 | public function isPuttable(): bool |
|
84 | { |
||
85 | 12 | return null !== $this->puttable; |
|
86 | } |
||
87 | |||
88 | 80 | public function setPuttable(?Puttable $puttable) |
|
89 | { |
||
90 | 80 | $this->puttable = $puttable; |
|
91 | 80 | } |
|
92 | |||
93 | 12 | public function getPuttable(): ?Puttable |
|
94 | { |
||
95 | 12 | return $this->puttable; |
|
96 | } |
||
97 | |||
98 | 14 | public function isPostable(): bool |
|
99 | { |
||
100 | 14 | return null !== $this->postable; |
|
101 | } |
||
102 | |||
103 | 80 | public function setPostable(?Postable $postable) |
|
104 | { |
||
105 | 80 | $this->postable = $postable; |
|
106 | 80 | } |
|
107 | |||
108 | 14 | public function getPostable(): ?Postable |
|
109 | { |
||
110 | 14 | return $this->postable; |
|
111 | } |
||
112 | |||
113 | 64 | public function isIncludable(): bool |
|
114 | { |
||
115 | 64 | return $this->getBool($this->includable, false); |
|
116 | } |
||
117 | |||
118 | public function isVirtual(): bool |
||
119 | { |
||
120 | return $this->getBool($this->virtual, false); |
||
121 | } |
||
122 | |||
123 | 28 | public function setVirtual(bool $virtual) |
|
124 | { |
||
125 | 28 | $this->virtual = $virtual; |
|
126 | 28 | } |
|
127 | |||
128 | 72 | public function setIncludable(bool $includable) |
|
132 | |||
133 | 12 | public function isSubResource(): bool |
|
134 | { |
||
135 | 12 | return $this->getBool($this->subResource, false); |
|
136 | } |
||
137 | |||
138 | 68 | public function setSubResource(bool $subResource) |
|
139 | { |
||
140 | 68 | $this->subResource = $subResource; |
|
141 | 68 | } |
|
142 | |||
143 | 10 | public function getSubResourcePath(): ?string |
|
147 | |||
148 | public function setSubResourcePath(string $subResourcePath) |
||
149 | { |
||
150 | $this->subResourcePath = $subResourcePath; |
||
151 | } |
||
152 | |||
153 | 62 | public function isExcluded(): bool |
|
154 | { |
||
155 | 62 | return $this->getBool($this->excluded, false); |
|
156 | } |
||
157 | |||
158 | 64 | public function setExcluded(bool $excluded) |
|
159 | { |
||
160 | 64 | $this->excluded = $excluded; |
|
161 | 64 | } |
|
162 | |||
163 | /** |
||
164 | * @return null|\string[] |
||
165 | */ |
||
166 | 48 | public function getIncludablePaths(): ?array |
|
170 | |||
171 | /** |
||
172 | * @param null|\string[] $includablePaths |
||
173 | */ |
||
174 | 72 | public function setIncludablePaths(?array $includablePaths) |
|
178 | |||
179 | 62 | public function isAssociation(): bool |
|
183 | |||
184 | 68 | public function setAssociation(bool $association) |
|
188 | |||
189 | 32 | public function isCollection(): bool |
|
193 | |||
194 | 68 | public function setCollection(bool $collection) |
|
198 | |||
199 | 64 | public function getType(): ?string |
|
203 | |||
204 | 84 | public function setType(?string $type) |
|
208 | |||
209 | /** |
||
210 | * @param Method[] $methods |
||
211 | */ |
||
212 | 68 | public function setMethods(array $methods) |
|
216 | |||
217 | 12 | public function merge(MergeableInterface $other) |
|
239 | |||
240 | 66 | protected function getBool(?bool $value, bool $default) |
|
248 | |||
249 | 12 | private function mergeField($thisValue, $otherValue) |
|
257 | |||
258 | 38 | public function getMethod(string $methodName): ?Method |
|
272 | } |
||
273 |