| Conditions | 2 |
| Paths | 4 |
| Total Lines | 23 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 16 |
| CRAP Score | 2 |
| Changes | 0 | ||
| 1 | <?php |
||
| 31 | 50 | public function countMethod(Request $request, ?array $allowedHttpMethods = null): Response |
|
| 32 | { |
||
| 33 | 50 | $resource = $this->getResourceForMethod($request, $allowedHttpMethods ?? [Request::METHOD_GET]); |
|
|
|
|||
| 34 | |||
| 35 | // Determine used parameters |
||
| 36 | 30 | $search = RequestHandler::getSearchTerms($request); |
|
| 37 | |||
| 38 | try { |
||
| 39 | 30 | $criteria = RequestHandler::getCriteria($request); |
|
| 40 | |||
| 41 | 29 | $this->processCriteria($criteria, $request, __METHOD__); |
|
| 42 | |||
| 43 | 29 | return $this |
|
| 44 | 29 | ->getResponseHandler() |
|
| 45 | 29 | ->createResponse( |
|
| 46 | 29 | $request, |
|
| 47 | 29 | [ |
|
| 48 | 29 | 'count' => $resource->count($criteria, $search), |
|
| 49 | 29 | ], |
|
| 50 | 29 | $resource |
|
| 51 | 29 | ); |
|
| 52 | 8 | } catch (Throwable $exception) { |
|
| 53 | 8 | throw $this->handleRestMethodException($exception); |
|
| 54 | } |
||
| 57 |