Completed
Push — master ( 3c7a17...3bdaf3 )
by Nenad
28s queued 27s
created
src/Console/ImportCommand.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@
 block discarded – undo
43 43
         $tnt->loadConfig($config);
44 44
         $tnt->setDatabaseHandle($db->getPdo());
45 45
 
46
-        if(!$model->count()) {
46
+        if (!$model->count()) {
47 47
             $this->info('Nothing to import.');
48 48
             exit(0);
49 49
         }
Please login to merge, or discard this patch.
src/Console/StatusCommand.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 
69 69
             $indexedColumns = $rowsTotal ? implode(",", array_keys($model->first()->toSearchableArray())) : '';
70 70
 
71
-            if($recordsDifference == 0) {
71
+            if ($recordsDifference == 0) {
72 72
                 $recordsDifference = '<fg=green>Synchronized</>';
73 73
             } else {
74 74
                 $recordsDifference = "<fg=red>$recordsDifference</>";
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
      */
127 127
     private function getSearchableModels()
128 128
     {
129
-        $searchableModels = (array)$this->argument('model');
129
+        $searchableModels = (array) $this->argument('model');
130 130
         if (empty($searchableModels)) {
131 131
             $searchableModels = $this->getSearchableModelsFromClasses();
132 132
         }
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
      */
141 141
     private function isSearchableModel($trait)
142 142
     {
143
-        return function ($className) use ($trait) {
143
+        return function($className) use ($trait) {
144 144
             $traits = class_uses_recursive($className);
145 145
 
146 146
             return isset($traits[$trait]);
Please login to merge, or discard this patch.
src/TNTSearchScoutServiceProvider.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
      */
18 18
     public function boot()
19 19
     {
20
-        $this->app[EngineManager::class]->extend('tntsearch', function ($app) {
20
+        $this->app[EngineManager::class]->extend('tntsearch', function($app) {
21 21
             $tnt = new TNTSearch();
22 22
 
23 23
             $driver = config('database.default');
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
             ]);
41 41
         }
42 42
 
43
-        Builder::macro('constrain', function ($constraints) {
43
+        Builder::macro('constrain', function($constraints) {
44 44
             $this->constraints = $constraints;
45 45
             return $this;
46 46
         });
Please login to merge, or discard this patch.
src/Engines/TNTSearchEngine.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
         $index = $this->tnt->getIndex();
58 58
         $index->setPrimaryKey($models->first()->getKeyName());
59 59
 
60
-        $models->each(function ($model) use ($index) {
60
+        $models->each(function($model) use ($index) {
61 61
             $array = $model->toSearchableArray();
62 62
 
63 63
             if (empty($array)) {
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
     public function delete($models)
83 83
     {
84 84
         $this->initIndex($models->first());
85
-        $models->each(function ($model) {
85
+        $models->each(function($model) {
86 86
             $this->tnt->selectIndex("{$model->searchableAs()}.index");
87 87
             $index = $this->tnt->getIndex();
88 88
             $index->setPrimaryKey($model->getKeyName());
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
         }
217 217
 
218 218
         // sort models by tnt search result set
219
-        return $model->newCollection(collect($results['ids'])->map(function ($hit) use ($models, $results) {
219
+        return $model->newCollection(collect($results['ids'])->map(function($hit) use ($models, $results) {
220 220
             if (isset($models[$hit])) {
221 221
                 if (isset($this->tnt->config['searchBoolean']) ? $this->tnt->config['searchBoolean'] : false) {
222 222
                     return $models[$hit];
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
         }
260 260
 
261 261
         // sort models by tnt search result set
262
-        return $model->newCollection($results['ids'])->map(function ($hit) use ($models) {
262
+        return $model->newCollection($results['ids'])->map(function($hit) use ($models) {
263 263
             if (isset($models[$hit])) {
264 264
                 return $models[$hit];
265 265
             }
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
             return;
324 324
         }
325 325
 
326
-        if (!file_exists($this->tnt->config['storage'] . "/{$indexName}.index")) {
326
+        if (!file_exists($this->tnt->config['storage']."/{$indexName}.index")) {
327 327
             $indexer = $this->tnt->createIndex("$indexName.index");
328 328
             $indexer->setDatabaseHandle($model->getConnection()->getPdo());
329 329
             $indexer->setPrimaryKey($model->getKeyName());
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
     private function discardIdsFromResultSetByConstraints($builder, $searchResults)
349 349
     {
350 350
         $qualifiedKeyName    = $builder->model->getQualifiedKeyName(); // tableName.id
351
-        $subQualifiedKeyName = 'sub.' . $builder->model->getKeyName(); // sub.id
351
+        $subQualifiedKeyName = 'sub.'.$builder->model->getKeyName(); // sub.id
352 352
 
353 353
         $sub = $this->getBuilder($builder->model)->whereIn(
354 354
             $qualifiedKeyName, $searchResults
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
 
357 357
         $discardIds = $builder->model->newQuery()
358 358
             ->select($qualifiedKeyName)
359
-            ->leftJoin(DB::raw('(' . $sub->getQuery()->toSql() . ') as ' . $builder->model->getConnection()->getTablePrefix() . 'sub'), $subQualifiedKeyName, '=', $qualifiedKeyName)
359
+            ->leftJoin(DB::raw('('.$sub->getQuery()->toSql().') as '.$builder->model->getConnection()->getTablePrefix().'sub'), $subQualifiedKeyName, '=', $qualifiedKeyName)
360 360
             ->addBinding($sub->getQuery()->getBindings(), 'join')
361 361
             ->whereIn($qualifiedKeyName, $searchResults)
362 362
             ->whereNull($subQualifiedKeyName)
@@ -427,10 +427,10 @@  discard block
 block discarded – undo
427 427
     private function applyWheres($builder)
428 428
     {
429 429
         // iterate over given where clauses
430
-        return collect($this->builder->wheres)->map(function ($value, $key) {
430
+        return collect($this->builder->wheres)->map(function($value, $key) {
431 431
             // for reduce function combine key and value into array
432 432
             return [$key, $value];
433
-        })->reduce(function ($builder, $where) {
433
+        })->reduce(function($builder, $where) {
434 434
             // separate key, value again
435 435
             list($key, $value) = $where;
436 436
             return $builder->where($key, $value);
@@ -446,10 +446,10 @@  discard block
 block discarded – undo
446 446
     private function applyOrders($builder)
447 447
     {
448 448
         //iterate over given orderBy clauses - should be only one
449
-        return collect($this->builder->orders)->map(function ($value, $key) {
449
+        return collect($this->builder->orders)->map(function($value, $key) {
450 450
             // for reduce function combine key and value into array
451 451
             return [$value["column"], $value["direction"]];
452
-        })->reduce(function ($builder, $orderBy) {
452
+        })->reduce(function($builder, $orderBy) {
453 453
             // separate key, value again
454 454
             list($column, $direction) = $orderBy;
455 455
             return $builder->orderBy($column, $direction);
@@ -465,7 +465,7 @@  discard block
 block discarded – undo
465 465
     public function flush($model)
466 466
     {
467 467
         $indexName   = $model->searchableAs();
468
-        $pathToIndex = $this->tnt->config['storage'] . "/{$indexName}.index";
468
+        $pathToIndex = $this->tnt->config['storage']."/{$indexName}.index";
469 469
         if (file_exists($pathToIndex)) {
470 470
             unlink($pathToIndex);
471 471
         }
Please login to merge, or discard this patch.