Completed
Push — master ( 6123aa...cb7977 )
by Nenad
06:49
created

TNTSearchScoutServiceProvider   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 8
Bugs 2 Features 0
Metric Value
wmc 1
c 8
b 2
f 0
lcom 1
cbo 3
dl 0
loc 21
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A boot() 0 13 1
1
<?php
2
3
namespace TeamTNT\Scout;
4
5
use Illuminate\Support\ServiceProvider;
6
use Laravel\Scout\EngineManager;
7
use TeamTNT\TNTSearch\TNTSearch;
8
9
class TNTSearchScoutServiceProvider extends ServiceProvider
10
{
11
    /**
12
     * Bootstrap any application services.
13
     *
14
     * @return void
15
     */
16
    public function boot()
17
    {
18
        $this->app[EngineManager::class]->extend('tntsearch', function () {
19
            $tnt = new TNTSearch();
20
            $driver = config('database.default');
21
            $config = config('scout.tntsearch') + config("database.connections.$driver");
22
23
            $tnt->loadConfig($config);
24
            $tnt->setDatabaseHandle(app('db')->connection()->getPdo());
0 ignored issues
show
Bug introduced by
The method setDatabaseHandle() does not seem to exist on object<TeamTNT\TNTSearch\TNTSearch>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
25
26
            return new Engines\TNTSearchEngine($tnt);
27
        });
28
    }
29
}
30