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 124 additions and 14 deletions
......@@ -58,10 +58,14 @@ abstract class AbstractAggregation implements NamedBuilderInterface
/**
* @param string $field
*
* @return $this
*/
public function setField($field)
{
$this->field = $field;
return $this;
}
/**
......
......@@ -50,13 +50,15 @@ class ChildrenAggregation extends AbstractAggregation
}
/**
* Sets children.
*
* @param string $children
*
* @return $this
*/
public function setChildren($children)
{
$this->children = $children;
return $this;
}
/**
......
......@@ -103,11 +103,13 @@ class CompositeAggregation extends AbstractAggregation
*
* @param int $size Size
*
* @return void
* @return $this
*/
public function setSize($size)
{
$this->size = $size;
return $this;
}
/**
......@@ -125,11 +127,13 @@ class CompositeAggregation extends AbstractAggregation
*
* @param array $after After
*
* @return void
* @return $this
*/
public function setAfter(array $after)
{
$this->after = $after;
return $this;
}
/**
......
......@@ -59,18 +59,26 @@ class DateHistogramAggregation extends AbstractAggregation
/**
* @param string $interval
*
* @return $this
*/
public function setInterval($interval)
{
$this->interval = $interval;
return $this;
}
/**
* @param string $format
*
* @return $this
*/
public function setFormat($format)
{
$this->format = $format;
return $this;
}
/**
......
......@@ -58,10 +58,14 @@ class DateRangeAggregation extends AbstractAggregation
/**
* @param string $format
*
* @return $this
*/
public function setFormat($format)
{
$this->format = $format;
return $this;
}
/**
......
......@@ -54,10 +54,14 @@ class DiversifiedSamplerAggregation extends AbstractAggregation
/**
* @param mixed $shardSize
*
* @return $this
*/
public function setShardSize($shardSize)
{
$this->shardSize = $shardSize;
return $this;
}
/**
......
......@@ -45,13 +45,15 @@ class FilterAggregation extends AbstractAggregation
}
/**
* Sets a filter.
*
* @param BuilderInterface $filter
*
* @return $this
*/
public function setFilter(BuilderInterface $filter)
{
$this->filter = $filter;
return $this;
}
/**
......
......@@ -58,7 +58,7 @@ class FiltersAggregation extends AbstractAggregation
/**
* @param bool $anonymous
*
* @return FiltersAggregation
* @return $this
*/
public function setAnonymous($anonymous)
{
......
......@@ -78,10 +78,14 @@ class GeoDistanceAggregation extends AbstractAggregation
/**
* @param mixed $origin
*
* @return $this
*/
public function setOrigin($origin)
{
$this->origin = $origin;
return $this;
}
/**
......@@ -94,10 +98,14 @@ class GeoDistanceAggregation extends AbstractAggregation
/**
* @param string $distanceType
*
* @return $this
*/
public function setDistanceType($distanceType)
{
$this->distanceType = $distanceType;
return $this;
}
/**
......@@ -110,10 +118,14 @@ class GeoDistanceAggregation extends AbstractAggregation
/**
* @param string $unit
*
* @return $this
*/
public function setUnit($unit)
{
$this->unit = $unit;
return $this;
}
/**
......
......@@ -67,10 +67,14 @@ class GeoHashGridAggregation extends AbstractAggregation
/**
* @param int $precision
*
* @return $this
*/
public function setPrecision($precision)
{
$this->precision = $precision;
return $this;
}
/**
......@@ -83,10 +87,14 @@ class GeoHashGridAggregation extends AbstractAggregation
/**
* @param int $size
*
* @return $this
*/
public function setSize($size)
{
$this->size = $size;
return $this;
}
/**
......@@ -99,10 +107,14 @@ class GeoHashGridAggregation extends AbstractAggregation
/**
* @param int $shardSize
*
* @return $this
*/
public function setShardSize($shardSize)
{
$this->shardSize = $shardSize;
return $this;
}
/**
......
......@@ -102,10 +102,14 @@ class HistogramAggregation extends AbstractAggregation
* Get response as a hash instead keyed by the buckets keys.
*
* @param bool $keyed
*
* @return $this
*/
public function setKeyed($keyed)
{
$this->keyed = $keyed;
return $this;
}
/**
......@@ -113,11 +117,15 @@ class HistogramAggregation extends AbstractAggregation
*
* @param string $mode
* @param string $direction
*
* @return $this
*/
public function setOrder($mode, $direction = self::DIRECTION_ASC)
{
$this->orderMode = $mode;
$this->orderDirection = $direction;
return $this;
}
/**
......@@ -142,10 +150,14 @@ class HistogramAggregation extends AbstractAggregation
/**
* @param int $interval
*
* @return $this
*/
public function setInterval($interval)
{
$this->interval = $interval;
return $this;
}
/**
......@@ -160,10 +172,14 @@ class HistogramAggregation extends AbstractAggregation
* Set limit for document count buckets should have.
*
* @param int $minDocCount
*
* @return $this
*/
public function setMinDocCount($minDocCount)
{
$this->minDocCount = $minDocCount;
return $this;
}
/**
......@@ -177,6 +193,8 @@ class HistogramAggregation extends AbstractAggregation
/**
* @param int $min
* @param int $max
*
* @return $this
*/
public function setExtendedBounds($min = null, $max = null)
{
......@@ -188,6 +206,8 @@ class HistogramAggregation extends AbstractAggregation
'strlen'
);
$this->extendedBounds = $bounds;
return $this;
}
/**
......
......@@ -52,13 +52,15 @@ class NestedAggregation extends AbstractAggregation
}
/**
* Sets path.
*
* @param string $path
*
* @return $this
*/
public function setPath($path)
{
$this->path = $path;
return $this;
}
/**
......
......@@ -60,7 +60,7 @@ class RangeAggregation extends AbstractAggregation
*
* @param bool $keyed
*
* @return RangeAggregation
* @return $this
*/
public function setKeyed($keyed)
{
......
......@@ -52,13 +52,15 @@ class ReverseNestedAggregation extends AbstractAggregation
}
/**
* Sets path.
*
* @param string $path
*
* @return $this
*/
public function setPath($path)
{
$this->path = $path;
return $this;
}
/**
......
......@@ -54,10 +54,14 @@ class SamplerAggregation extends AbstractAggregation
/**
* @param int $shardSize
*
* @return $this
*/
public function setShardSize($shardSize)
{
$this->shardSize = $shardSize;
return $this;
}
/**
......
......@@ -60,10 +60,14 @@ class MaxAggregation extends AbstractAggregation
/**
* @param string $mode
*
* @return $this
*/
public function setMode($mode)
{
$this->mode = $mode;
return $this;
}
/**
......@@ -76,10 +80,14 @@ class MaxAggregation extends AbstractAggregation
/**
* @param array $missing
*
* @return $this
*/
public function setMissing($missing)
{
$this->missing = $missing;
return $this;
}
/**
......
......@@ -58,13 +58,15 @@ class CardinalityAggregation extends AbstractAggregation
}
/**
* Precision threshold.
* @param int $precision
*
* @param int $precision Precision Threshold.
* @return $this
*/
public function setPrecisionThreshold($precision)
{
$this->precisionThreshold = $precision;
return $this;
}
/**
......@@ -85,10 +87,14 @@ class CardinalityAggregation extends AbstractAggregation
/**
* @param bool $rehash
*
* @return $this
*/
public function setRehash($rehash)
{
$this->rehash = $rehash;
return $this;
}
/**
......
......@@ -57,10 +57,14 @@ class ExtendedStatsAggregation extends AbstractAggregation
/**
* @param int $sigma
*
* @return $this
*/
public function setSigma($sigma)
{
$this->sigma = $sigma;
return $this;
}
/**
......
......@@ -53,10 +53,14 @@ class GeoBoundsAggregation extends AbstractAggregation
/**
* @param bool $wrapLongitude
*
* @return $this
*/
public function setWrapLongitude($wrapLongitude)
{
$this->wrapLongitude = $wrapLongitude;
return $this;
}
/**
......
......@@ -64,10 +64,14 @@ class PercentileRanksAggregation extends AbstractAggregation
/**
* @param array $values
*
* @return $this
*/
public function setValues($values)
{
$this->values = $values;
return $this;
}
/**
......@@ -80,10 +84,14 @@ class PercentileRanksAggregation extends AbstractAggregation
/**
* @param int $compression
*
* @return $this
*/
public function setCompression($compression)
{
$this->compression = $compression;
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