| Conditions | 2 |
| Paths | 3 |
| Total Lines | 15 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 2 |
| Changes | 0 | ||
| 1 | <?php |
||
| 31 | 18 | public function createMethod( |
|
| 32 | Request $request, |
||
| 33 | RestDtoInterface $restDto, |
||
| 34 | ?array $allowedHttpMethods = null, |
||
| 35 | ): Response { |
||
|
|
|||
| 36 | 18 | $resource = $this->getResourceForMethod($request, $allowedHttpMethods ?? ['POST']); |
|
| 37 | |||
| 38 | try { |
||
| 39 | 3 | $data = $resource->create($restDto, true); |
|
| 40 | |||
| 41 | return $this |
||
| 42 | 2 | ->getResponseHandler() |
|
| 43 | 2 | ->createResponse($request, $data, $resource, Response::HTTP_CREATED); |
|
| 44 | 1 | } catch (Throwable $exception) { |
|
| 45 | 1 | throw $this->handleRestMethodException($exception); |
|
| 46 | } |
||
| 49 |