Commit 6542c720 authored by Bas de Nooijer's avatar Bas de Nooijer

Code style fixes

parent d9182d68
......@@ -392,8 +392,7 @@ class Solarium_Client extends Solarium_Configurable
public function removePlugin($plugin)
{
if (is_object($plugin)) {
foreach ($this->_plugins as $key => $instance)
{
foreach ($this->_plugins as $key => $instance) {
if ($instance === $plugin) {
unset($this->_plugins[$key]);
break;
......
......@@ -93,8 +93,9 @@ class Solarium_Client_Adapter_PeclHttp extends Solarium_Client_Adapter
if (!isset($options['headers']['Content-Type'])) {
$options['headers']['Content-Type'] = 'text/xml; charset=utf-8';
}
$httpResponse = http_post_data($uri, $request->getRawData(),
$options);
$httpResponse = http_post_data(
$uri, $request->getRawData(), $options
);
} else if ($method == Solarium_Client_Request::METHOD_GET) {
$httpResponse = http_get($uri, $options);
} else if ($method == Solarium_Client_Request::METHOD_HEAD) {
......@@ -108,8 +109,9 @@ class Solarium_Client_Adapter_PeclHttp extends Solarium_Client_Adapter
if ($message = http_parse_message($httpResponse)) {
$data = $message->body;
if ($firstPositionOfCRLF = strpos($httpResponse, "\r\n\r\n")) {
$headersAsString = substr($httpResponse, 0,
$firstPositionOfCRLF);
$headersAsString = substr(
$httpResponse, 0, $firstPositionOfCRLF
);
$headers = explode("\n", $headersAsString);
}
}
......
......@@ -80,7 +80,7 @@ class Solarium_Client_RequestBuilder_Select_Component_Highlighting
$request->addParam('hl.regex.maxAnalyzedChars', $component->getRegexMaxAnalyzedChars());
// set per-field highlighting params
foreach($component->getFields() as $field) {
foreach ($component->getFields() as $field) {
$this->_addFieldParams($field, $request);
}
......
......@@ -71,8 +71,6 @@ class Solarium_Client_RequestBuilder_Select_Component_Spellcheck
$request->addParam('spellcheck.collateExtendedResults', $component->getCollateExtendedResults());
$request->addParam('spellcheck.accuracy', $component->getAccuracy());
return $request;
}
}
\ No newline at end of file
......@@ -54,7 +54,7 @@ class Solarium_Client_ResponseParser_Analysis_Document extends Solarium_Client_R
protected function _parseAnalysis($data)
{
$documents = array();
foreach($data as $documentKey => $documentData) {
foreach ($data as $documentKey => $documentData) {
$fields = $this->_parseTypes($documentData);
$documents[] = new Solarium_Result_Analysis_List($documentKey, $fields);
}
......
......@@ -77,7 +77,7 @@ class Solarium_Client_ResponseParser_Analysis_Field extends Solarium_Client_Resp
protected function _parseAnalysis($data)
{
$types = array();
foreach($data as $documentKey => $documentData) {
foreach ($data as $documentKey => $documentData) {
$fields = $this->_parseTypes($documentData);
$types[] = new Solarium_Result_Analysis_List($documentKey, $fields);
}
......@@ -100,18 +100,18 @@ class Solarium_Client_ResponseParser_Analysis_Field extends Solarium_Client_Resp
foreach ($fieldData as $typeKey => $typeData) {
// fix for extra level for key fields
if(count($typeData) == 1){
if (count($typeData) == 1){
$typeData = current($typeData);
}
$counter = 0;
$classes = array();
while(isset($typeData[$counter]) && isset($typeData[$counter+1])) {
while (isset($typeData[$counter]) && isset($typeData[$counter+1])) {
$class = $typeData[$counter];
$analysis = $typeData[$counter+1];
$items = array();
foreach($analysis AS $itemData) {
foreach ($analysis AS $itemData) {
$items[] = new Solarium_Result_Analysis_Item($itemData);
}
......
......@@ -56,7 +56,11 @@ class Solarium_Client_ResponseParser_Select_Component_Spellcheck
public function parse($query, $spellcheck, $data)
{
$results = array();
if (isset($data['spellcheck']['suggestions']) && is_array($data['spellcheck']['suggestions']) && count($data['spellcheck']['suggestions']) > 0) {
if (
isset($data['spellcheck']['suggestions']) &&
is_array($data['spellcheck']['suggestions']) &&
count($data['spellcheck']['suggestions']) > 0
) {
$spellcheckResults = $data['spellcheck']['suggestions'];
......@@ -144,7 +148,7 @@ class Solarium_Client_ResponseParser_Select_Component_Spellcheck
$endOffset = (isset($value['endOffset'])) ? $value['endOffset'] : null;
$originalFrequency = (isset($value['origFreq'])) ? $value['origFreq'] : null;
if(is_string($value['suggestion'][0])) {
if (is_string($value['suggestion'][0])) {
$word = $value['suggestion'][0];
$frequency = null;
} else {
......
......@@ -564,7 +564,7 @@ class Solarium_Query_Select extends Solarium_Query
}
if (array_key_exists($key, $this->_filterQueries)) {
if($this->_filterQueries[$key] === $filterQuery) {
if ($this->_filterQueries[$key] === $filterQuery) {
//double add calls for the same FQ are ignored
//@todo add trigger_error with a notice?
} else {
......@@ -765,8 +765,7 @@ class Solarium_Query_Select extends Solarium_Query
public function removeComponent($component)
{
if (is_object($component)) {
foreach ($this->_components as $key => $instance)
{
foreach ($this->_components as $key => $instance) {
if ($instance === $component) {
unset($this->_components[$key]);
break;
......
......@@ -267,7 +267,7 @@ class Solarium_Query_Select_Component_FacetSet extends Solarium_Query_Select_Com
}
if (array_key_exists($key, $this->_facets)) {
if($this->_facets[$key] === $facet) {
if ($this->_facets[$key] === $facet) {
//double add calls for the same facet are ignored
//@todo add trigger_error with a notice?
} else {
......
......@@ -99,7 +99,7 @@ class Solarium_Query_Select_Component_Highlighting extends Solarium_Query_Select
{
if (isset($this->_fields[$name])) {
return $this->_fields[$name];
} else if($autocreate) {
} else if ($autocreate) {
$this->addField($name);
return $this->_fields[$name];
} else {
......
......@@ -207,8 +207,7 @@ class Solarium_Query_Update extends Solarium_Query
public function remove($command)
{
if (is_object($command)) {
foreach ($this->_commands as $key => $instance)
{
foreach ($this->_commands as $key => $instance) {
if ($instance === $command) {
unset($this->_commands[$key]);
break;
......
......@@ -145,7 +145,7 @@ class Solarium_Result_Analysis_Document extends Solarium_Result_QueryType
{
$this->_parseResponse();
if(isset($this->_items[$key])) {
if (isset($this->_items[$key])) {
return $this->_items[$key];
} else {
return null;
......
......@@ -52,8 +52,7 @@ class Solarium_Result_Analysis_Types extends Solarium_Result_Analysis_List
*/
public function getIndexAnalysis()
{
foreach($this->_items AS $item)
{
foreach ($this->_items AS $item) {
if ($item->getName() == 'index') {
return $item;
}
......@@ -69,8 +68,7 @@ class Solarium_Result_Analysis_Types extends Solarium_Result_Analysis_List
*/
public function getQueryAnalysis()
{
foreach($this->_items AS $item)
{
foreach ($this->_items AS $item) {
if ($item->getName() == 'query') {
return $item;
}
......
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