| Conditions | 2 |
| Paths | 2 |
| Total Lines | 16 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 2 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 24 | 2 | protected function run( |
|
| 25 | ServerRequestInterface $request, |
||
| 26 | JsonEnabledResponseInterface $response, |
||
| 27 | array $args |
||
| 28 | ): ResponseInterface { |
||
| 29 | 2 | $stationId = (int) ($args['stationId'] ?? 0); |
|
| 30 | |||
| 31 | 2 | $station = $this->radioStationRepository->find($stationId); |
|
| 32 | 2 | if ($station === null) { |
|
| 33 | 1 | return $response->withStatus(Http::NOT_FOUND); |
|
| 34 | } |
||
| 35 | |||
| 36 | 1 | return $response->withJson([ |
|
| 37 | 1 | 'id' => $station->getId(), |
|
| 38 | 1 | 'name' => $station->getName(), |
|
| 39 | 1 | 'url' => $station->getUrl(), |
|
| 40 | 1 | ]); |
|
| 43 |