@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | * |
18 | 18 | * @throws \Exception |
19 | 19 | */ |
20 | - public function make(AlgoliaConfig $config) |
|
20 | + public function make (AlgoliaConfig $config) |
|
21 | 21 | { |
22 | 22 | return new AlgoliaManager( |
23 | 23 | new Client( |
@@ -40,9 +40,9 @@ discard block |
||
40 | 40 | * |
41 | 41 | * @throws \InvalidArgumentException |
42 | 42 | */ |
43 | - public function makeSearchableObject($className) |
|
43 | + public function makeSearchableObject ($className) |
|
44 | 44 | { |
45 | - if (! (new \ReflectionClass($className))->implementsInterface(SearchableInterface::class)) { |
|
45 | + if ( ! (new \ReflectionClass($className))->implementsInterface(SearchableInterface::class)) { |
|
46 | 46 | throw new \InvalidArgumentException("Cannot initiate a class ({$className}) which doesn't implement leinonen\\Yii2Algolia\\SearchableInterface"); |
47 | 47 | } |
48 | 48 |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | * @param ActiveRecordFactory $activeRecordFactory |
92 | 92 | * @param ActiveQueryChunker $activeQueryChunker |
93 | 93 | */ |
94 | - public function __construct( |
|
94 | + public function __construct ( |
|
95 | 95 | Client $client, |
96 | 96 | ActiveRecordFactory $activeRecordFactory, |
97 | 97 | ActiveQueryChunker $activeQueryChunker |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | * |
107 | 107 | * @return Client |
108 | 108 | */ |
109 | - public function getClient() |
|
109 | + public function getClient () |
|
110 | 110 | { |
111 | 111 | return $this->client; |
112 | 112 | } |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | * |
117 | 117 | * @param string $env |
118 | 118 | */ |
119 | - public function setEnv($env) |
|
119 | + public function setEnv ($env) |
|
120 | 120 | { |
121 | 121 | $this->env = $env; |
122 | 122 | } |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | * |
127 | 127 | * @return null|string |
128 | 128 | */ |
129 | - public function getEnv() |
|
129 | + public function getEnv () |
|
130 | 130 | { |
131 | 131 | return $this->env; |
132 | 132 | } |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | * |
139 | 139 | * @return array |
140 | 140 | */ |
141 | - public function pushToIndices(SearchableInterface $searchableModel) |
|
141 | + public function pushToIndices (SearchableInterface $searchableModel) |
|
142 | 142 | { |
143 | 143 | $indices = $this->initIndices($searchableModel); |
144 | 144 | $record = $searchableModel->getAlgoliaRecord(); |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | * |
156 | 156 | * @return array |
157 | 157 | */ |
158 | - public function pushMultipleToIndices(array $searchableModels) |
|
158 | + public function pushMultipleToIndices (array $searchableModels) |
|
159 | 159 | { |
160 | 160 | $algoliaRecords = $this->getAlgoliaRecordsFromSearchableModelArray($searchableModels); |
161 | 161 | $indices = $this->initIndices($searchableModels[0]); |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | * |
173 | 173 | * @return array |
174 | 174 | */ |
175 | - public function updateInIndices(SearchableInterface $searchableModel) |
|
175 | + public function updateInIndices (SearchableInterface $searchableModel) |
|
176 | 176 | { |
177 | 177 | $indices = $this->initIndices($searchableModel); |
178 | 178 | $record = $searchableModel->getAlgoliaRecord(); |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | * |
191 | 191 | * @return array |
192 | 192 | */ |
193 | - public function updateMultipleInIndices(array $searchableModels) |
|
193 | + public function updateMultipleInIndices (array $searchableModels) |
|
194 | 194 | { |
195 | 195 | $algoliaRecords = $this->getAlgoliaRecordsFromSearchableModelArray($searchableModels); |
196 | 196 | $indices = $this->initIndices($searchableModels[0]); |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | * @return array |
209 | 209 | * @throws \InvalidArgumentException |
210 | 210 | */ |
211 | - public function removeFromIndices(SearchableInterface $searchableModel) |
|
211 | + public function removeFromIndices (SearchableInterface $searchableModel) |
|
212 | 212 | { |
213 | 213 | $indices = $indices = $this->initIndices($searchableModel); |
214 | 214 | $objectID = $searchableModel->getObjectID(); |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | * @return array |
227 | 227 | * @throws \InvalidArgumentException |
228 | 228 | */ |
229 | - public function removeMultipleFromIndices(array $searchableModels) |
|
229 | + public function removeMultipleFromIndices (array $searchableModels) |
|
230 | 230 | { |
231 | 231 | $algoliaRecords = $this->getAlgoliaRecordsFromSearchableModelArray($searchableModels); |
232 | 232 | $indices = $this->initIndices($searchableModels[0]); |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | * |
247 | 247 | * @return array |
248 | 248 | */ |
249 | - public function reindex($className) |
|
249 | + public function reindex ($className) |
|
250 | 250 | { |
251 | 251 | $this->checkImplementsSearchableInterface($className); |
252 | 252 | $activeRecord = $this->activeRecordFactory->make($className); |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | * @throws \InvalidArgumentException |
277 | 277 | * @return array |
278 | 278 | */ |
279 | - public function reindexOnly(array $searchableModels) |
|
279 | + public function reindexOnly (array $searchableModels) |
|
280 | 280 | { |
281 | 281 | $records = $this->getAlgoliaRecordsFromSearchableModelArray($searchableModels); |
282 | 282 | $indices = $this->initIndices($searchableModels[0]); |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | * |
295 | 295 | * @return array |
296 | 296 | */ |
297 | - public function reindexByActiveQuery(ActiveQueryInterface $activeQuery) |
|
297 | + public function reindexByActiveQuery (ActiveQueryInterface $activeQuery) |
|
298 | 298 | { |
299 | 299 | $indices = null; |
300 | 300 | $records = $this->activeQueryChunker->chunk( |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | * @throws \InvalidArgumentException |
327 | 327 | * @return array |
328 | 328 | */ |
329 | - public function clearIndices($className) |
|
329 | + public function clearIndices ($className) |
|
330 | 330 | { |
331 | 331 | $this->checkImplementsSearchableInterface($className); |
332 | 332 | /** @var SearchableInterface $activeRecord */ |
@@ -347,7 +347,7 @@ discard block |
||
347 | 347 | * |
348 | 348 | * @return array |
349 | 349 | */ |
350 | - public function search($className, $query, array $searchParameters = null) |
|
350 | + public function search ($className, $query, array $searchParameters = null) |
|
351 | 351 | { |
352 | 352 | $this->checkImplementsSearchableInterface($className); |
353 | 353 | /* @var SearchableInterface $activeRecord */ |
@@ -367,7 +367,7 @@ discard block |
||
367 | 367 | * |
368 | 368 | * @return mixed |
369 | 369 | */ |
370 | - public function __call($method, $parameters) |
|
370 | + public function __call ($method, $parameters) |
|
371 | 371 | { |
372 | 372 | return \call_user_func_array([$this->getClient(), $method], $parameters); |
373 | 373 | } |
@@ -377,11 +377,11 @@ discard block |
||
377 | 377 | * |
378 | 378 | * @param string $class Either name or instance of the class to be checked. |
379 | 379 | */ |
380 | - private function checkImplementsSearchableInterface($class) |
|
380 | + private function checkImplementsSearchableInterface ($class) |
|
381 | 381 | { |
382 | 382 | $reflectionClass = new \ReflectionClass($class); |
383 | 383 | |
384 | - if (! $reflectionClass->implementsInterface(SearchableInterface::class)) { |
|
384 | + if ( ! $reflectionClass->implementsInterface(SearchableInterface::class)) { |
|
385 | 385 | throw new \InvalidArgumentException("The class: {$reflectionClass->name} doesn't implement leinonen\\Yii2Algolia\\SearchableInterface"); |
386 | 386 | } |
387 | 387 | } |
@@ -393,7 +393,7 @@ discard block |
||
393 | 393 | * |
394 | 394 | * @return Index[] |
395 | 395 | */ |
396 | - private function initIndices(SearchableInterface $searchableModel) |
|
396 | + private function initIndices (SearchableInterface $searchableModel) |
|
397 | 397 | { |
398 | 398 | $indexNames = $searchableModel->getIndices(); |
399 | 399 | |
@@ -413,7 +413,7 @@ discard block |
||
413 | 413 | * |
414 | 414 | * @return array |
415 | 415 | */ |
416 | - private function getAlgoliaRecordsFromSearchableModelArray(array $searchableModels) |
|
416 | + private function getAlgoliaRecordsFromSearchableModelArray (array $searchableModels) |
|
417 | 417 | { |
418 | 418 | if (empty($searchableModels)) { |
419 | 419 | throw new \InvalidArgumentException('The given array should not be empty'); |
@@ -424,7 +424,7 @@ discard block |
||
424 | 424 | $this->checkImplementsSearchableInterface($arrayType); |
425 | 425 | |
426 | 426 | return \array_map(function (SearchableInterface $searchableModel) use ($arrayType) { |
427 | - if (! $searchableModel instanceof $arrayType) { |
|
427 | + if ( ! $searchableModel instanceof $arrayType) { |
|
428 | 428 | throw new \InvalidArgumentException('The given array should not contain multiple different classes'); |
429 | 429 | } |
430 | 430 | |
@@ -443,7 +443,7 @@ discard block |
||
443 | 443 | * |
444 | 444 | * @return mixed |
445 | 445 | */ |
446 | - private function reindexAtomically(Index $index, array $algoliaRecords) |
|
446 | + private function reindexAtomically (Index $index, array $algoliaRecords) |
|
447 | 447 | { |
448 | 448 | $temporaryIndexName = 'tmp_' . $index->indexName; |
449 | 449 | |
@@ -467,7 +467,7 @@ discard block |
||
467 | 467 | * |
468 | 468 | * @return array The response as an array in format of ['indexName' => $responseFromAlgoliaClient] |
469 | 469 | */ |
470 | - private function processIndices($indices, callable $callback) |
|
470 | + private function processIndices ($indices, callable $callback) |
|
471 | 471 | { |
472 | 472 | $response = []; |
473 | 473 |
@@ -17,14 +17,14 @@ discard block |
||
17 | 17 | * @param array $expand |
18 | 18 | * @param bool $recursive |
19 | 19 | */ |
20 | - abstract public function toArray(array $fields = [], array $expand = [], $recursive = true); |
|
20 | + abstract public function toArray (array $fields = [], array $expand = [], $recursive = true); |
|
21 | 21 | |
22 | 22 | /** |
23 | 23 | * @see \yii\db\BaseActiveRecord::getPrimaryKey() |
24 | 24 | * |
25 | 25 | * @param bool $asArray |
26 | 26 | */ |
27 | - abstract public function getPrimaryKey($asArray = false); |
|
27 | + abstract public function getPrimaryKey ($asArray = false); |
|
28 | 28 | |
29 | 29 | /** |
30 | 30 | * An array of indices that this model uses. If none specified |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | * |
33 | 33 | * @return array |
34 | 34 | */ |
35 | - public function indices() |
|
35 | + public function indices () |
|
36 | 36 | { |
37 | 37 | return []; |
38 | 38 | } |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | * |
43 | 43 | * @return array |
44 | 44 | */ |
45 | - public function getIndices() |
|
45 | + public function getIndices () |
|
46 | 46 | { |
47 | 47 | $indices = $this->indices(); |
48 | 48 | |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | * |
61 | 61 | * @return array |
62 | 62 | */ |
63 | - public function getAlgoliaRecord() |
|
63 | + public function getAlgoliaRecord () |
|
64 | 64 | { |
65 | 65 | return $this->toArray(); |
66 | 66 | } |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | * |
71 | 71 | * @return int |
72 | 72 | */ |
73 | - public function getObjectID() |
|
73 | + public function getObjectID () |
|
74 | 74 | { |
75 | 75 | return $this->getPrimaryKey(); |
76 | 76 | } |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | * |
81 | 81 | * @return array |
82 | 82 | */ |
83 | - public function index() |
|
83 | + public function index () |
|
84 | 84 | { |
85 | 85 | $manager = static::getAlgoliaManager(); |
86 | 86 | |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | * |
93 | 93 | * @return array |
94 | 94 | */ |
95 | - public function removeFromIndices() |
|
95 | + public function removeFromIndices () |
|
96 | 96 | { |
97 | 97 | $manager = static::getAlgoliaManager(); |
98 | 98 | |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | * |
105 | 105 | * @return array |
106 | 106 | */ |
107 | - public function updateInIndices() |
|
107 | + public function updateInIndices () |
|
108 | 108 | { |
109 | 109 | $manager = static::getAlgoliaManager(); |
110 | 110 | |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | * |
117 | 117 | * @return array |
118 | 118 | */ |
119 | - public static function reindex() |
|
119 | + public static function reindex () |
|
120 | 120 | { |
121 | 121 | $manager = static::getAlgoliaManager(); |
122 | 122 | |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | * |
129 | 129 | * @return array |
130 | 130 | */ |
131 | - public static function clearIndices() |
|
131 | + public static function clearIndices () |
|
132 | 132 | { |
133 | 133 | $manager = static::getAlgoliaManager(); |
134 | 134 | |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | * |
144 | 144 | * @return array |
145 | 145 | */ |
146 | - public static function search($query, array $searchParameters = null) |
|
146 | + public static function search ($query, array $searchParameters = null) |
|
147 | 147 | { |
148 | 148 | $manager = static::getAlgoliaManager(); |
149 | 149 | |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | * |
158 | 158 | * @return AlgoliaManager |
159 | 159 | */ |
160 | - protected static function getAlgoliaManager() |
|
160 | + protected static function getAlgoliaManager () |
|
161 | 161 | { |
162 | 162 | return Yii::$container->get(AlgoliaManager::class); |
163 | 163 | } |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | * @param AlgoliaFactory $algoliaFactory |
98 | 98 | * @param array $config |
99 | 99 | */ |
100 | - public function __construct( |
|
100 | + public function __construct ( |
|
101 | 101 | AlgoliaFactory $algoliaFactory, |
102 | 102 | $config = [] |
103 | 103 | ) { |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | * |
114 | 114 | * @throws InvalidConfigException |
115 | 115 | */ |
116 | - public function bootstrap($app) |
|
116 | + public function bootstrap ($app) |
|
117 | 117 | { |
118 | 118 | if (empty($this->applicationId) || empty($this->apiKey)) { |
119 | 119 | throw new InvalidConfigException('applicationId and apiKey are required'); |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | * |
133 | 133 | * @return mixed |
134 | 134 | */ |
135 | - public function __call($method, $parameters) |
|
135 | + public function __call ($method, $parameters) |
|
136 | 136 | { |
137 | 137 | if ($this->manager === null) { |
138 | 138 | $this->manager = $this->createManager(); |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | * |
147 | 147 | * @return AlgoliaManager |
148 | 148 | */ |
149 | - private function createManager() |
|
149 | + private function createManager () |
|
150 | 150 | { |
151 | 151 | $config = $this->generateConfig(); |
152 | 152 | |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | * |
162 | 162 | * @return AlgoliaConfig |
163 | 163 | */ |
164 | - private function generateConfig() |
|
164 | + private function generateConfig () |
|
165 | 165 | { |
166 | 166 | return new AlgoliaConfig( |
167 | 167 | $this->applicationId, |