Conditions | 4 |
Paths | 1 |
Total Lines | 13 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 4 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
13 | 121 | public static function from(Expectation $expectation): callable |
|
14 | { |
||
15 | 121 | return function ($request) use ($expectation) { |
|
16 | /** @var RequestInterface $request */ |
||
17 | 77 | $headers = GuzzleHeaderParser::parse($request->getHeaders()); |
|
18 | |||
19 | 77 | foreach ($expectation->rejectedHeadersIterator() as $header => $value) { |
|
20 | 10 | if (array_key_exists($header, $headers) && $headers[$header] === $value) { |
|
21 | 7 | return new RejectedPromise('header \'' . $header . '\' is same from expectation'); |
|
22 | } |
||
23 | } |
||
24 | |||
25 | 72 | return $request; |
|
26 | 121 | }; |
|
29 |