@@ -39,9 +39,9 @@ |
||
39 | 39 | class AlgoliaManager |
40 | 40 | { |
41 | 41 | /** |
42 | - * Size for the chunks used in reindexing methods. |
|
43 | - */ |
|
44 | - const CHUNK_SIZE = 500; |
|
42 | + * Size for the chunks used in reindexing methods. |
|
43 | + */ |
|
44 | + const CHUNK_SIZE = 500; |
|
45 | 45 | |
46 | 46 | /** |
47 | 47 | * @var AlgoliaFactory |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | { |
239 | 239 | $algoliaRecords = $this->getAlgoliaRecordsFromSearchableModelArray($searchableModels); |
240 | 240 | $indices = $this->initIndices($searchableModels[0]); |
241 | - $objectIds = array_map(function ($algoliaRecord) { |
|
241 | + $objectIds = array_map(function($algoliaRecord) { |
|
242 | 242 | return $algoliaRecord['objectID']; |
243 | 243 | }, $algoliaRecords); |
244 | 244 | |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | $records = $this->activeQueryChunker->chunk( |
268 | 268 | $activeRecord->find(), |
269 | 269 | self::CHUNK_SIZE, |
270 | - function ($activeRecordEntities) { |
|
270 | + function($activeRecordEntities) { |
|
271 | 271 | return $this->getAlgoliaRecordsFromSearchableModelArray($activeRecordEntities); |
272 | 272 | } |
273 | 273 | ); |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | $records = $this->activeQueryChunker->chunk( |
322 | 322 | $activeQuery, |
323 | 323 | self::CHUNK_SIZE, |
324 | - function ($activeRecordEntities) use (&$indices) { |
|
324 | + function($activeRecordEntities) use (&$indices) { |
|
325 | 325 | $records = $this->getAlgoliaRecordsFromSearchableModelArray($activeRecordEntities); |
326 | 326 | |
327 | 327 | // The converting ActiveRecords to Algolia ones already does the type checking |
@@ -389,7 +389,7 @@ discard block |
||
389 | 389 | { |
390 | 390 | $reflectionClass = new \ReflectionClass($class); |
391 | 391 | |
392 | - if (! $reflectionClass->implementsInterface(SearchableInterface::class)) { |
|
392 | + if ( ! $reflectionClass->implementsInterface(SearchableInterface::class)) { |
|
393 | 393 | throw new \InvalidArgumentException("The class: {$reflectionClass->name} doesn't implement leinonen\\Yii2Algolia\\SearchableInterface"); |
394 | 394 | } |
395 | 395 | } |
@@ -405,9 +405,9 @@ discard block |
||
405 | 405 | { |
406 | 406 | $indexNames = $searchableModel->getIndices(); |
407 | 407 | |
408 | - $indices = array_map(function ($indexName) { |
|
408 | + $indices = array_map(function($indexName) { |
|
409 | 409 | if ($this->env !== null) { |
410 | - $indexName = $this->env . '_' . $indexName; |
|
410 | + $indexName = $this->env.'_'.$indexName; |
|
411 | 411 | } |
412 | 412 | |
413 | 413 | return $this->initIndex($indexName); |
@@ -432,8 +432,8 @@ discard block |
||
432 | 432 | // Use the first element of the array to define what kind of models we are indexing. |
433 | 433 | $arrayType = get_class($searchableModels[0]); |
434 | 434 | |
435 | - $algoliaRecords = array_map(function (SearchableInterface $searchableModel) use ($arrayType) { |
|
436 | - if (! $searchableModel instanceof $arrayType) { |
|
435 | + $algoliaRecords = array_map(function(SearchableInterface $searchableModel) use ($arrayType) { |
|
436 | + if ( ! $searchableModel instanceof $arrayType) { |
|
437 | 437 | throw new \InvalidArgumentException('The given array should not contain multiple different classes'); |
438 | 438 | } |
439 | 439 | |
@@ -456,7 +456,7 @@ discard block |
||
456 | 456 | */ |
457 | 457 | private function reindexAtomically(Index $index, array $algoliaRecords) |
458 | 458 | { |
459 | - $temporaryIndexName = 'tmp_' . $index->indexName; |
|
459 | + $temporaryIndexName = 'tmp_'.$index->indexName; |
|
460 | 460 | |
461 | 461 | $temporaryIndex = $this->initIndex($temporaryIndexName); |
462 | 462 | $temporaryIndex->addObjects($algoliaRecords); |