Skip to content
Snippets Groups Projects
Commit e0273b1f authored by Timothy Winters's avatar Timothy Winters Committed by Simonas Šerlinskas
Browse files

Consistent chainable mutator behavior (#295)

parent 37709576
No related branches found
No related tags found
No related merge requests found
Showing
with 162 additions and 15 deletions
...@@ -64,10 +64,14 @@ class PercentilesAggregation extends AbstractAggregation ...@@ -64,10 +64,14 @@ class PercentilesAggregation extends AbstractAggregation
/** /**
* @param array $percents * @param array $percents
*
* @return $this
*/ */
public function setPercents($percents) public function setPercents($percents)
{ {
$this->percents = $percents; $this->percents = $percents;
return $this;
} }
/** /**
...@@ -80,10 +84,14 @@ class PercentilesAggregation extends AbstractAggregation ...@@ -80,10 +84,14 @@ class PercentilesAggregation extends AbstractAggregation
/** /**
* @param int $compression * @param int $compression
*
* @return $this
*/ */
public function setCompression($compression) public function setCompression($compression)
{ {
$this->compression = $compression; $this->compression = $compression;
return $this;
} }
/** /**
......
...@@ -85,10 +85,14 @@ class ScriptedMetricAggregation extends AbstractAggregation ...@@ -85,10 +85,14 @@ class ScriptedMetricAggregation extends AbstractAggregation
/** /**
* @param mixed $initScript * @param mixed $initScript
*
* @return $this
*/ */
public function setInitScript($initScript) public function setInitScript($initScript)
{ {
$this->initScript = $initScript; $this->initScript = $initScript;
return $this;
} }
/** /**
...@@ -101,10 +105,14 @@ class ScriptedMetricAggregation extends AbstractAggregation ...@@ -101,10 +105,14 @@ class ScriptedMetricAggregation extends AbstractAggregation
/** /**
* @param mixed $mapScript * @param mixed $mapScript
*
* @return $this
*/ */
public function setMapScript($mapScript) public function setMapScript($mapScript)
{ {
$this->mapScript = $mapScript; $this->mapScript = $mapScript;
return $this;
} }
/** /**
...@@ -117,10 +125,14 @@ class ScriptedMetricAggregation extends AbstractAggregation ...@@ -117,10 +125,14 @@ class ScriptedMetricAggregation extends AbstractAggregation
/** /**
* @param mixed $combineScript * @param mixed $combineScript
*
* @return $this
*/ */
public function setCombineScript($combineScript) public function setCombineScript($combineScript)
{ {
$this->combineScript = $combineScript; $this->combineScript = $combineScript;
return $this;
} }
/** /**
...@@ -133,10 +145,14 @@ class ScriptedMetricAggregation extends AbstractAggregation ...@@ -133,10 +145,14 @@ class ScriptedMetricAggregation extends AbstractAggregation
/** /**
* @param mixed $reduceScript * @param mixed $reduceScript
*
* @return $this
*/ */
public function setReduceScript($reduceScript) public function setReduceScript($reduceScript)
{ {
$this->reduceScript = $reduceScript; $this->reduceScript = $reduceScript;
return $this;
} }
/** /**
......
...@@ -66,13 +66,15 @@ class TopHitsAggregation extends AbstractAggregation ...@@ -66,13 +66,15 @@ class TopHitsAggregation extends AbstractAggregation
} }
/** /**
* Set from.
*
* @param int $from * @param int $from
*
* @return $this
*/ */
public function setFrom($from) public function setFrom($from)
{ {
$this->from = $from; $this->from = $from;
return $this;
} }
/** /**
...@@ -85,10 +87,14 @@ class TopHitsAggregation extends AbstractAggregation ...@@ -85,10 +87,14 @@ class TopHitsAggregation extends AbstractAggregation
/** /**
* @param BuilderInterface[] $sorts * @param BuilderInterface[] $sorts
*
* @return $this
*/ */
public function setSorts(array $sorts) public function setSorts(array $sorts)
{ {
$this->sorts = $sorts; $this->sorts = $sorts;
return $this;
} }
/** /**
...@@ -102,13 +108,15 @@ class TopHitsAggregation extends AbstractAggregation ...@@ -102,13 +108,15 @@ class TopHitsAggregation extends AbstractAggregation
} }
/** /**
* Set size.
*
* @param int $size * @param int $size
*
* @return $this
*/ */
public function setSize($size) public function setSize($size)
{ {
$this->size = $size; $this->size = $size;
return $this;
} }
/** /**
...@@ -176,12 +184,14 @@ class TopHitsAggregation extends AbstractAggregation ...@@ -176,12 +184,14 @@ class TopHitsAggregation extends AbstractAggregation
/** /**
* @deprecated sorts now is a container, use `addSort()`instead. * @deprecated sorts now is a container, use `addSort()`instead.
* *
* Set sort.
*
* @param BuilderInterface $sort * @param BuilderInterface $sort
*
* @return $this
*/ */
public function setSort(BuilderInterface $sort) public function setSort(BuilderInterface $sort)
{ {
$this->sort = $sort; $this->sort = $sort;
return $this;
} }
} }
...@@ -34,10 +34,14 @@ abstract class AbstractPipelineAggregation extends AbstractAggregation ...@@ -34,10 +34,14 @@ abstract class AbstractPipelineAggregation extends AbstractAggregation
/** /**
* @param string $bucketsPath * @param string $bucketsPath
*
* @return $this
*/ */
public function setBucketsPath($bucketsPath) public function setBucketsPath($bucketsPath)
{ {
$this->bucketsPath = $bucketsPath; $this->bucketsPath = $bucketsPath;
return $this;
} }
/** /**
......
...@@ -44,10 +44,14 @@ class BucketScriptAggregation extends AbstractPipelineAggregation ...@@ -44,10 +44,14 @@ class BucketScriptAggregation extends AbstractPipelineAggregation
/** /**
* @param string $script * @param string $script
*
* @return $this
*/ */
public function setScript($script) public function setScript($script)
{ {
$this->script = $script; $this->script = $script;
return $this;
} }
/** /**
......
...@@ -53,11 +53,13 @@ class BucketSortAggregation extends AbstractPipelineAggregation ...@@ -53,11 +53,13 @@ class BucketSortAggregation extends AbstractPipelineAggregation
/** /**
* @param string $sort * @param string $sort
* @return self *
* @return $this
*/ */
public function setSort($sort) public function setSort($sort)
{ {
$this->sort = $sort; $this->sort = $sort;
return $this; return $this;
} }
......
...@@ -41,10 +41,14 @@ class PercentilesBucketAggregation extends AbstractPipelineAggregation ...@@ -41,10 +41,14 @@ class PercentilesBucketAggregation extends AbstractPipelineAggregation
/** /**
* @param array $percents * @param array $percents
*
* @return $this
*/ */
public function setPercents(array $percents) public function setPercents(array $percents)
{ {
$this->percents = $percents; $this->percents = $percents;
return $this;
} }
/** /**
......
...@@ -27,10 +27,14 @@ trait FieldAwareTrait ...@@ -27,10 +27,14 @@ trait FieldAwareTrait
} }
/** /**
* @param mixed $field * @param string $field
*
* @return $this
*/ */
public function setField($field) public function setField($field)
{ {
$this->field = $field; $this->field = $field;
return $this;
} }
} }
...@@ -27,10 +27,14 @@ trait NameAwareTrait ...@@ -27,10 +27,14 @@ trait NameAwareTrait
} }
/** /**
* @param mixed $name * @param string $name
*
* @return $this
*/ */
public function setName($name) public function setName($name)
{ {
$this->name = $name; $this->name = $name;
return $this;
} }
} }
...@@ -77,13 +77,15 @@ trait ParametersTrait ...@@ -77,13 +77,15 @@ trait ParametersTrait
} }
/** /**
* Sets an array of parameters.
*
* @param array $parameters * @param array $parameters
*
* @return $this
*/ */
public function setParameters(array $parameters) public function setParameters(array $parameters)
{ {
$this->parameters = $parameters; $this->parameters = $parameters;
return $this;
} }
/** /**
......
...@@ -52,11 +52,13 @@ class FieldMaskingSpanQuery implements SpanQueryInterface ...@@ -52,11 +52,13 @@ class FieldMaskingSpanQuery implements SpanQueryInterface
/** /**
* @param mixed $query * @param mixed $query
* @return self *
* @return $this
*/ */
public function setQuery($query) public function setQuery($query)
{ {
$this->query = $query; $this->query = $query;
return $this; return $this;
} }
...@@ -70,11 +72,13 @@ class FieldMaskingSpanQuery implements SpanQueryInterface ...@@ -70,11 +72,13 @@ class FieldMaskingSpanQuery implements SpanQueryInterface
/** /**
* @param string $field * @param string $field
* @return FieldMaskingSpanQuery *
* @return $this
*/ */
public function setField($field) public function setField($field)
{ {
$this->field = $field; $this->field = $field;
return $this; return $this;
} }
......
...@@ -52,10 +52,14 @@ class SpanContainingQuery implements SpanQueryInterface ...@@ -52,10 +52,14 @@ class SpanContainingQuery implements SpanQueryInterface
/** /**
* @param SpanQueryInterface $little * @param SpanQueryInterface $little
*
* @return $this
*/ */
public function setLittle(SpanQueryInterface $little) public function setLittle(SpanQueryInterface $little)
{ {
$this->little = $little; $this->little = $little;
return $this;
} }
/** /**
...@@ -68,10 +72,14 @@ class SpanContainingQuery implements SpanQueryInterface ...@@ -68,10 +72,14 @@ class SpanContainingQuery implements SpanQueryInterface
/** /**
* @param SpanQueryInterface $big * @param SpanQueryInterface $big
*
* @return $this
*/ */
public function setBig(SpanQueryInterface $big) public function setBig(SpanQueryInterface $big)
{ {
$this->big = $big; $this->big = $big;
return $this;
} }
/** /**
......
...@@ -33,10 +33,14 @@ class SpanNearQuery extends SpanOrQuery implements SpanQueryInterface ...@@ -33,10 +33,14 @@ class SpanNearQuery extends SpanOrQuery implements SpanQueryInterface
/** /**
* @param int $slop * @param int $slop
*
* @return $this
*/ */
public function setSlop($slop) public function setSlop($slop)
{ {
$this->slop = $slop; $this->slop = $slop;
return $this;
} }
/** /**
......
...@@ -60,10 +60,14 @@ class TemplateQuery implements BuilderInterface ...@@ -60,10 +60,14 @@ class TemplateQuery implements BuilderInterface
/** /**
* @param string $file * @param string $file
*
* @return $this;
*/ */
public function setFile($file) public function setFile($file)
{ {
$this->file = $file; $this->file = $file;
return $this;
} }
/** /**
...@@ -76,10 +80,14 @@ class TemplateQuery implements BuilderInterface ...@@ -76,10 +80,14 @@ class TemplateQuery implements BuilderInterface
/** /**
* @param string $inline * @param string $inline
*
* @return $this
*/ */
public function setInline($inline) public function setInline($inline)
{ {
$this->inline = $inline; $this->inline = $inline;
return $this;
} }
/** /**
...@@ -92,10 +100,14 @@ class TemplateQuery implements BuilderInterface ...@@ -92,10 +100,14 @@ class TemplateQuery implements BuilderInterface
/** /**
* @param array $params * @param array $params
*
* @return $this
*/ */
public function setParams($params) public function setParams($params)
{ {
$this->params = $params; $this->params = $params;
return $this;
} }
/** /**
......
...@@ -31,9 +31,13 @@ trait ScriptAwareTrait ...@@ -31,9 +31,13 @@ trait ScriptAwareTrait
/** /**
* @param string $script * @param string $script
*
* @return $this
*/ */
public function setScript($script) public function setScript($script)
{ {
$this->script = $script; $this->script = $script;
return $this;
} }
} }
...@@ -259,12 +259,16 @@ class Search ...@@ -259,12 +259,16 @@ class Search
* *
* @param string $endpointName * @param string $endpointName
* @param array $parameters * @param array $parameters
*
* @return $this
*/ */
public function setEndpointParameters($endpointName, array $parameters) public function setEndpointParameters($endpointName, array $parameters)
{ {
/** @var AbstractSearchEndpoint $endpoint */ /** @var AbstractSearchEndpoint $endpoint */
$endpoint = $this->getEndpoint($endpointName); $endpoint = $this->getEndpoint($endpointName);
$endpoint->setParameters($parameters); $endpoint->setParameters($parameters);
return $this;
} }
/** /**
...@@ -447,11 +451,13 @@ class Search ...@@ -447,11 +451,13 @@ class Search
/** /**
* @param int $from * @param int $from
*
* @return $this * @return $this
*/ */
public function setFrom($from) public function setFrom($from)
{ {
$this->from = $from; $this->from = $from;
return $this; return $this;
} }
...@@ -465,11 +471,13 @@ class Search ...@@ -465,11 +471,13 @@ class Search
/** /**
* @param bool $trackTotalHits * @param bool $trackTotalHits
*
* @return $this * @return $this
*/ */
public function setTrackTotalHits(bool $trackTotalHits) public function setTrackTotalHits(bool $trackTotalHits)
{ {
$this->trackTotalHits = $trackTotalHits; $this->trackTotalHits = $trackTotalHits;
return $this; return $this;
} }
...@@ -483,11 +491,13 @@ class Search ...@@ -483,11 +491,13 @@ class Search
/** /**
* @param int $size * @param int $size
*
* @return $this * @return $this
*/ */
public function setSize($size) public function setSize($size)
{ {
$this->size = $size; $this->size = $size;
return $this; return $this;
} }
...@@ -501,11 +511,13 @@ class Search ...@@ -501,11 +511,13 @@ class Search
/** /**
* @param bool $source * @param bool $source
*
* @return $this * @return $this
*/ */
public function setSource($source) public function setSource($source)
{ {
$this->source = $source; $this->source = $source;
return $this; return $this;
} }
...@@ -519,11 +531,13 @@ class Search ...@@ -519,11 +531,13 @@ class Search
/** /**
* @param array $storedFields * @param array $storedFields
*
* @return $this * @return $this
*/ */
public function setStoredFields($storedFields) public function setStoredFields($storedFields)
{ {
$this->storedFields = $storedFields; $this->storedFields = $storedFields;
return $this; return $this;
} }
...@@ -537,11 +551,13 @@ class Search ...@@ -537,11 +551,13 @@ class Search
/** /**
* @param array $scriptFields * @param array $scriptFields
*
* @return $this * @return $this
*/ */
public function setScriptFields($scriptFields) public function setScriptFields($scriptFields)
{ {
$this->scriptFields = $scriptFields; $this->scriptFields = $scriptFields;
return $this; return $this;
} }
...@@ -555,11 +571,13 @@ class Search ...@@ -555,11 +571,13 @@ class Search
/** /**
* @param array $docValueFields * @param array $docValueFields
*
* @return $this * @return $this
*/ */
public function setDocValueFields($docValueFields) public function setDocValueFields($docValueFields)
{ {
$this->docValueFields = $docValueFields; $this->docValueFields = $docValueFields;
return $this; return $this;
} }
...@@ -573,11 +591,13 @@ class Search ...@@ -573,11 +591,13 @@ class Search
/** /**
* @param bool $explain * @param bool $explain
*
* @return $this * @return $this
*/ */
public function setExplain($explain) public function setExplain($explain)
{ {
$this->explain = $explain; $this->explain = $explain;
return $this; return $this;
} }
...@@ -591,11 +611,13 @@ class Search ...@@ -591,11 +611,13 @@ class Search
/** /**
* @param bool $version * @param bool $version
*
* @return $this * @return $this
*/ */
public function setVersion($version) public function setVersion($version)
{ {
$this->version = $version; $this->version = $version;
return $this; return $this;
} }
...@@ -609,11 +631,13 @@ class Search ...@@ -609,11 +631,13 @@ class Search
/** /**
* @param array $indicesBoost * @param array $indicesBoost
*
* @return $this * @return $this
*/ */
public function setIndicesBoost($indicesBoost) public function setIndicesBoost($indicesBoost)
{ {
$this->indicesBoost = $indicesBoost; $this->indicesBoost = $indicesBoost;
return $this; return $this;
} }
...@@ -627,11 +651,13 @@ class Search ...@@ -627,11 +651,13 @@ class Search
/** /**
* @param int $minScore * @param int $minScore
*
* @return $this * @return $this
*/ */
public function setMinScore($minScore) public function setMinScore($minScore)
{ {
$this->minScore = $minScore; $this->minScore = $minScore;
return $this; return $this;
} }
...@@ -645,11 +671,13 @@ class Search ...@@ -645,11 +671,13 @@ class Search
/** /**
* @param array $searchAfter * @param array $searchAfter
*
* @return $this * @return $this
*/ */
public function setSearchAfter($searchAfter) public function setSearchAfter($searchAfter)
{ {
$this->searchAfter = $searchAfter; $this->searchAfter = $searchAfter;
return $this; return $this;
} }
...@@ -663,6 +691,7 @@ class Search ...@@ -663,6 +691,7 @@ class Search
/** /**
* @param string $scroll * @param string $scroll
*
* @return $this * @return $this
*/ */
public function setScroll($scroll = '5m') public function setScroll($scroll = '5m')
......
...@@ -61,11 +61,13 @@ class FieldSort implements BuilderInterface ...@@ -61,11 +61,13 @@ class FieldSort implements BuilderInterface
/** /**
* @param string $field * @param string $field
* @return self *
* @return $this
*/ */
public function setField($field) public function setField($field)
{ {
$this->field = $field; $this->field = $field;
return $this; return $this;
} }
...@@ -79,11 +81,13 @@ class FieldSort implements BuilderInterface ...@@ -79,11 +81,13 @@ class FieldSort implements BuilderInterface
/** /**
* @param string $order * @param string $order
* @return self *
* @return $this
*/ */
public function setOrder($order) public function setOrder($order)
{ {
$this->order = $order; $this->order = $order;
return $this; return $this;
} }
...@@ -97,10 +101,14 @@ class FieldSort implements BuilderInterface ...@@ -97,10 +101,14 @@ class FieldSort implements BuilderInterface
/** /**
* @param BuilderInterface $nestedFilter * @param BuilderInterface $nestedFilter
*
* @return $this
*/ */
public function setNestedFilter(BuilderInterface $nestedFilter) public function setNestedFilter(BuilderInterface $nestedFilter)
{ {
$this->nestedFilter = $nestedFilter; $this->nestedFilter = $nestedFilter;
return $this;
} }
/** /**
......
...@@ -111,9 +111,13 @@ class NestedSort implements BuilderInterface ...@@ -111,9 +111,13 @@ class NestedSort implements BuilderInterface
/** /**
* @param BuilderInterface $nestedFilter * @param BuilderInterface $nestedFilter
*
* @return $this
*/ */
public function setNestedFilter(BuilderInterface $nestedFilter) public function setNestedFilter(BuilderInterface $nestedFilter)
{ {
$this->nestedFilter = $nestedFilter; $this->nestedFilter = $nestedFilter;
return $this;
} }
} }
...@@ -58,10 +58,14 @@ class Suggest implements NamedBuilderInterface ...@@ -58,10 +58,14 @@ class Suggest implements NamedBuilderInterface
/** /**
* @param string $name * @param string $name
*
* @return $this
*/ */
public function setName($name) public function setName($name)
{ {
$this->name = $name; $this->name = $name;
return $this;
} }
/** /**
...@@ -86,10 +90,14 @@ class Suggest implements NamedBuilderInterface ...@@ -86,10 +90,14 @@ class Suggest implements NamedBuilderInterface
/** /**
* @param string $type * @param string $type
*
* @return $this
*/ */
public function setType($type) public function setType($type)
{ {
$this->type = $type; $this->type = $type;
return $this;
} }
/** /**
...@@ -102,10 +110,14 @@ class Suggest implements NamedBuilderInterface ...@@ -102,10 +110,14 @@ class Suggest implements NamedBuilderInterface
/** /**
* @param string $text * @param string $text
*
* @return $this
*/ */
public function setText($text) public function setText($text)
{ {
$this->text = $text; $this->text = $text;
return $this;
} }
/** /**
...@@ -118,10 +130,14 @@ class Suggest implements NamedBuilderInterface ...@@ -118,10 +130,14 @@ class Suggest implements NamedBuilderInterface
/** /**
* @param string $field * @param string $field
*
* @return $this
*/ */
public function setField($field) public function setField($field)
{ {
$this->field = $field; $this->field = $field;
return $this;
} }
/** /**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment