8000 Rename some vars · symfony/symfony@90d602c · GitHub
[go: up one dir, main page]

Skip to content

Commit 90d602c

Browse files
committed
Rename some vars
1 parent 815bade commit 90d602c

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/Symfony/Component/HttpClient/Exception/HttpExceptionTrait.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public function __construct(ResponseInterface $response)
2727
$message = sprintf('HTTP %d returned for URL "%s".', $code, $url);
2828

2929
$httpCodeFound = false;
30-
$json = false;
30+
$isJson = false;
3131
foreach (array_reverse($response->getInfo('raw_headers')) as $h) {
3232
if (0 === strpos($h, 'HTTP/')) {
3333
if ($httpCodeFound) {
@@ -40,7 +40,7 @@ public function __construct(ResponseInterface $response)
4040

4141
if (0 === stripos($h, 'content-type:')) {
4242
if (preg_match('/\bjson\b/i', $h)) {
43-
$json = true;
43+
$isJson = true;
4444
}
4545

4646
if ($httpCodeFound) {
@@ -52,15 +52,15 @@ public function __construct(ResponseInterface $response)
5252
// Try to guess a better error message using common API error formats
5353
// The MIME type isn't explicitly checked because some formats inherit from others
5454
// Ex: JSON:API follows RFC 7807 semantics, Hydra can be used in any JSON-LD-compatible format
55-
if ($json && $body = json_decode($response->getContent(false), true)) {
55+
if ($isJson && $body = json_decode($response->getContent(false), true)) {
5656
if (isset($body['hydra:title']) || isset($body['hydra:description'])) {
5757
// see http://www.hydra-cg.com/spec/latest/core/#description-of-http-status-codes-and-errors
58-
$sep = isset($body['hydra:title'], $body['hydra:description']) ? "\n\n" : '';
59-
$message = ($body['hydra:title'] ?? '').$sep.($body['hydra:description'] ?? '');
58+
$separator = isset($body['hydra:title'], $body['hydra:description']) ? "\n\n" : '';
59+
$message = ($body['hydra:title'] ?? '').$separator.($body['hydra:description'] ?? '');
6060
} elseif (isset($body['title']) || isset($body['detail'])) {
6161
// see RFC 7807 and https://jsonapi.org/format/#error-objects
62-
$sep = isset($body['title'], $body['detail']) ? "\n\n" : '';
63-
$message = ($body['title'] ?? '').$sep.($body['detail'] ?? '');
62+
$separator = isset($body['title'], $body['detail']) ? "\n\n" : '';
63+
$message = ($body['title'] ?? '').$separator.($body['detail'] ?? '');
6464
}
6565
}
6666

0 commit comments

Comments
 (0)
0