Skip to content
This repository was archived by the owner on Nov 4, 2021. It is now read-only.

Commit f42e7ad

Browse files
committed
Add/fix docblocks in src
1 parent eba042c commit f42e7ad

25 files changed

+316
-81
lines changed

src/Builders/FilterBuilder.php

Lines changed: 47 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,18 @@ class FilterBuilder extends Builder
3131
public $collapse;
3232

3333
/**
34+
* The select array.
3435
* @var array
3536
*/
3637
public $select = [];
3738

3839
/**
39-
* @param Model $model
40+
* FilterBuilder constructor.
41+
*
42+
* @param \Illuminate\Database\Eloquent\Model $model
4043
* @param callable|null $callback
4144
* @param bool $softDelete
45+
* @return void
4246
*/
4347
public function __construct(Model $model, $callback = null, $softDelete = false)
4448
{
@@ -55,6 +59,8 @@ public function __construct(Model $model, $callback = null, $softDelete = false)
5559
}
5660

5761
/**
62+
* Add a where condition.
63+
*
5864
* @see https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-term-query.html Term query
5965
* @see https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-range-query.html Range query
6066
*
@@ -136,6 +142,8 @@ public function where($field, $value)
136142
}
137143

138144
/**
145+
* Add a whereIn condition.
146+
*
139147
* @see https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-terms-query.html Terms query
140148
*
141149
* @param string $field
@@ -154,6 +162,8 @@ public function whereIn($field, array $value)
154162
}
155163

156164
/**
165+
* Add a whereNotIn condition.
166+
*
157167
* @see https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-terms-query.html Terms query
158168
*
159169
* @param string $field
@@ -172,6 +182,8 @@ public function whereNotIn($field, array $value)
172182
}
173183

174184
/**
185+
* Add a whereBetween condition.
186+
*
175187
* @see https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-range-query.html Range query
176188
*
177189
* @param string $field
@@ -193,6 +205,8 @@ public function whereBetween($field, array $value)
193205
}
194206

195207
/**
208+
* Add a whereNotBetween condition.
209+
*
196210
* @see https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-range-query.html Range query
197211
*
198212
* @param string $field
@@ -214,6 +228,8 @@ public function whereNotBetween($field, array $value)
214228
}
215229

216230
/**
231+
* Add a whereExists condition.
232+
*
217233
* @see https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-exists-query.html Exists query
218234
*
219235
* @param string $field
@@ -231,6 +247,8 @@ public function whereExists($field)
231247
}
232248

233249
/**
250+
* Add a whereNotExists condition
251+
*
234252
* @see https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-exists-query.html Exists query
235253
*
236254
* @param string $field
@@ -248,6 +266,8 @@ public function whereNotExists($field)
248266
}
249267

250268
/**
269+
* Add a whereRegexp condition.
270+
*
251271
* @see https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-regexp-query.html Regexp query
252272
*
253273
* @param string $field
@@ -270,6 +290,8 @@ public function whereRegexp($field, $value, $flags = 'ALL')
270290
}
271291

272292
/**
293+
* Add a whereGeoDistance condition.
294+
*
273295
* @see https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-geo-distance-query.html Geo distance query
274296
*
275297
* @param string $field
@@ -290,6 +312,8 @@ public function whereGeoDistance($field, $value, $distance)
290312
}
291313

292314
/**
315+
* Add a whereGeoBoundingBox condition.
316+
*
293317
* @see https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-geo-bounding-box-query.html Geo bounding box query
294318
*
295319
* @param string $field
@@ -308,6 +332,8 @@ public function whereGeoBoundingBox($field, array $value)
308332
}
309333

310334
/**
335+
* Add a whereGeoPolygon condition.
336+
*
311337
* @see https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-geo-polygon-query.html Geo polygon query
312338
*
313339
* @param string $field
@@ -326,8 +352,10 @@ public function whereGeoPolygon($field, array $points)
326352

327353
return $this;
328354
}
329-
355+
330356
/**
357+
* Add a whereGeoShape condition.
358+
*
331359
* @see https://www.elastic.co/guide/en/elasticsearch/guide/current/querying-geo-shapes.html Querying Geo Shapes
332360
*
333361
* @param string $field
@@ -346,8 +374,10 @@ public function whereGeoShape($field, array $shape)
346374

347375
return $this;
348376
}
349-
377+
350378
/**
379+
* Add a orderBy clause.
380+
*
351381
* @param string $field
352382
* @param string $direction
353383
* @return $this
@@ -362,6 +392,8 @@ public function orderBy($field, $direction = 'asc')
362392
}
363393

364394
/**
395+
* Explain the request.
396+
*
365397
* @return array
366398
*/
367399
public function explain()
@@ -372,6 +404,8 @@ public function explain()
372404
}
373405

374406
/**
407+
* Profile the request.
408+
*
375409
* @return array
376410
*/
377411
public function profile()
@@ -382,6 +416,7 @@ public function profile()
382416
}
383417

384418
/**
419+
* Build the payload.
385420
* @return array
386421
*/
387422
public function buildPayload()
@@ -392,6 +427,8 @@ public function buildPayload()
392427
}
393428

394429
/**
430+
* Eager load some some relations.
431+
*
395432
* @param array|string $relations
396433
* @return $this
397434
*/
@@ -403,6 +440,7 @@ public function with($relations)
403440
}
404441

405442
/**
443+
* Set the query offset.
406444
* @param int $offset
407445
* @return $this
408446
*/
@@ -444,6 +482,8 @@ public function paginate($perPage = null, $pageName = 'page', $page = null)
444482
}
445483

446484
/**
485+
* Collapse by a field.
486+
*
447487
* @param string $field
448488
* @return $this
449489
*/
@@ -455,6 +495,8 @@ public function collapse(string $field)
455495
}
456496

457497
/**
498+
* Select one or many fields.
499+
*
458500
* @param mixed $fields
459501
* @return $this
460502
*/
@@ -469,6 +511,8 @@ public function select($fields)
469511
}
470512

471513
/**
514+
* Get the count.
515+
*
472516
* @return int
473517
*/
474518
public function count()

src/Builders/SearchBuilder.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,21 @@
77
class SearchBuilder extends FilterBuilder
88
{
99
/**
10+
* The rules array.
11+
*
1012
* @var array
1113
*/
1214
public $rules = [];
1315

16+
1417
/**
15-
* @param Model $model
18+
* SearchBuilder constructor.
19+
*
20+
* @param \Illuminate\Database\Eloquent\Model $model
1621
* @param string $query
1722
* @param callable|null $callback
1823
* @param bool $softDelete
24+
* @return void
1925
*/
2026
public function __construct(Model $model, $query, $callback = null, $softDelete = false)
2127
{
@@ -25,6 +31,8 @@ public function __construct(Model $model, $query, $callback = null, $softDelete
2531
}
2632

2733
/**
34+
* Add a rule.
35+
*
2836
* @param string|callable $rule Search rule class name or function
2937
* @return $this
3038
*/

src/Console/ElasticIndexCreateCommand.php

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,20 @@ class ElasticIndexCreateCommand extends Command
1313
use RequiresIndexConfiguratorArgument;
1414

1515
/**
16-
* @var string
16+
* {@inheritdoc}
1717
*/
1818
protected $name = 'elastic:create-index';
1919

2020
/**
21-
* @var string
21+
* {@inheritdoc}
2222
*/
2323
protected $description = 'Create an Elasticsearch index';
2424

25+
/**
26+
* Create an index.
27+
*
28+
* @return void
29+
*/
2530
protected function createIndex()
2631
{
2732
$configurator = $this->getIndexConfigurator();
@@ -40,6 +45,11 @@ protected function createIndex()
4045
));
4146
}
4247

48+
/**
49+
* Create an write alias.
50+
*
51+
* @return void
52+
*/
4353
protected function createWriteAlias()
4454
{
4555
$configurator = $this->getIndexConfigurator();
@@ -62,10 +72,15 @@ protected function createWriteAlias()
6272
));
6373
}
6474

75+
/**
76+
* Handle the command.
77+
*
78+
* @return void
79+
*/
6580
public function handle()
6681
{
6782
$this->createIndex();
6883

6984
$this->createWriteAlias();
7085
}
71-
}
86+
}

src/Console/ElasticIndexDropCommand.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,21 @@ class ElasticIndexDropCommand extends Command
1212
use RequiresIndexConfiguratorArgument;
1313

1414
/**
15-
* @var string
15+
* {@inheritdoc}
1616
*/
1717
protected $name = 'elastic:drop-index';
1818

19+
1920
/**
20-
* @var string
21+
* {@inheritdoc}
2122
*/
2223
protected $description = 'Drop an Elasticsearch index';
2324

25+
/**
26+
* Handle the command.
27+
*
28+
* @return void
29+
*/
2430
public function handle()
2531
{
2632
$configurator = $this->getIndexConfigurator();
@@ -36,4 +42,4 @@ public function handle()
3642
$configurator->getName()
3743
));
3844
}
39-
}
45+
}

src/Console/ElasticIndexUpdateCommand.php

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,24 @@ class ElasticIndexUpdateCommand extends Command
1515
{
1616
use RequiresIndexConfiguratorArgument;
1717

18+
1819
/**
19-
* @var string
20+
* {@inheritdoc}
2021
*/
2122
protected $name = 'elastic:update-index';
2223

24+
2325
/**
24-
* @var string
26+
* {@inheritdoc}
2527
*/
2628
protected $description = 'Update settings and mappings of an Elasticsearch index';
2729

30+
/**
31+
* Update the index.
32+
*
33+
* @throws \Exception
34+
* @return void
35+
*/
2836
protected function updateIndex()
2937
{
3038
$configurator = $this->getIndexConfigurator();
@@ -73,6 +81,10 @@ protected function updateIndex()
7381
));
7482
}
7583

84+
/**
85+
* Create a write alias.
86+
* @return void
87+
*/
7688
protected function createWriteAlias()
7789
{
7890
$configurator = $this->getIndexConfigurator();
@@ -104,10 +116,16 @@ protected function createWriteAlias()
104116
));
105117
}
106118

119+
120+
/**
121+
* Handle the command.
122+
*
123+
* @var string
124+
*/
107125
public function handle()
108126
{
109127
$this->updateIndex();
110128

111129
$this->createWriteAlias();
112130
}
113-
}
131+
}

0 commit comments

Comments
 (0)