| Conditions | 3 |
| Paths | 1 |
| Total Lines | 13 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 3 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 12 | 121 | public static function from(Expectation $expectation): callable |
|
| 13 | { |
||
| 14 | 121 | return function ($request) use ($expectation) { |
|
| 15 | /** @var RequestInterface $request */ |
||
| 16 | 106 | parse_str($request->getUri()->getQuery(), $params); |
|
| 17 | |||
| 18 | 106 | foreach ($expectation->emptyQueryParamsIterator() as $param => $value) { |
|
| 19 | 15 | if (!array_key_exists($param, $params)) { |
|
| 20 | 10 | return new RejectedPromise('param \'' . $param . '\' is missing'); |
|
| 21 | } |
||
| 22 | } |
||
| 23 | |||
| 24 | 96 | return $request; |
|
| 25 | 121 | }; |
|
| 28 |