Conditions | 3 |
Paths | 3 |
Total Lines | 17 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
53 | public function __invoke(RequestInterface $request, ResponseInterface $response, callable $next) |
||
54 | { |
||
55 | $uri = $request->getUri(); |
||
56 | $path = $uri->getPath(); |
||
57 | |||
58 | if (isset($this->paths[$path])) { |
||
59 | return $response->withStatus(404); |
||
60 | } |
||
61 | |||
62 | $newPath = array_search($path, $this->paths, true); |
||
63 | |||
64 | if ($newPath !== false) { |
||
65 | $request = $request->withUri($uri->withPath($newPath)); |
||
66 | } |
||
67 | |||
68 | return $next($request, $response); |
||
69 | } |
||
70 | } |
||
71 |