| Conditions | 5 |
| Paths | 5 |
| Total Lines | 23 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 5 |
| Changes | 0 | ||
| 1 | <?php |
||
| 30 | 2 | public function process(ServerRequestInterface $req, RequestHandlerInterface $handler): ResponseInterface |
|
| 31 | {
|
||
| 32 | 2 | $path = $req->getUri()->getPath(); |
|
| 33 | |||
| 34 | 2 | foreach ($this->patterns as $pattern => $middleware) |
|
| 35 | {
|
||
| 36 | 2 | $matches = []; |
|
| 37 | 2 | if (preg_match('#^' . $pattern . '$#', $path, $matches))
|
|
| 38 | {
|
||
| 39 | 1 | foreach ($matches as $key => $value) |
|
| 40 | {
|
||
| 41 | 1 | if (is_string($key)) |
|
| 42 | {
|
||
| 43 | 1 | $req = $req->withAttribute($key, $value); |
|
| 44 | } |
||
| 45 | } |
||
| 46 | |||
| 47 | 2 | return $middleware->process($req, $handler); |
|
| 48 | } |
||
| 49 | } |
||
| 50 | |||
| 51 | 1 | return $handler->handle($req); |
|
| 52 | } |
||
| 53 | } |