1 | <?php |
||
21 | class Scope |
||
22 | { |
||
23 | /** |
||
24 | * @var string |
||
25 | */ |
||
26 | protected $scopeIdentifier; |
||
27 | |||
28 | /** |
||
29 | * @var Transform |
||
30 | */ |
||
31 | protected $transform; |
||
32 | |||
33 | /** |
||
34 | * @var array |
||
35 | */ |
||
36 | protected $parentScopes = []; |
||
37 | |||
38 | /** |
||
39 | * Scope constructor. |
||
40 | * @param Transform $transform |
||
41 | * @param string|null $scopeIdentifier |
||
42 | * @param array $parentScopes |
||
43 | */ |
||
44 | public function __construct( |
||
53 | |||
54 | /** |
||
55 | * @return Transform |
||
56 | */ |
||
57 | public function getTransform(): Transform |
||
61 | |||
62 | /** |
||
63 | * @param $key |
||
64 | * @return ParamBag |
||
65 | */ |
||
66 | public function getParams(string $key = null): ParamBag |
||
72 | |||
73 | |||
74 | /** |
||
75 | * Get the unique identifier for this scope. |
||
76 | * |
||
77 | * @param string $appendIdentifier |
||
78 | * |
||
79 | * @return string |
||
80 | */ |
||
81 | public function getIdentifier(string $appendIdentifier = null): string |
||
94 | |||
95 | /** |
||
96 | * Is Requested. |
||
97 | * |
||
98 | * Check if - in relation to the current scope - this specific segment is allowed. |
||
99 | * That means, if a.b.c is requested and the current scope is a.b, then c is allowed. If the current |
||
100 | * scope is a then c is not allowed, even if it is there and potentially transformable. |
||
101 | * |
||
102 | * @param string $checkScopeSegment |
||
103 | * |
||
104 | * @return bool Returns the new number of elements in the array. |
||
105 | */ |
||
106 | public function isRequested($checkScopeSegment): bool |
||
113 | |||
114 | /** |
||
115 | * Is Excluded. |
||
116 | * |
||
117 | * Check if - in relation to the current scope - this specific segment should |
||
118 | * be excluded. That means, if a.b.c is excluded and the current scope is a.b, |
||
119 | * then c will not be allowed in the transformation whether it appears in |
||
120 | * the list of default or available, requested includes. |
||
121 | * |
||
122 | * @param string $checkScopeSegment |
||
123 | * |
||
124 | * @return bool |
||
125 | */ |
||
126 | protected function isExcluded($checkScopeSegment): bool |
||
133 | |||
134 | /** |
||
135 | * @param callable $transformer |
||
136 | * @param string $key |
||
137 | * @return bool |
||
138 | */ |
||
139 | public function includeValue(callable $transformer, string $key): bool |
||
156 | |||
157 | /** |
||
158 | * @param callable $transformer |
||
159 | * @param mixed $data |
||
160 | * @param array $extra |
||
161 | * @return array |
||
162 | */ |
||
163 | public function transform(callable $transformer, $data, array $extra = []): array |
||
167 | |||
168 | /** |
||
169 | * @param callable $transformer |
||
170 | * @param array $data |
||
171 | * @param string|null $key |
||
172 | * @param array $params |
||
173 | * @return array |
||
174 | */ |
||
175 | public function prepareData(callable $transformer, array $data, string $key = null, array $params = []): array |
||
189 | |||
190 | /** |
||
191 | * @param callable $transformer |
||
192 | * @param $value |
||
193 | * @param string|null $key |
||
194 | * @param array $params |
||
195 | * @return mixed |
||
196 | */ |
||
197 | protected function prepareValue(callable $transformer, $value, string $key = null, array $params = []) |
||
217 | |||
218 | /** |
||
219 | * @param ResourceInterface $transformer |
||
220 | * @param string $key |
||
221 | * @param array $params |
||
222 | * @return mixed |
||
223 | */ |
||
224 | protected function prepareResource( |
||
237 | |||
238 | /** |
||
239 | * @param \Closure $transformer |
||
240 | * @param string|null $key |
||
241 | * @param array $extra |
||
242 | * @return mixed |
||
243 | */ |
||
244 | protected function prepareClosure(\Closure $transformer, string $key = null, array $extra = []) |
||
263 | |||
264 | /** |
||
265 | * @param callable $transformer |
||
266 | * @param $data |
||
267 | * @param string|null $key |
||
268 | * @param array $extra |
||
269 | * @return mixed |
||
270 | */ |
||
271 | protected function prepareTransformer(callable $transformer, $data, string $key = null, array $extra = []) |
||
299 | |||
300 | /** |
||
301 | * @param string $identifier |
||
302 | * @return Scope |
||
303 | */ |
||
304 | public function childScope(string $identifier): Scope |
||
315 | |||
316 | /** |
||
317 | * Check, if this is the root scope. |
||
318 | * |
||
319 | * @return bool |
||
320 | */ |
||
321 | protected function isRootScope(): bool |
||
325 | |||
326 | /** |
||
327 | * Filter the provided data with the requested filter fields for |
||
328 | * the scope resource |
||
329 | * |
||
330 | * @param array $data |
||
331 | * |
||
332 | * @return array |
||
333 | */ |
||
334 | protected function filterFields(array $data): array |
||
349 | |||
350 | /** |
||
351 | * Return the requested filter fields for the scope resource |
||
352 | * |
||
353 | * @internal |
||
354 | * |
||
355 | * @return ParamBag|null |
||
356 | */ |
||
357 | protected function getFilterFields() |
||
363 | |||
364 | /** |
||
365 | * @param string $checkScopeSegment |
||
366 | * @return string |
||
367 | */ |
||
368 | private function scopeString(string $checkScopeSegment): string |
||
379 | } |
||
380 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: