@@ -42,7 +42,7 @@ |
||
| 42 | 42 | */ |
| 43 | 43 | public function bootstrap($app) |
| 44 | 44 | { |
| 45 | - Yii::$container->set(AlgoliaManager::class, function () { |
|
| 45 | + Yii::$container->set(AlgoliaManager::class, function() { |
|
| 46 | 46 | return $this->createManager(); |
| 47 | 47 | }); |
| 48 | 48 | } |
@@ -37,21 +37,21 @@ |
||
| 37 | 37 | public function events() |
| 38 | 38 | { |
| 39 | 39 | return [ |
| 40 | - ActiveRecord::EVENT_AFTER_INSERT => function (Event $event) { |
|
| 40 | + ActiveRecord::EVENT_AFTER_INSERT => function(Event $event) { |
|
| 41 | 41 | if ($this->afterInsert) { |
| 42 | 42 | /** @var $manager AlgoliaManager */ |
| 43 | 43 | $manager = Yii::$container->get(AlgoliaManager::class); |
| 44 | 44 | $manager->pushToIndices($event->sender); |
| 45 | 45 | } |
| 46 | 46 | }, |
| 47 | - ActiveRecord::EVENT_AFTER_DELETE => function (Event $event) { |
|
| 47 | + ActiveRecord::EVENT_AFTER_DELETE => function(Event $event) { |
|
| 48 | 48 | if ($this->afterDelete) { |
| 49 | 49 | /** @var $manager AlgoliaManager */ |
| 50 | 50 | $manager = Yii::$container->get(AlgoliaManager::class); |
| 51 | 51 | $manager->removeFromIndices($event->sender); |
| 52 | 52 | } |
| 53 | 53 | }, |
| 54 | - ActiveRecord::EVENT_AFTER_UPDATE => function (Event $event) { |
|
| 54 | + ActiveRecord::EVENT_AFTER_UPDATE => function(Event $event) { |
|
| 55 | 55 | if ($this->afterUpdate) { |
| 56 | 56 | /** @var $manager AlgoliaManager */ |
| 57 | 57 | $manager = Yii::$container->get(AlgoliaManager::class); |
@@ -15,7 +15,7 @@ |
||
| 15 | 15 | */ |
| 16 | 16 | public function make($className) |
| 17 | 17 | { |
| 18 | - if (! (new \ReflectionClass($className))->implementsInterface(ActiveRecordInterface::class)) { |
|
| 18 | + if ( ! (new \ReflectionClass($className))->implementsInterface(ActiveRecordInterface::class)) { |
|
| 19 | 19 | throw new \InvalidArgumentException("Cannot initiate a class ({$className}) which doesn't implement \\yii\\db\\ActiveRecordInterface"); |
| 20 | 20 | } |
| 21 | 21 | |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | */ |
| 31 | 31 | public function makeSearchableObject($className) |
| 32 | 32 | { |
| 33 | - if (! (new \ReflectionClass($className))->implementsInterface(SearchableInterface::class)) { |
|
| 33 | + if ( ! (new \ReflectionClass($className))->implementsInterface(SearchableInterface::class)) { |
|
| 34 | 34 | throw new \InvalidArgumentException("Cannot initiate a class ({$className}) which doesn't implement leinonen\\Yii2Algolia\\SearchableInterface"); |
| 35 | 35 | } |
| 36 | 36 | |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | */ |
| 61 | 61 | protected function getConfig(array $config) |
| 62 | 62 | { |
| 63 | - if (! array_key_exists('applicationId', $config) || ! array_key_exists('apiKey', $config)) { |
|
| 63 | + if ( ! array_key_exists('applicationId', $config) || ! array_key_exists('apiKey', $config)) { |
|
| 64 | 64 | throw new InvalidArgumentException('Configuration keys applicationId and apiKey are required'); |
| 65 | 65 | } |
| 66 | 66 | |
@@ -248,7 +248,7 @@ discard block |
||
| 248 | 248 | } |
| 249 | 249 | |
| 250 | 250 | foreach ($indices as $index) { |
| 251 | - $temporaryIndexName = 'tmp_' . $index->indexName; |
|
| 251 | + $temporaryIndexName = 'tmp_'.$index->indexName; |
|
| 252 | 252 | |
| 253 | 253 | /** @var Index $temporaryIndex */ |
| 254 | 254 | $temporaryIndex = $this->initIndex($temporaryIndexName); |
@@ -311,7 +311,7 @@ discard block |
||
| 311 | 311 | { |
| 312 | 312 | $reflectionClass = new \ReflectionClass($class); |
| 313 | 313 | |
| 314 | - if (! $reflectionClass->implementsInterface(SearchableInterface::class)) { |
|
| 314 | + if ( ! $reflectionClass->implementsInterface(SearchableInterface::class)) { |
|
| 315 | 315 | throw new \InvalidArgumentException("The class: {$reflectionClass->name} doesn't implement leinonen\\Yii2Algolia\\SearchableInterface"); |
| 316 | 316 | } |
| 317 | 317 | } |
@@ -341,9 +341,9 @@ discard block |
||
| 341 | 341 | { |
| 342 | 342 | $indexNames = $searchableModel->getIndices(); |
| 343 | 343 | |
| 344 | - $indices = array_map(function ($indexName) { |
|
| 344 | + $indices = array_map(function($indexName) { |
|
| 345 | 345 | if ($this->env !== null) { |
| 346 | - $indexName = $this->env . '_' . $indexName; |
|
| 346 | + $indexName = $this->env.'_'.$indexName; |
|
| 347 | 347 | } |
| 348 | 348 | |
| 349 | 349 | return $this->initIndex($indexName); |
@@ -366,9 +366,9 @@ discard block |
||
| 366 | 366 | $arrayType = $this->getClassName($searchableModels[0]); |
| 367 | 367 | $indices = $this->initIndices($this->factory->makeSearchableObject($arrayType)); |
| 368 | 368 | |
| 369 | - $algoliaRecords = array_map(function ($searchableModel) use ($arrayType) { |
|
| 369 | + $algoliaRecords = array_map(function($searchableModel) use ($arrayType) { |
|
| 370 | 370 | /** @var $searchableModel SearchableInterface */ |
| 371 | - if (! $searchableModel instanceof $arrayType) { |
|
| 371 | + if ( ! $searchableModel instanceof $arrayType) { |
|
| 372 | 372 | throw new \InvalidArgumentException('The given array should not contain multiple different classes'); |
| 373 | 373 | } |
| 374 | 374 | |