@@ -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 | |
@@ -44,7 +44,7 @@ |
||
| 44 | 44 | */ |
| 45 | 45 | protected function getConfig(array $config) |
| 46 | 46 | { |
| 47 | - if (! array_key_exists('applicationId', $config) || ! array_key_exists('apiKey', $config)) { |
|
| 47 | + if ( ! array_key_exists('applicationId', $config) || ! array_key_exists('apiKey', $config)) { |
|
| 48 | 48 | throw new InvalidArgumentException('Configuration keys applicationId and apiKey are required'); |
| 49 | 49 | } |
| 50 | 50 | |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | } |
| 209 | 209 | |
| 210 | 210 | foreach ($indices as $index) { |
| 211 | - $temporaryIndexName = 'tmp_' . $index->indexName; |
|
| 211 | + $temporaryIndexName = 'tmp_'.$index->indexName; |
|
| 212 | 212 | |
| 213 | 213 | /** @var Index $temporaryIndex */ |
| 214 | 214 | $temporaryIndex = $this->initIndex($temporaryIndexName); |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | { |
| 273 | 273 | $reflectionClass = new \ReflectionClass($class); |
| 274 | 274 | |
| 275 | - if (! $reflectionClass->implementsInterface(SearchableInterface::class)) { |
|
| 275 | + if ( ! $reflectionClass->implementsInterface(SearchableInterface::class)) { |
|
| 276 | 276 | throw new \InvalidArgumentException("The class: {$reflectionClass->name} doesn't implement leinonen\\Yii2Algolia\\SearchableInterface"); |
| 277 | 277 | } |
| 278 | 278 | } |
@@ -291,8 +291,8 @@ discard block |
||
| 291 | 291 | $indices = []; |
| 292 | 292 | |
| 293 | 293 | foreach ($indexNames as $indexName) { |
| 294 | - if($this->env !== null){ |
|
| 295 | - $indexName = $this->env . '_' . $indexName; |
|
| 294 | + if ($this->env !== null) { |
|
| 295 | + $indexName = $this->env.'_'.$indexName; |
|
| 296 | 296 | } |
| 297 | 297 | |
| 298 | 298 | $indices[] = $this->initIndex($indexName); |
@@ -291,7 +291,7 @@ |
||
| 291 | 291 | $indices = []; |
| 292 | 292 | |
| 293 | 293 | foreach ($indexNames as $indexName) { |
| 294 | - if($this->env !== null){ |
|
| 294 | + if($this->env !== null) { |
|
| 295 | 295 | $indexName = $this->env . '_' . $indexName; |
| 296 | 296 | } |
| 297 | 297 | |