Conditions | 3 |
Paths | 3 |
Total Lines | 17 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
37 | public function __invoke(RequestInterface $request, ResponseInterface $response, callable $next) |
||
38 | { |
||
39 | $uri = $request->getUri(); |
||
40 | $path = $uri->getPath(); |
||
41 | |||
42 | if (isset($this->paths[$path])) { |
||
43 | return $response->withStatus(404); |
||
44 | } |
||
45 | |||
46 | $newPath = array_search($path, $this->paths, true); |
||
47 | |||
48 | if ($newPath !== false) { |
||
49 | $request = $request->withUri($uri->withPath($newPath)); |
||
50 | } |
||
51 | |||
52 | return $next($request, $response); |
||
53 | } |
||
54 | } |
||
55 |