Commit 625fe984 authored by Bas de Nooijer's avatar Bas de Nooijer Committed by GitHub

Merge pull request #509 from localheinz/fix/default

Fix: Move assignment of default values before condition
parents d25ae0d8 7685d2f5
......@@ -183,10 +183,10 @@ class Http extends Configurable implements AdapterInterface
// @codeCoverageIgnoreStart
$data = @file_get_contents($uri, false, $context);
$headers = array();
if (isset($http_response_header)) {
$headers = $http_response_header;
} else {
$headers = array();
}
return array($data, $headers);
......
......@@ -460,10 +460,10 @@ class Helper
*/
public function cacheControl($useCache, $cost = null)
{
$cache = 'false';
if ($useCache === true) {
$cache = 'true';
} else {
$cache = 'false';
}
$result = '{!cache='.$cache;
......
......@@ -64,10 +64,10 @@ class Field extends ResponseParserAbstract implements ResponseParserInterface
{
$data = $result->getData();
$items = array();
if (isset($data['analysis'])) {
$items = $this->parseAnalysis($result, $data['analysis']);
} else {
$items = array();
}
return $this->addHeaderInfo($data, array('items' => $items));
......
......@@ -95,16 +95,16 @@ class ResponseParser extends ResponseParserAbstract implements ResponseParserInt
}
}
$numFound = null;
if (isset($data['response']['numFound'])) {
$numFound = $data['response']['numFound'];
} else {
$numFound = null;
}
$maxScore = null;
if (isset($data['response']['maxScore'])) {
$maxScore = $data['response']['maxScore'];
} else {
$maxScore = null;
}
return $this->addHeaderInfo(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment