Skip to content

Commit

Permalink
Merge 87e3b82 into 7f6f0cb
Browse files Browse the repository at this point in the history
  • Loading branch information
deguif committed Oct 27, 2020
2 parents 7f6f0cb + 87e3b82 commit 85acab0
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 18 deletions.
2 changes: 1 addition & 1 deletion src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ public function requestEndpoint(AbstractEndpoint $endpoint): Response
return $this->request(
\ltrim($endpoint->getURI(), '/'),
$endpoint->getMethod(),
null === $endpoint->getBody() ? [] : $endpoint->getBody(),
$endpoint->getBody() ?? [],
$endpoint->getParams()
);
}
Expand Down
9 changes: 2 additions & 7 deletions src/Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,7 @@ public function getError()
return $error;
}

$rootError = $error;
if (isset($error['root_cause'][0])) {
$rootError = $error['root_cause'][0];
}
$rootError = $error['root_cause'][0] ?? $error;

$message = $rootError['reason'];
if (isset($rootError['index'])) {
Expand All @@ -117,9 +114,7 @@ public function getFullError()
{
$response = $this->getData();

if (isset($response['error'])) {
return $response['error'];
}
return $response['error'] ?? null;
}

/**
Expand Down
6 changes: 1 addition & 5 deletions src/Result.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,7 @@ public function __isset($key): bool
*/
public function getParam($name)
{
if (isset($this->_hit[$name])) {
return $this->_hit[$name];
}

return [];
return $this->_hit[$name] ?? [];
}

/**
Expand Down
6 changes: 1 addition & 5 deletions src/Transport/AbstractTransport.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,7 @@ public static function create($transport, Connection $connection, array $params
'nulltransport' => 'NullTransport',
];

if (isset($specialTransports[\strtolower($transport)])) {
$transport = $specialTransports[\strtolower($transport)];
} else {
$transport = \ucfirst($transport);
}
$transport = $specialTransports[\strtolower($transport)] ?? \ucfirst($transport);
$classNames = ["Elastica\\Transport\\{$transport}", $transport];
foreach ($classNames as $className) {
if (\class_exists($className)) {
Expand Down

0 comments on commit 85acab0

Please sign in to comment.