| Total Complexity | 3 |
| Total Lines | 29 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 14 | final class SwaggerUi implements MiddlewareInterface |
||
| 15 | { |
||
| 16 | private string $jsonUrl = '/'; |
||
| 17 | private SwaggerService $swaggerService; |
||
| 18 | private ViewRenderer $viewRenderer; |
||
| 19 | |||
| 20 | 2 | public function __construct(ViewRenderer $viewRenderer, SwaggerService $swaggerService) |
|
| 21 | { |
||
| 22 | 2 | $this->swaggerService = $swaggerService; |
|
| 23 | 2 | $this->viewRenderer = $viewRenderer; |
|
| 24 | 2 | } |
|
| 25 | |||
| 26 | 1 | public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface |
|
| 27 | { |
||
| 28 | 1 | return $this->viewRenderer |
|
| 29 | 1 | ->withViewPath($this->swaggerService->getViewPath()) |
|
| 30 | 1 | ->renderPartial( |
|
| 31 | 1 | $this->swaggerService->getViewName(), |
|
| 32 | [ |
||
| 33 | 1 | 'jsonUrl' => $this->jsonUrl |
|
| 34 | ] |
||
| 35 | ); |
||
| 36 | } |
||
| 37 | |||
| 38 | 2 | public function withJsonUrl(string $jsonUrl): self |
|
| 43 | } |
||
| 44 | |||
| 45 | } |
||
| 46 |