@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | public function testUpdateAddsModelsToTheIndex() |
| 14 | 14 | { |
| 15 | 15 | $solrClient = $this->getMockBuilder(Client::class) |
| 16 | - ->setMethods(['update']) |
|
| 16 | + ->setMethods([ 'update' ]) |
|
| 17 | 17 | ->getMock(); |
| 18 | 18 | |
| 19 | 19 | $query = new Query(); |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | |
| 25 | 25 | $engine = new SolrEngine($solrClient); |
| 26 | 26 | |
| 27 | - $engine->update(Collection::make([new SolrEngineTestModel])); |
|
| 27 | + $engine->update(Collection::make([ new SolrEngineTestModel ])); |
|
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | public function testDeleteRemovesUpdatesFromTheIndex() |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | |
| 65 | 65 | $updateQuery = $this->client->createUpdate(); |
| 66 | 66 | |
| 67 | - $ids = $models->map(function ($model) { |
|
| 67 | + $ids = $models->map(function($model) { |
|
| 68 | 68 | return $model->getScoutKey(); |
| 69 | 69 | }); |
| 70 | 70 | |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | */ |
| 96 | 96 | public function paginate(Builder $builder, $perPage, $page) |
| 97 | 97 | { |
| 98 | - return $this->performSearch($builder, $perPage,$page - 1); |
|
| 98 | + return $this->performSearch($builder, $perPage, $page - 1); |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | /** |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | */ |
| 107 | 107 | public function mapIds($results) |
| 108 | 108 | { |
| 109 | - $ids = array_map(function ($document) { |
|
| 109 | + $ids = array_map(function($document) { |
|
| 110 | 110 | return $document->id; |
| 111 | 111 | }, $results->getDocuments()); |
| 112 | 112 | |
@@ -129,13 +129,13 @@ discard block |
||
| 129 | 129 | |
| 130 | 130 | $models = $model->getScoutModelsByIds( |
| 131 | 131 | $builder, collect($results->getDocuments())->pluck('objectID')->values()->all() |
| 132 | - )->keyBy(function ($model) { |
|
| 132 | + )->keyBy(function($model) { |
|
| 133 | 133 | return $model->getScoutKey(); |
| 134 | 134 | }); |
| 135 | 135 | |
| 136 | - return Collection::make($results['hits'])->map(function ($hit) use ($models) { |
|
| 137 | - if (isset($models[$hit['objectID']])) { |
|
| 138 | - return $models[$hit['objectID']]; |
|
| 136 | + return Collection::make($results[ 'hits' ])->map(function($hit) use ($models) { |
|
| 137 | + if (isset($models[ $hit[ 'objectID' ] ])) { |
|
| 138 | + return $models[ $hit[ 'objectID' ] ]; |
|
| 139 | 139 | } |
| 140 | 140 | })->filter()->values(); |
| 141 | 141 | } |
@@ -163,12 +163,12 @@ discard block |
||
| 163 | 163 | { |
| 164 | 164 | $selectQuery = $this->client->createSelect(); |
| 165 | 165 | |
| 166 | - $conditions = (empty($builder->query)) ? [] : [$builder->query]; |
|
| 166 | + $conditions = (empty($builder->query)) ? [ ] : [ $builder->query ]; |
|
| 167 | 167 | $conditions = array_merge($conditions, $this->filters($builder)); |
| 168 | 168 | |
| 169 | 169 | $selectQuery->setQuery(implode(' ', $conditions)); |
| 170 | 170 | |
| 171 | - if(!is_null($perPage)) { |
|
| 171 | + if (!is_null($perPage)) { |
|
| 172 | 172 | $selectQuery->setStart($offset)->setRows($perPage); |
| 173 | 173 | } |
| 174 | 174 | |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | */ |
| 186 | 186 | protected function filters(Builder $builder) |
| 187 | 187 | { |
| 188 | - return collect($builder->wheres)->map(function ($value, $key) { |
|
| 188 | + return collect($builder->wheres)->map(function($value, $key) { |
|
| 189 | 189 | return sprintf('%s:"%s"', $key, $value); |
| 190 | 190 | })->values()->all(); |
| 191 | 191 | } |