Conditions | 3 |
Paths | 1 |
Total Lines | 11 |
Code Lines | 5 |
Lines | 0 |
Ratio | 0 % |
Tests | 5 |
CRAP Score | 3.0416 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
11 | 98 | public static function from(Expectation $expectation): callable |
|
12 | { |
||
13 | 98 | return function ($request) use ($expectation) { |
|
14 | 97 | if ($regex = $expectation->getPathRegex()) { |
|
15 | /** @var RequestInterface $request */ |
||
16 | 1 | if (!preg_match($regex, $request->getUri()->getPath(), $matches)) { |
|
17 | return new RejectedPromise('path does not match expectation'); |
||
18 | } |
||
19 | } |
||
20 | |||
21 | 97 | return $request; |
|
22 | 98 | }; |
|
25 |