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

Commit 2beb173

Browse files
- Fixing CS.
1 parent 69ca46d commit 2beb173

File tree

6 files changed

+84
-84
lines changed

6 files changed

+84
-84
lines changed

src/Classes/TypesenseDocumentIndexResponse.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
namespace Devloops\LaravelTypesense\Classes;
44

55
/**
6-
* Class TypesenseDocumentIndexResponse
6+
* Class TypesenseDocumentIndexResponse.
77
*
88
* @package Devloops\LaravelTypesense\Classes
99
* @date 02/10/2021

src/Engines/TypesenseSearchEngine.php

Lines changed: 61 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,21 @@
22

33
namespace Devloops\LaravelTypesense\Engines;
44

5+
use Devloops\LaravelTypesense\Typesense;
56
use Exception;
6-
use Laravel\Scout\Builder;
7-
use Illuminate\Support\Str;
8-
use Laravel\Scout\Engines\Engine;
9-
use Illuminate\Support\Collection;
107
use Illuminate\Support\LazyCollection;
8+
use Illuminate\Support\Collection;
9+
use Illuminate\Support\Str;
1110
use Illuminate\Database\Eloquent\Model;
12-
use Devloops\LaravelTypesense\Typesense;
1311
use Illuminate\Database\Eloquent\SoftDeletes;
12+
use Laravel\Scout\Builder;
13+
use Laravel\Scout\Engines\Engine;
1414

1515
/**
16-
* Class TypesenseSearchEngine
16+
* Class TypesenseSearchEngine.
1717
*
18-
* @package Devloops\LaravelTypesense\Engines
1918
* @date 4/5/20
19+
*
2020
* @author Abdullah Al-Faqeir <[email protected]>
2121
*/
2222
class TypesenseSearchEngine extends Engine
@@ -59,15 +59,15 @@ class TypesenseSearchEngine extends Engine
5959
/**
6060
* TypesenseSearchEngine constructor.
6161
*
62-
* @param \Devloops\LaravelTypesense\Typesense $typesense
62+
* @param \Devloops\LaravelTypesense\Typesense $typesense
6363
*/
6464
public function __construct(Typesense $typesense)
6565
{
6666
$this->typesense = $typesense;
6767
}
6868

6969
/**
70-
* @param \Illuminate\Database\Eloquent\Collection<int, Model>|Model[] $models
70+
* @param \Illuminate\Database\Eloquent\Collection<int, Model>|Model[] $models
7171
*
7272
* @throws \Http\Client\Exception
7373
* @throws \JsonException
@@ -87,7 +87,7 @@ public function update($models): void
8787
}
8888

8989
/**
90-
* @param \Illuminate\Database\Eloquent\Collection $models
90+
* @param \Illuminate\Database\Eloquent\Collection $models
9191
*
9292
* @throws \Http\Client\Exception
9393
* @throws \Typesense\Exceptions\TypesenseClientError
@@ -102,7 +102,7 @@ public function delete($models): void
102102
}
103103

104104
/**
105-
* @param \Laravel\Scout\Builder $builder
105+
* @param \Laravel\Scout\Builder $builder
106106
*
107107
* @return mixed
108108
* @throws \Http\Client\Exception
@@ -114,9 +114,9 @@ public function search(Builder $builder): mixed
114114
}
115115

116116
/**
117-
* @param \Laravel\Scout\Builder $builder
118-
* @param int $perPage
119-
* @param int $page
117+
* @param \Laravel\Scout\Builder $builder
118+
* @param int $perPage
119+
* @param int $page
120120
*
121121
* @return mixed
122122
* @throws \Http\Client\Exception
@@ -128,39 +128,39 @@ public function paginate(Builder $builder, $perPage, $page): mixed
128128
}
129129

130130
/**
131-
* @param \Laravel\Scout\Builder $builder
132-
* @param int $page
133-
* @param int $perPage
131+
* @param \Laravel\Scout\Builder $builder
132+
* @param int $page
133+
* @param int $perPage
134134
*
135135
* @return array
136136
*/
137137
private function buildSearchParams(Builder $builder, int $page, int $perPage): array
138138
{
139139
$params = [
140-
'q' => $builder->query,
141-
'query_by' => implode(',', $builder->model->typesenseQueryBy()),
142-
'filter_by' => $this->filters($builder),
143-
'per_page' => $perPage,
144-
'page' => $page,
140+
'q' => $builder->query,
141+
'query_by' => implode(',', $builder->model->typesenseQueryBy()),
142+
'filter_by' => $this->filters($builder),
143+
'per_page' => $perPage,
144+
'page' => $page,
145145
'highlight_start_tag' => $this->startTag,
146-
'highlight_end_tag' => $this->endTag,
146+
'highlight_end_tag' => $this->endTag,
147147
];
148148

149149
if ($this->limitHits > 0) {
150150
$params['limit_hits'] = $this->limitHits;
151151
}
152152

153-
if (! empty($this->groupBy)) {
153+
if (!empty($this->groupBy)) {
154154
$params['group_by'] = implode(',', $this->groupBy);
155155
$params['group_limit'] = $this->groupByLimit;
156156
}
157157

158-
if (! empty($this->locationOrderBy)) {
158+
if (!empty($this->locationOrderBy)) {
159159
$params['sort_by'] = $this->parseOrderByLocation(...$this->locationOrderBy);
160160
}
161161

162-
if (! empty($builder->orders)) {
163-
if (! empty($params['sort_by'])) {
162+
if (!empty($builder->orders)) {
163+
if (!empty($params['sort_by'])) {
164164
$params['sort_by'] .= ',';
165165
} else {
166166
$params['sort_by'] = '';
@@ -172,12 +172,12 @@ private function buildSearchParams(Builder $builder, int $page, int $perPage): a
172172
}
173173

174174
/**
175-
* Parse location order by for sort_by
175+
* Parse location order by for sort_by.
176176
*
177-
* @param string $column
178-
* @param float $lat
179-
* @param float $lng
180-
* @param string $direction
177+
* @param string $column
178+
* @param float $lat
179+
* @param float $lng
180+
* @param string $direction
181181
*
182182
* @return string
183183
* @noinspection PhpPureAttributeCanBeAddedInspection
@@ -192,7 +192,7 @@ private function parseOrderByLocation(string $column, float $lat, float $lng, st
192192
/**
193193
* Parse sort_by fields
194194
*
195-
* @param array $orders
195+
* @param array $orders
196196
*
197197
* @return string
198198
*/
@@ -206,8 +206,8 @@ private function parseOrderBy(array $orders): string
206206
}
207207

208208
/**
209-
* @param \Laravel\Scout\Builder $builder
210-
* @param array $options
209+
* @param \Laravel\Scout\Builder $builder
210+
* @param array $options
211211
*
212212
* @return mixed
213213
* @throws \Http\Client\Exception
@@ -226,7 +226,7 @@ protected function performSearch(Builder $builder, array $options = []): mixed
226226
/**
227227
* Prepare filters
228228
*
229-
* @param Builder $builder
229+
* @param Builder $builder
230230
*
231231
* @return string
232232
*/
@@ -244,8 +244,8 @@ protected function filters(Builder $builder): string
244244
/**
245245
* Parse typesense filters
246246
*
247-
* @param array|string $value
248-
* @param string $key
247+
* @param array|string $value
248+
* @param string $key
249249
*
250250
* @return string
251251
*/
@@ -258,7 +258,7 @@ public function parseFilters(array|string $value, string $key): string
258258
}
259259

260260
/**
261-
* @param mixed $results
261+
* @param mixed $results
262262
*
263263
* @return \Illuminate\Support\Collection
264264
*/
@@ -270,9 +270,9 @@ public function mapIds($results): Collection
270270
}
271271

272272
/**
273-
* @param \Laravel\Scout\Builder $builder
274-
* @param mixed $results
275-
* @param \Illuminate\Database\Eloquent\Model $model
273+
* @param \Laravel\Scout\Builder $builder
274+
* @param mixed $results
275+
* @param \Illuminate\Database\Eloquent\Model $model
276276
*
277277
* @return \Illuminate\Database\Eloquent\Collection
278278
*/
@@ -307,7 +307,7 @@ public function getTotalCount($results): int
307307
}
308308

309309
/**
310-
* @param \Illuminate\Database\Eloquent\Model $model
310+
* @param \Illuminate\Database\Eloquent\Model $model
311311
*
312312
* @throws \Http\Client\Exception
313313
* @throws \Typesense\Exceptions\TypesenseClientError
@@ -329,9 +329,9 @@ protected function usesSoftDelete($model): bool
329329
}
330330

331331
/**
332-
* @param \Laravel\Scout\Builder $builder
333-
* @param mixed $results
334-
* @param \Illuminate\Database\Eloquent\Model $model
332+
* @param \Laravel\Scout\Builder $builder
333+
* @param mixed $results
334+
* @param \Illuminate\Database\Eloquent\Model $model
335335
*
336336
* @return \Illuminate\Support\LazyCollection
337337
*/
@@ -360,8 +360,8 @@ public function lazyMap(Builder $builder, $results, $model): LazyCollection
360360
}
361361

362362
/**
363-
* @param string $name
364-
* @param array $options
363+
* @param string $name
364+
* @param array $options
365365
*
366366
* @return void
367367
* @throws \Exception
@@ -374,7 +374,7 @@ public function createIndex($name, array $options = []): void
374374
/**
375375
* You can aggregate search results into groups or buckets by specify one or more group_by fields. Separate multiple fields with a comma.
376376
*
377-
* @param mixed $groupBy
377+
* @param mixed $groupBy
378378
*
379379
* @return $this
380380
*/
@@ -387,7 +387,7 @@ public function groupBy(array $groupBy): static
387387
/**
388388
* Maximum number of hits to be returned for every group. (default: 3)
389389
*
390-
* @param int $groupByLimit
390+
* @param int $groupByLimit
391391
*
392392
* @return $this
393393
*/
@@ -400,7 +400,7 @@ public function groupByLimit(int $groupByLimit): static
400400
/**
401401
* The start tag used for the highlighted snippets. (default: <mark>)
402402
*
403-
* @param string $startTag
403+
* @param string $startTag
404404
*
405405
* @return $this
406406
*/
@@ -413,7 +413,7 @@ public function setHighlightStartTag(string $startTag): static
413413
/**
414414
* The end tag used for the highlighted snippets. (default: </mark>)
415415
*
416-
* @param string $endTag
416+
* @param string $endTag
417417
*
418418
* @return $this
419419
*/
@@ -428,7 +428,7 @@ public function setHighlightEndTag(string $endTag): static
428428
*
429429
* (page * per_page) should be less than this number for the search request to return results.
430430
*
431-
* @param int $limitHits
431+
* @param int $limitHits
432432
*
433433
* @return $this
434434
*/
@@ -441,26 +441,26 @@ public function limitHits(int $limitHits): static
441441
/**
442442
* Add location to order by clause
443443
*
444-
* @param string $column
445-
* @param float $lat
446-
* @param float $lng
447-
* @param string $direction
444+
* @param string $column
445+
* @param float $lat
446+
* @param float $lng
447+
* @param string $direction
448448
*
449449
* @return $this
450450
*/
451451
public function orderByLocation(string $column, float $lat, float $lng, string $direction): static
452452
{
453453
$this->locationOrderBy = [
454-
'column' => $column,
455-
'lat' => $lat,
456-
'lng' => $lng,
454+
'column' => $column,
455+
'lat' => $lat,
456+
'lng' => $lng,
457457
'direction' => $direction,
458458
];
459459
return $this;
460460
}
461461

462462
/**
463-
* @param string $name
463+
* @param string $name
464464
*
465465
* @return array
466466
* @throws \Http\Client\Exception

src/Interfaces/TypesenseSearch.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
namespace Devloops\LaravelTypesense\Interfaces;
44

55
/**
6-
* Interface TypesenseSearch
6+
* Interface TypesenseSearch.
77
*/
88
interface TypesenseSearch
99
{

0 commit comments

Comments
 (0)