@@ -234,10 +234,10 @@ discard block |
||
234 | 234 | $activeRecord = $this->activeRecordFactory->make($className); |
235 | 235 | $indices = $this->initIndices($activeRecord); |
236 | 236 | |
237 | - $records = $this->activeQueryChunker->chunk( |
|
237 | + $records = $this->activeQueryChunker->chunk( |
|
238 | 238 | $activeRecord->find(), |
239 | 239 | 500, |
240 | - function ($activeRecordEntities) { |
|
240 | + function($activeRecordEntities) { |
|
241 | 241 | return $this->getAlgoliaRecordsFromSearchableModelArray($activeRecordEntities); |
242 | 242 | } |
243 | 243 | ); |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | $response = []; |
246 | 246 | |
247 | 247 | foreach ($indices as $index) { |
248 | - $temporaryIndexName = 'tmp_' . $index->indexName; |
|
248 | + $temporaryIndexName = 'tmp_'.$index->indexName; |
|
249 | 249 | |
250 | 250 | /** @var Index $temporaryIndex */ |
251 | 251 | $temporaryIndex = $this->initIndex($temporaryIndexName); |
@@ -308,7 +308,7 @@ discard block |
||
308 | 308 | { |
309 | 309 | $reflectionClass = new \ReflectionClass($class); |
310 | 310 | |
311 | - if (! $reflectionClass->implementsInterface(SearchableInterface::class)) { |
|
311 | + if ( ! $reflectionClass->implementsInterface(SearchableInterface::class)) { |
|
312 | 312 | throw new \InvalidArgumentException("The class: {$reflectionClass->name} doesn't implement leinonen\\Yii2Algolia\\SearchableInterface"); |
313 | 313 | } |
314 | 314 | } |
@@ -324,9 +324,9 @@ discard block |
||
324 | 324 | { |
325 | 325 | $indexNames = $searchableModel->getIndices(); |
326 | 326 | |
327 | - $indices = array_map(function ($indexName) { |
|
327 | + $indices = array_map(function($indexName) { |
|
328 | 328 | if ($this->env !== null) { |
329 | - $indexName = $this->env . '_' . $indexName; |
|
329 | + $indexName = $this->env.'_'.$indexName; |
|
330 | 330 | } |
331 | 331 | |
332 | 332 | return $this->initIndex($indexName); |
@@ -347,8 +347,8 @@ discard block |
||
347 | 347 | // Use the first element of the array to define what kind of models we are indexing. |
348 | 348 | $arrayType = get_class($searchableModels[0]); |
349 | 349 | |
350 | - $algoliaRecords = array_map(function (SearchableInterface $searchableModel) use ($arrayType) { |
|
351 | - if (! $searchableModel instanceof $arrayType) { |
|
350 | + $algoliaRecords = array_map(function(SearchableInterface $searchableModel) use ($arrayType) { |
|
351 | + if ( ! $searchableModel instanceof $arrayType) { |
|
352 | 352 | throw new \InvalidArgumentException('The given array should not contain multiple different classes'); |
353 | 353 | } |
354 | 354 |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | $records = $this->paginateRecords($query, $pageNumber, $size)->all(); |
24 | 24 | $results = []; |
25 | 25 | |
26 | - while(count($records) > 0) |
|
26 | + while (count($records) > 0) |
|
27 | 27 | { |
28 | 28 | // On each chunk, pass the records to the callback and then let the |
29 | 29 | // developer take care of everything within the callback. This allows to |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | |
37 | 37 | // If the results of the given callable function were an array |
38 | 38 | // merge them into the result array which is returned at the end of the chunking. |
39 | - if(is_array($callableResults)) { |
|
39 | + if (is_array($callableResults)) { |
|
40 | 40 | $results = array_merge($results, $callableResults); |
41 | 41 | } |
42 | 42 | |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | */ |
59 | 59 | private function paginateRecords(ActiveQueryInterface $query, $pageNumber, $count) |
60 | 60 | { |
61 | - $offset = ($pageNumber - 1) * $count; |
|
61 | + $offset = ($pageNumber - 1) * $count; |
|
62 | 62 | $limit = $count; |
63 | 63 | |
64 | 64 | return $query->offset($offset)->limit($limit); |
@@ -23,8 +23,7 @@ |
||
23 | 23 | $records = $this->paginateRecords($query, $pageNumber, $size)->all(); |
24 | 24 | $results = []; |
25 | 25 | |
26 | - while(count($records) > 0) |
|
27 | - { |
|
26 | + while(count($records) > 0) { |
|
28 | 27 | // On each chunk, pass the records to the callback and then let the |
29 | 28 | // developer take care of everything within the callback. This allows to |
30 | 29 | // keep the memory low when looping through large result sets. |