1 | <?php |
||
19 | class ProvidersQueryWrapper |
||
20 | { |
||
21 | /** |
||
22 | * Holds reference to IQueryProvider implementation. |
||
23 | * |
||
24 | * @var IQueryProvider |
||
25 | */ |
||
26 | private $queryProvider; |
||
27 | |||
28 | |||
29 | /** |
||
30 | * Creates a new instance of ProvidersWrapper. |
||
31 | * |
||
32 | * @param IQueryProvider $query Reference to IQueryProvider implementation |
||
33 | */ |
||
34 | public function __construct(IQueryProvider $query) |
||
38 | |||
39 | /** |
||
40 | * Get related resource set for a resource. |
||
41 | * |
||
42 | * @param QueryType $queryType Indicates if this is a query for a count, entities, or entities |
||
43 | * with a count |
||
44 | * @param ResourceSet $sourceResourceSet The entity set containing the source entity |
||
45 | * @param object $sourceEntity The source entity instance |
||
46 | * @param ResourceSet $targetResourceSet The resource set of containing the target of the navigation property |
||
47 | * @param ResourceProperty $targetProperty The navigation property to retrieve |
||
48 | * @param FilterInfo $filterInfo Represents the $filter parameter of the OData query. |
||
49 | * NULL if no $filter specified |
||
50 | * @param mixed $orderBy sorted order if we want to get the data in some specific order |
||
51 | * @param int $top number of records which need to be skip |
||
52 | * @param string $skip value indicating what records to skip |
||
53 | * |
||
54 | * @return QueryResult |
||
55 | * |
||
56 | * @throws ODataException |
||
57 | */ |
||
58 | public function getRelatedResourceSet( |
||
85 | |||
86 | /** |
||
87 | * Gets collection of entities belongs to an entity set. |
||
88 | * |
||
89 | * @param QueryType $queryType Indicates if this is a query for a count, entities, or entities with a |
||
90 | * count |
||
91 | * @param ResourceSet $resourceSet The entity set containing the entities that need to be fetched |
||
92 | * @param FilterInfo $filterInfo Represents the $filter parameter of the OData query. |
||
93 | * NULL if no $filter specified |
||
94 | * @param InternalOrderByInfo $orderBy The orderBy information |
||
95 | * @param int $top The top count |
||
96 | * @param int $skip The skip count |
||
97 | * @param InternalSkipTokenInfo $skipToken The skip token |
||
98 | * |
||
99 | * @return QueryResult |
||
100 | */ |
||
101 | public function getResourceSet( |
||
124 | |||
125 | |||
126 | /** |
||
127 | * Puts an entity instance to entity set identified by a key. |
||
128 | * |
||
129 | * @param ResourceSet $resourceSet The entity set containing the entity to update |
||
130 | * @param KeyDescriptor $keyDescriptor The key identifying the entity to update |
||
131 | * @param $data |
||
132 | * |
||
133 | * @return bool|null Returns result of executiong query |
||
134 | */ |
||
135 | public function putResource( |
||
148 | |||
149 | /** |
||
150 | * Indicates if the QueryProvider can handle ordered paging, this means respecting order, skip, and top parameters |
||
151 | * If the query provider can not handle ordered paging, it must return the entire result set and POData will |
||
152 | * perform the ordering and paging. |
||
153 | * |
||
154 | * @return bool True if the query provider can handle ordered paging, false if POData should perform the paging |
||
155 | */ |
||
156 | public function handlesOrderedPaging() |
||
160 | |||
161 | /** |
||
162 | * Gets the underlying custom expression provider, the end developer is |
||
163 | * responsible for implementing IExpressionProvider if he choose for. |
||
164 | * |
||
165 | * @return IExpressionProvider Instance of IExpressionProvider implementation |
||
166 | * |
||
167 | * @throws ODataException |
||
168 | */ |
||
169 | public function getExpressionProvider() |
||
186 | |||
187 | /** |
||
188 | * @param ResourceSet $resourceSet The entity set containing the entity to fetch |
||
189 | * @param object $sourceEntityInstance The source entity instance |
||
190 | * @param object $data The New data for the entity instance. |
||
191 | * |
||
192 | * returns object|null returns the newly created model if sucessful or null if model creation failed. |
||
193 | */ |
||
194 | public function createResourceforResourceSet( |
||
205 | |||
206 | /** |
||
207 | * Delete resource from a resource set. |
||
208 | * @param ResourceSet $sourceResourceSet |
||
209 | * @param object $sourceEntityInstance |
||
210 | * |
||
211 | * return bool true if resources sucessfully deteled, otherwise false. |
||
212 | */ |
||
213 | public function deleteResource( |
||
222 | |||
223 | /** |
||
224 | * Updates a resource |
||
225 | * |
||
226 | * @param ResourceSet $sourceResourceSet The entity set containing the source entity |
||
227 | * @param object $sourceEntityInstance The source entity instance |
||
228 | * @param KeyDescriptor $keyDescriptor The key identifying the entity to fetch |
||
229 | * @param object $data The New data for the entity instance. |
||
230 | * @param bool $shouldUpdate Should undefined values be updated or reset to default |
||
231 | * |
||
232 | * @return object|null The new resource value if it is assignable or throw exception for null. |
||
233 | */ |
||
234 | public function updateResource( |
||
249 | |||
250 | /** |
||
251 | * Get related resource for a resource. |
||
252 | * |
||
253 | * @param ResourceSet $sourceResourceSet The source resource set |
||
254 | * @param object $sourceEntity The source resource |
||
255 | * @param ResourceSet $targetResourceSet The resource set of the navigation |
||
256 | * property |
||
257 | * @param ResourceProperty $targetProperty The navigation property to be |
||
258 | * retrieved |
||
259 | * |
||
260 | * @return object|null The related resource if exists else null |
||
261 | * |
||
262 | * @throws ODataException |
||
263 | */ |
||
264 | public function getRelatedResourceReference( |
||
304 | |||
305 | /** |
||
306 | * Gets a related entity instance from an entity set identified by a key. |
||
307 | * |
||
308 | * @param ResourceSet $sourceResourceSet The entity set related to the entity to be fetched |
||
309 | * @param object $sourceEntity The related entity instance |
||
310 | * @param ResourceSet $targetResourceSet The entity set from which entity needs to be fetched |
||
311 | * @param ResourceProperty $targetProperty The metadata of the target property |
||
312 | * @param KeyDescriptor $keyDescriptor The key to identify the entity to be fetched |
||
313 | * |
||
314 | * @return object|null Returns entity instance if found else null |
||
315 | */ |
||
316 | public function getResourceFromRelatedResourceSet( |
||
340 | |||
341 | /** |
||
342 | * Gets an entity instance from an entity set identified by a key. |
||
343 | * |
||
344 | * @param ResourceSet $resourceSet The entity set containing the entity to fetch |
||
345 | * @param KeyDescriptor $keyDescriptor The key identifying the entity to fetch |
||
346 | * |
||
347 | * @return object|null Returns entity instance if found else null |
||
348 | */ |
||
349 | public function getResourceFromResourceSet(ResourceSet $resourceSet, KeyDescriptor $keyDescriptor) |
||
361 | |||
362 | /** |
||
363 | * @param QueryResult $queryResult |
||
364 | * @param string $methodName |
||
365 | * |
||
366 | * @throws ODataException |
||
367 | */ |
||
368 | private function validateQueryResult($queryResult, QueryType $queryType, $methodName) |
||
401 | |||
402 | /** |
||
403 | * Validate the given entity instance. |
||
404 | * |
||
405 | * @param object|null $entityInstance Entity instance to validate |
||
406 | * @param ResourceSet &$resourceSet Resource set to which the entity |
||
407 | * instance belongs to |
||
408 | * @param KeyDescriptor &$keyDescriptor The key descriptor |
||
409 | * @param string $methodName Method from which this function |
||
410 | * invoked |
||
411 | * |
||
412 | * @throws ODataException |
||
413 | */ |
||
414 | private function validateEntityInstance( |
||
446 | |||
447 | /** |
||
448 | * @param $methodName |
||
449 | * @param $entityInstance |
||
450 | * @param ResourceSet $resourceSet |
||
451 | * @return ResourceType |
||
452 | * |
||
453 | * @throws ODataException |
||
454 | */ |
||
455 | private function verifyResourceType($methodName, $entityInstance, ResourceSet $resourceSet) |
||
469 | } |
||
470 |
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.
In this case you can add the
@ignore
PhpDoc annotation to the duplicate definition and it will be ignored.