| Conditions | 3 |
| Paths | 1 |
| Total Lines | 12 |
| Code Lines | 5 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 6 |
| 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 | |||
| 17 | 72 | foreach ($expectation->emptyHeadersIterator() as $param => $value) { |
|
| 18 | 7 | if (!$request->hasHeader($param)) { |
|
|
|
|||
| 19 | 5 | return new RejectedPromise('header \'' . $param . '\' is missing'); |
|
| 20 | } |
||
| 21 | } |
||
| 22 | |||
| 23 | 67 | return $request; |
|
| 24 | 121 | }; |
|
| 27 |