Conditions | 3 |
Paths | 3 |
Total Lines | 18 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
30 | 3 | public function process(ServerRequestInterface $req, RequestHandlerInterface $handler): ResponseInterface |
|
31 | { |
||
32 | 3 | $uri = $req->getUri(); |
|
33 | 3 | $path = $uri->getPath(); |
|
34 | |||
35 | 3 | foreach ($this->prefixes as $prefix => $middleware) |
|
36 | { |
||
37 | 3 | if (0 === strpos($path, $prefix)) |
|
38 | { |
||
39 | 2 | $req = $req->withUri($uri->withPath(substr($path, strlen($prefix)))) |
|
40 | 2 | ->withAttribute(self::class, $req->getAttribute(self::class, '') . $prefix); |
|
41 | |||
42 | 3 | return $middleware->process($req, $handler); |
|
43 | } |
||
44 | } |
||
45 | |||
46 | 1 | return $handler->handle($req); |
|
47 | } |
||
48 | } |