Skip to content

Commit 86cc03d

Browse files
committed
fix PSR-2 coding standard
1 parent aead830 commit 86cc03d

File tree

1 file changed

+20
-11
lines changed

1 file changed

+20
-11
lines changed

lib/Elastica/Query/FunctionScore.php

+20-11
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?php
22

33
namespace Elastica\Query;
4+
45
use Elastica\Filter\AbstractFilter;
56
use Elastica\Script;
67

@@ -29,7 +30,7 @@ class FunctionScore extends AbstractQuery
2930
const DECAY_EXPONENTIAL = 'exp';
3031
const DECAY_LINEAR = 'linear';
3132

32-
protected $_functions = array();
33+
protected $functions = array();
3334

3435
/**
3536
* Set the child query for this function_score query
@@ -57,7 +58,7 @@ public function setFilter(AbstractFilter $filter)
5758
* @param AbstractFilter $filter optional filter to apply to the function
5859
* @return \Elastica\Query\FunctionScore
5960
*/
60-
public function addFunction($functionType, $functionParams, AbstractFilter $filter = NULL, $weight = null)
61+
public function addFunction($functionType, $functionParams, AbstractFilter $filter = null, $weight = null)
6162
{
6263
$function = array(
6364
$functionType => $functionParams
@@ -68,7 +69,7 @@ public function addFunction($functionType, $functionParams, AbstractFilter $filt
6869
if ($weight !== null) {
6970
$function['weight'] = $weight;
7071
}
71-
$this->_functions[] = $function;
72+
$this->functions[] = $function;
7273
return $this;
7374
}
7475

@@ -79,7 +80,7 @@ public function addFunction($functionType, $functionParams, AbstractFilter $filt
7980
* @param float $weight the weight of the function
8081
* @return \Elastica\Query\FunctionScore
8182
*/
82-
public function addScriptScoreFunction(Script $script, AbstractFilter $filter = NULL, $weight = null)
83+
public function addScriptScoreFunction(Script $script, AbstractFilter $filter = null, $weight = null)
8384
{
8485
return $this->addFunction('script_score', $script->toArray(), $filter, $weight);
8586
}
@@ -90,15 +91,23 @@ public function addScriptScoreFunction(Script $script, AbstractFilter $filter =
9091
* @param string $field the document field on which to perform the decay function
9192
* @param string $origin the origin value for this decay function
9293
* @param string $scale a scale to define the rate of decay for this function
93-
* @param string $offset If defined, this function will only be computed for documents with a distance from the origin greater than this value
94+
* @param string $offset If defined, this function will only be computed for documents
95+
* with a distance from the origin greater than this value
9496
* @param float $decay optionally defines how documents are scored at the distance given by the $scale parameter
9597
* @param float $weight optional factor by which to multiply the score at the value provided by the $scale parameter
9698
* @param AbstractFilter $filter a filter associated with this function
9799
* @return \Elastica\Query\FunctionScore
98100
*/
99-
public function addDecayFunction($function, $field, $origin, $scale, $offset = NULL, $decay = NULL, $weight = NULL,
100-
AbstractFilter $filter = NULL)
101-
{
101+
public function addDecayFunction(
102+
$function,
103+
$field,
104+
$origin,
105+
$scale,
106+
$offset = null,
107+
$decay = null,
108+
$weight = null,
109+
AbstractFilter $filter = null
110+
) {
102111
$functionParams = array(
103112
$field => array(
104113
'origin' => $origin,
@@ -182,7 +191,7 @@ public function setBoostMode($mode)
182191
* @param int $seed Set a seed value to return results in the same random order for consistent pagination.
183192
* @return \Elastica\Query\FunctionScore
184193
*/
185-
public function setRandomScore($seed = NULL)
194+
public function setRandomScore($seed = null)
186195
{
187196
$seedParam = new \stdClass();
188197
if (!is_null($seed)) {
@@ -206,8 +215,8 @@ public function setScoreMode($mode)
206215
*/
207216
public function toArray()
208217
{
209-
if (sizeof($this->_functions)) {
210-
$this->setParam('functions', $this->_functions);
218+
if (sizeof($this->functions)) {
219+
$this->setParam('functions', $this->functions);
211220
}
212221
return parent::toArray();
213222
}

0 commit comments

Comments
 (0)