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

Commit 7999570

Browse files
authored
Merge pull request #199 from lucasmichot/feature/docblocks-src
Add/fix many docblocks in src
2 parents eba042c + 60f5528 commit 7999570

27 files changed

+406
-126
lines changed

Diff for: src/Builders/FilterBuilder.php

+59-4
Original file line numberDiff line numberDiff line change
@@ -8,37 +8,50 @@
88
class FilterBuilder extends Builder
99
{
1010
/**
11+
* The condition array.
12+
*
1113
* @var array
1214
*/
1315
public $wheres = [
1416
'must' => [],
15-
'must_not' => []
17+
'must_not' => [],
1618
];
1719

1820
/**
21+
* The with array.
22+
*
1923
* @var array|string
2024
*/
2125
public $with;
2226

2327
/**
28+
* The offset
29+
*
2430
* @var int
2531
*/
2632
public $offset;
2733

2834
/**
35+
* The collapse parameter.
36+
*
2937
* @var string
3038
*/
3139
public $collapse;
3240

3341
/**
42+
* The select array.
43+
*
3444
* @var array
3545
*/
3646
public $select = [];
3747

3848
/**
39-
* @param Model $model
49+
* FilterBuilder constructor.
50+
*
51+
* @param \Illuminate\Database\Eloquent\Model $model
4052
* @param callable|null $callback
4153
* @param bool $softDelete
54+
* @return void
4255
*/
4356
public function __construct(Model $model, $callback = null, $softDelete = false)
4457
{
@@ -55,6 +68,8 @@ public function __construct(Model $model, $callback = null, $softDelete = false)
5568
}
5669

5770
/**
71+
* Add a where condition.
72+
*
5873
* @see https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-term-query.html Term query
5974
* @see https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-range-query.html Range query
6075
*
@@ -136,6 +151,8 @@ public function where($field, $value)
136151
}
137152

138153
/**
154+
* Add a whereIn condition.
155+
*
139156
* @see https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-terms-query.html Terms query
140157
*
141158
* @param string $field
@@ -154,6 +171,8 @@ public function whereIn($field, array $value)
154171
}
155172

156173
/**
174+
* Add a whereNotIn condition.
175+
*
157176
* @see https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-terms-query.html Terms query
158177
*
159178
* @param string $field
@@ -172,6 +191,8 @@ public function whereNotIn($field, array $value)
172191
}
173192

174193
/**
194+
* Add a whereBetween condition.
195+
*
175196
* @see https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-range-query.html Range query
176197
*
177198
* @param string $field
@@ -193,6 +214,8 @@ public function whereBetween($field, array $value)
193214
}
194215

195216
/**
217+
* Add a whereNotBetween condition.
218+
*
196219
* @see https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-range-query.html Range query
197220
*
198221
* @param string $field
@@ -214,6 +237,8 @@ public function whereNotBetween($field, array $value)
214237
}
215238

216239
/**
240+
* Add a whereExists condition.
241+
*
217242
* @see https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-exists-query.html Exists query
218243
*
219244
* @param string $field
@@ -231,6 +256,8 @@ public function whereExists($field)
231256
}
232257

233258
/**
259+
* Add a whereNotExists condition
260+
*
234261
* @see https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-exists-query.html Exists query
235262
*
236263
* @param string $field
@@ -248,6 +275,8 @@ public function whereNotExists($field)
248275
}
249276

250277
/**
278+
* Add a whereRegexp condition.
279+
*
251280
* @see https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-regexp-query.html Regexp query
252281
*
253282
* @param string $field
@@ -270,6 +299,8 @@ public function whereRegexp($field, $value, $flags = 'ALL')
270299
}
271300

272301
/**
302+
* Add a whereGeoDistance condition.
303+
*
273304
* @see https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-geo-distance-query.html Geo distance query
274305
*
275306
* @param string $field
@@ -290,6 +321,8 @@ public function whereGeoDistance($field, $value, $distance)
290321
}
291322

292323
/**
324+
* Add a whereGeoBoundingBox condition.
325+
*
293326
* @see https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-geo-bounding-box-query.html Geo bounding box query
294327
*
295328
* @param string $field
@@ -308,6 +341,8 @@ public function whereGeoBoundingBox($field, array $value)
308341
}
309342

310343
/**
344+
* Add a whereGeoPolygon condition.
345+
*
311346
* @see https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-geo-polygon-query.html Geo polygon query
312347
*
313348
* @param string $field
@@ -326,8 +361,10 @@ public function whereGeoPolygon($field, array $points)
326361

327362
return $this;
328363
}
329-
364+
330365
/**
366+
* Add a whereGeoShape condition.
367+
*
331368
* @see https://www.elastic.co/guide/en/elasticsearch/guide/current/querying-geo-shapes.html Querying Geo Shapes
332369
*
333370
* @param string $field
@@ -346,8 +383,10 @@ public function whereGeoShape($field, array $shape)
346383

347384
return $this;
348385
}
349-
386+
350387
/**
388+
* Add a orderBy clause.
389+
*
351390
* @param string $field
352391
* @param string $direction
353392
* @return $this
@@ -362,6 +401,8 @@ public function orderBy($field, $direction = 'asc')
362401
}
363402

364403
/**
404+
* Explain the request.
405+
*
365406
* @return array
366407
*/
367408
public function explain()
@@ -372,6 +413,8 @@ public function explain()
372413
}
373414

374415
/**
416+
* Profile the request.
417+
*
375418
* @return array
376419
*/
377420
public function profile()
@@ -382,6 +425,8 @@ public function profile()
382425
}
383426

384427
/**
428+
* Build the payload.
429+
*
385430
* @return array
386431
*/
387432
public function buildPayload()
@@ -392,6 +437,8 @@ public function buildPayload()
392437
}
393438

394439
/**
440+
* Eager load some some relations.
441+
*
395442
* @param array|string $relations
396443
* @return $this
397444
*/
@@ -403,6 +450,8 @@ public function with($relations)
403450
}
404451

405452
/**
453+
* Set the query offset.
454+
*
406455
* @param int $offset
407456
* @return $this
408457
*/
@@ -444,6 +493,8 @@ public function paginate($perPage = null, $pageName = 'page', $page = null)
444493
}
445494

446495
/**
496+
* Collapse by a field.
497+
*
447498
* @param string $field
448499
* @return $this
449500
*/
@@ -455,6 +506,8 @@ public function collapse(string $field)
455506
}
456507

457508
/**
509+
* Select one or many fields.
510+
*
458511
* @param mixed $fields
459512
* @return $this
460513
*/
@@ -469,6 +522,8 @@ public function select($fields)
469522
}
470523

471524
/**
525+
* Get the count.
526+
*
472527
* @return int
473528
*/
474529
public function count()

Diff for: src/Builders/SearchBuilder.php

+9-1
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
*/

Diff for: src/Console/ElasticIndexCreateCommand.php

+18-3
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+
}

Diff for: src/Console/ElasticIndexDropCommand.php

+9-3
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+
}

0 commit comments

Comments
 (0)