Conditions | 3 |
Paths | 1 |
Total Lines | 11 |
Code Lines | 5 |
Lines | 0 |
Ratio | 0 % |
Tests | 6 |
CRAP Score | 3 |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
11 | 121 | public static function from(Expectation $expectation): callable |
|
12 | { |
||
13 | 121 | return function ($request) use ($expectation) { |
|
14 | /** @var RequestInterface $request */ |
||
15 | 57 | foreach ($expectation->requestHandlersIterator() as $handler) { |
|
16 | 2 | if (!$handler($request)) { |
|
17 | 1 | return new RejectedPromise('request does not match expectation'); |
|
18 | } |
||
19 | } |
||
20 | |||
21 | 56 | return $request; |
|
22 | }; |
||
25 |