Skip to content

Commit e0273b1

Browse files
tw99saimaz
authored andcommitted
Consistent chainable mutator behavior (#295)
1 parent 3770957 commit e0273b1

39 files changed

+286
-29
lines changed

src/Aggregation/AbstractAggregation.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,14 @@ public function __construct($name)
5858

5959
/**
6060
* @param string $field
61+
*
62+
* @return $this
6163
*/
6264
public function setField($field)
6365
{
6466
$this->field = $field;
67+
68+
return $this;
6569
}
6670

6771
/**

src/Aggregation/Bucketing/ChildrenAggregation.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,15 @@ public function __construct($name, $children = null)
5050
}
5151

5252
/**
53-
* Sets children.
54-
*
5553
* @param string $children
54+
*
55+
* @return $this
5656
*/
5757
public function setChildren($children)
5858
{
5959
$this->children = $children;
60+
61+
return $this;
6062
}
6163

6264
/**

src/Aggregation/Bucketing/CompositeAggregation.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,13 @@ public function getType()
103103
*
104104
* @param int $size Size
105105
*
106-
* @return void
106+
* @return $this
107107
*/
108108
public function setSize($size)
109109
{
110110
$this->size = $size;
111+
112+
return $this;
111113
}
112114

113115
/**
@@ -125,11 +127,13 @@ public function getSize()
125127
*
126128
* @param array $after After
127129
*
128-
* @return void
130+
* @return $this
129131
*/
130132
public function setAfter(array $after)
131133
{
132134
$this->after = $after;
135+
136+
return $this;
133137
}
134138

135139
/**

src/Aggregation/Bucketing/DateHistogramAggregation.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,18 +59,26 @@ public function getInterval()
5959

6060
/**
6161
* @param string $interval
62+
*
63+
* @return $this
6264
*/
6365
public function setInterval($interval)
6466
{
6567
$this->interval = $interval;
68+
69+
return $this;
6670
}
6771

6872
/**
6973
* @param string $format
74+
*
75+
* @return $this
7076
*/
7177
public function setFormat($format)
7278
{
7379
$this->format = $format;
80+
81+
return $this;
7482
}
7583

7684
/**

src/Aggregation/Bucketing/DateRangeAggregation.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,14 @@ public function __construct($name, $field = null, $format = null, array $ranges
5858

5959
/**
6060
* @param string $format
61+
*
62+
* @return $this
6163
*/
6264
public function setFormat($format)
6365
{
6466
$this->format = $format;
67+
68+
return $this;
6569
}
6670

6771
/**

src/Aggregation/Bucketing/DiversifiedSamplerAggregation.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,14 @@ public function getShardSize()
5454

5555
/**
5656
* @param mixed $shardSize
57+
*
58+
* @return $this
5759
*/
5860
public function setShardSize($shardSize)
5961
{
6062
$this->shardSize = $shardSize;
63+
64+
return $this;
6165
}
6266

6367
/**

src/Aggregation/Bucketing/FilterAggregation.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,15 @@ public function __construct($name, BuilderInterface $filter = null)
4545
}
4646

4747
/**
48-
* Sets a filter.
49-
*
5048
* @param BuilderInterface $filter
49+
*
50+
* @return $this
5151
*/
5252
public function setFilter(BuilderInterface $filter)
5353
{
5454
$this->filter = $filter;
55+
56+
return $this;
5557
}
5658

5759
/**

src/Aggregation/Bucketing/FiltersAggregation.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public function __construct($name, $filters = [], $anonymous = false)
5858
/**
5959
* @param bool $anonymous
6060
*
61-
* @return FiltersAggregation
61+
* @return $this
6262
*/
6363
public function setAnonymous($anonymous)
6464
{

src/Aggregation/Bucketing/GeoDistanceAggregation.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,14 @@ public function getOrigin()
7878

7979
/**
8080
* @param mixed $origin
81+
*
82+
* @return $this
8183
*/
8284
public function setOrigin($origin)
8385
{
8486
$this->origin = $origin;
87+
88+
return $this;
8589
}
8690

8791
/**
@@ -94,10 +98,14 @@ public function getDistanceType()
9498

9599
/**
96100
* @param string $distanceType
101+
*
102+
* @return $this
97103
*/
98104
public function setDistanceType($distanceType)
99105
{
100106
$this->distanceType = $distanceType;
107+
108+
return $this;
101109
}
102110

103111
/**
@@ -110,10 +118,14 @@ public function getUnit()
110118

111119
/**
112120
* @param string $unit
121+
*
122+
* @return $this
113123
*/
114124
public function setUnit($unit)
115125
{
116126
$this->unit = $unit;
127+
128+
return $this;
117129
}
118130

119131
/**

src/Aggregation/Bucketing/GeoHashGridAggregation.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,14 @@ public function getPrecision()
6767

6868
/**
6969
* @param int $precision
70+
*
71+
* @return $this
7072
*/
7173
public function setPrecision($precision)
7274
{
7375
$this->precision = $precision;
76+
77+
return $this;
7478
}
7579

7680
/**
@@ -83,10 +87,14 @@ public function getSize()
8387

8488
/**
8589
* @param int $size
90+
*
91+
* @return $this
8692
*/
8793
public function setSize($size)
8894
{
8995
$this->size = $size;
96+
97+
return $this;
9098
}
9199

92100
/**
@@ -99,10 +107,14 @@ public function getShardSize()
99107

100108
/**
101109
* @param int $shardSize
110+
*
111+
* @return $this
102112
*/
103113
public function setShardSize($shardSize)
104114
{
105115
$this->shardSize = $shardSize;
116+
117+
return $this;
106118
}
107119

108120
/**

0 commit comments

Comments
 (0)