From b07a688b0b2d6a51c5dcf7ce354b8cbabfeee875 Mon Sep 17 00:00:00 2001 From: Oliver Green Date: Sun, 14 Apr 2024 21:26:44 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=BD=20Styling.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ElasticsearchEngine.php | 30 +++++++++++++++++------------- tests/ElasticsearchEngineTest.php | 2 +- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/src/ElasticsearchEngine.php b/src/ElasticsearchEngine.php index f08a0c2..30d0f1d 100755 --- a/src/ElasticsearchEngine.php +++ b/src/ElasticsearchEngine.php @@ -4,9 +4,9 @@ use Elasticsearch\Client; use Illuminate\Database\Eloquent\Collection; +use Illuminate\Support\LazyCollection; use Laravel\Scout\Builder; use Laravel\Scout\Engines\Engine; -use Illuminate\Support\LazyCollection; class ElasticsearchEngine extends Engine { @@ -249,9 +249,10 @@ public function map(Builder $builder, $results, $model) /** * Map the given results to instances of the given model via a lazy collection. * - * @param \Laravel\Scout\Builder $builder - * @param mixed $results - * @param \Illuminate\Database\Eloquent\Model $model + * @param \Laravel\Scout\Builder $builder + * @param mixed $results + * @param \Illuminate\Database\Eloquent\Model $model + * * @return \Illuminate\Support\LazyCollection */ public function lazyMap(Builder $builder, $results, $model) @@ -265,19 +266,21 @@ public function lazyMap(Builder $builder, $results, $model) $objectIdPositions = array_flip($objectIds); return $model->queryScoutModelsByIds( - $builder, $objectIds - )->cursor()->filter(function ($model) use ($objectIds) { - return in_array($model->getScoutKey(), $objectIds); - })->sortBy(function ($model) use ($objectIdPositions) { - return $objectIdPositions[$model->getScoutKey()]; - })->values(); + $builder, + $objectIds + )->cursor()->filter(function ($model) use ($objectIds) { + return in_array($model->getScoutKey(), $objectIds); + })->sortBy(function ($model) use ($objectIdPositions) { + return $objectIdPositions[$model->getScoutKey()]; + })->values(); } /** * Create a search index. * - * @param string $name - * @param array $options + * @param string $name + * @param array $options + * * @return mixed */ public function createIndex($name, array $options = []) @@ -288,7 +291,8 @@ public function createIndex($name, array $options = []) /** * Delete a search index. * - * @param string $name + * @param string $name + * * @return mixed */ public function deleteIndex($name) diff --git a/tests/ElasticsearchEngineTest.php b/tests/ElasticsearchEngineTest.php index 374f9bd..961ca88 100755 --- a/tests/ElasticsearchEngineTest.php +++ b/tests/ElasticsearchEngineTest.php @@ -4,10 +4,10 @@ use BoxedCode\Laravel\Scout\ElasticsearchEngine; use Illuminate\Database\Eloquent\Collection; +use Illuminate\Support\LazyCollection; use Laravel\Scout\Builder; use Mockery; use Tests\Fixtures\TestModel; -use Illuminate\Support\LazyCollection; class ElasticsearchEngineTest extends AbstractTestCase {