Completed
Push — master ( 08d577...287f6d )
by Nenad
02:21 queued 32s
created
src/TNTSearchScoutServiceProvider.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@
 block discarded – undo
15 15
      */
16 16
     public function boot()
17 17
     {
18
-        $this->app[EngineManager::class]->extend('tntsearch', function ($app) {
18
+        $this->app[EngineManager::class]->extend('tntsearch', function($app) {
19 19
             $tnt = new TNTSearch();
20 20
             
21 21
             $driver = config('database.default');
Please login to merge, or discard this patch.
Doc Comments   +6 added lines patch added patch discarded remove patch
@@ -43,6 +43,9 @@  discard block
 block discarded – undo
43 43
         });
44 44
     }
45 45
 
46
+    /**
47
+     * @param TNTSearch $tnt
48
+     */
46 49
     protected function setFuzziness($tnt)
47 50
     {
48 51
         $tnt->fuzziness            = config('scout.tntsearch.fuzziness', $tnt->fuzziness);
@@ -51,6 +54,9 @@  discard block
 block discarded – undo
51 54
         $tnt->fuzzy_max_expansions = config('scout.tntsearch.fuzzy.max_expansions', $tnt->fuzzy_max_expansions);
52 55
     }
53 56
 
57
+    /**
58
+     * @param TNTSearch $tnt
59
+     */
54 60
     protected function setAsYouType($tnt)
55 61
     {
56 62
         $tnt->asYouType = config('scout.tntsearch.asYouType', $tnt->asYouType);
Please login to merge, or discard this patch.
src/Engines/TNTSearchEngine.php 2 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -291,6 +291,7 @@
 block discarded – undo
291 291
      * The constraints usually remove only a small amount of results, which is why the non
292 292
      * matching results are looked up and removed, instead of returning a collection with
293 293
      * all the valid results.
294
+     * @param Builder $builder
294 295
      */
295 296
     private function discardIdsFromResultSetByConstraints($builder, $searchResults)
296 297
     {
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
         $index->setPrimaryKey($models->first()->getKeyName());
55 55
 
56 56
         $index->indexBeginTransaction();
57
-        $models->each(function ($model) use ($index) {
57
+        $models->each(function($model) use ($index) {
58 58
             $array = $model->toSearchableArray();
59 59
 
60 60
             if (empty($array)) {
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
     public function delete($models)
81 81
     {
82 82
         $this->initIndex($models->first());
83
-        $models->each(function ($model) {
83
+        $models->each(function($model) {
84 84
             $this->tnt->selectIndex("{$model->searchableAs()}.index");
85 85
             $index = $this->tnt->getIndex();
86 86
             $index->setPrimaryKey($model->getKeyName());
@@ -192,11 +192,11 @@  discard block
 block discarded – undo
192 192
 
193 193
         $builder = $this->getBuilder($model);
194 194
         
195
-        if($this->builder->queryCallback){
195
+        if ($this->builder->queryCallback) {
196 196
             call_user_func($this->builder->queryCallback, $builder);
197 197
         }
198 198
 
199
-        if($this->builder->queryCallback){
199
+        if ($this->builder->queryCallback) {
200 200
             call_user_func($this->builder->queryCallback, $builder);
201 201
         }
202 202
 
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
         }
211 211
 
212 212
         // sort models by tnt search result set
213
-        return collect($results['ids'])->map(function ($hit) use ($models) {
213
+        return collect($results['ids'])->map(function($hit) use ($models) {
214 214
             if (isset($models[$hit])) {
215 215
                 return $models[$hit];
216 216
             }
@@ -294,8 +294,8 @@  discard block
 block discarded – undo
294 294
      */
295 295
     private function discardIdsFromResultSetByConstraints($builder, $searchResults)
296 296
     {
297
-        $qualifiedKeyName = $builder->model->getQualifiedKeyName();  // tableName.id
298
-        $subQualifiedKeyName = 'sub.' . $builder->model->getKeyName(); // sub.id
297
+        $qualifiedKeyName = $builder->model->getQualifiedKeyName(); // tableName.id
298
+        $subQualifiedKeyName = 'sub.'.$builder->model->getKeyName(); // sub.id
299 299
 
300 300
         $sub = $this->getBuilder($builder->model)->whereIn(
301 301
             $qualifiedKeyName, $searchResults
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
 
304 304
         $discardIds = $builder->model->newQuery()
305 305
             ->select($qualifiedKeyName)
306
-            ->leftJoin(DB::raw('(' . $sub->getQuery()->toSql() .') as sub'), $subQualifiedKeyName, '=', $qualifiedKeyName)
306
+            ->leftJoin(DB::raw('('.$sub->getQuery()->toSql().') as sub'), $subQualifiedKeyName, '=', $qualifiedKeyName)
307 307
             ->addBinding($sub->getQuery()->getBindings(), 'join')
308 308
             ->whereIn($qualifiedKeyName, $searchResults)
309 309
             ->whereNull($subQualifiedKeyName)
@@ -374,10 +374,10 @@  discard block
 block discarded – undo
374 374
     private function applyWheres($builder)
375 375
     {
376 376
         // iterate over given where clauses
377
-        return collect($this->builder->wheres)->map(function ($value, $key) {
377
+        return collect($this->builder->wheres)->map(function($value, $key) {
378 378
             // for reduce function combine key and value into array
379 379
             return [$key, $value];
380
-        })->reduce(function ($builder, $where) {
380
+        })->reduce(function($builder, $where) {
381 381
             // separate key, value again
382 382
             list($key, $value) = $where;
383 383
             return $builder->where($key, $value);
@@ -393,10 +393,10 @@  discard block
 block discarded – undo
393 393
     private function applyOrders($builder)
394 394
     {
395 395
         //iterate over given orderBy clauses - should be only one
396
-        return collect($this->builder->orders)->map(function ($value, $key) {
396
+        return collect($this->builder->orders)->map(function($value, $key) {
397 397
             // for reduce function combine key and value into array
398 398
             return [$value["column"], $value["direction"]];
399
-        })->reduce(function ($builder, $orderBy) {
399
+        })->reduce(function($builder, $orderBy) {
400 400
             // separate key, value again
401 401
             list($column, $direction) = $orderBy;
402 402
             return $builder->orderBy($column, $direction);
Please login to merge, or discard this patch.