Conditions | 3 |
Paths | 3 |
Total Lines | 16 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
25 | 1 | public function match(RequestInterface $request): RequestMatchResultInterface |
|
26 | { |
||
27 | 1 | if (strtolower($this->method) !== strtolower($request->getMethod())) { |
|
28 | 1 | return RequestMatchResult::failure(); |
|
29 | } |
||
30 | |||
31 | 1 | if (!preg_match($this->pathRegex, $request->getUri()->getPath(), $matches)) { |
|
32 | 1 | return RequestMatchResult::failure(); |
|
33 | } |
||
34 | |||
35 | 1 | $params = array_filter($matches, function($key) { |
|
36 | 1 | return is_string($key); |
|
37 | 1 | }, ARRAY_FILTER_USE_KEY); |
|
38 | |||
39 | 1 | return RequestMatchResult::success($params); |
|
40 | } |
||
41 | } |
||
42 |