Conditions | 5 |
Paths | 3 |
Total Lines | 8 |
Code Lines | 4 |
Lines | 0 |
Ratio | 0 % |
Tests | 3 |
CRAP Score | 5.3906 |
Changes | 0 |
1 | <?php |
||
14 | function check_server_response(ResponseInterface $response, ?int $expectedCode = null): void |
||
15 | { |
||
16 | 11 | if (! $expectedCode && $response->getStatusCode() >= 400) { |
|
|
|||
17 | 4 | throw OAuth2Exception::fromResponse($response); |
|
18 | } |
||
19 | |||
20 | 7 | if ($expectedCode && $expectedCode !== $response->getStatusCode()) { |
|
21 | throw OAuth2Exception::fromResponse($response); |
||
22 | } |
||
24 |
In PHP, under loose comparison (like
==
, or!=
, orswitch
conditions), values of different types might be equal.For
integer
values, zero is a special case, in particular the following results might be unexpected: