Issues (17)

src/ScoutElasticSearchServiceProvider.php (1 issue)

1
<?php
2
3
declare(strict_types=1);
4
5
namespace Matchish\ScoutElasticSearch;
6
7
use Elasticsearch\Client;
8
use Illuminate\Support\ServiceProvider;
9
use Laravel\Scout\EngineManager;
10
use Laravel\Scout\ScoutServiceProvider;
11
use Matchish\ScoutElasticSearch\Console\Commands\FlushCommand;
12
use Matchish\ScoutElasticSearch\Console\Commands\ImportCommand;
13
use Matchish\ScoutElasticSearch\Engines\ElasticSearchEngine;
14
use Matchish\ScoutElasticSearch\Searchable\DefaultImportSourceFactory;
15
use Matchish\ScoutElasticSearch\Searchable\ImportSourceFactory;
16
17
final class ScoutElasticSearchServiceProvider extends ServiceProvider
18
{
19
    /**
20
     * {@inheritdoc}
21
     */
22 50
    public function boot(): void
23
    {
24 50
        $this->loadTranslationsFrom(__DIR__.'/../resources/lang', 'scout');
25
26
        $this->app->make(EngineManager::class)->extend(ElasticSearchEngine::class, function () {
0 ignored issues
show
The method make() does not exist on Tests\Laravel\App. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

26
        $this->app->/** @scrutinizer ignore-call */ 
27
                    make(EngineManager::class)->extend(ElasticSearchEngine::class, function () {

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...
27 18
            $elasticsearch = app(Client::class);
28
29 18
            return new ElasticSearchEngine($elasticsearch);
30 50
        });
31 50
        $this->registerCommands();
32 50
    }
33
34
    /**
35
     * {@inheritdoc}
36
     */
37 50
    public function register(): void
38
    {
39 50
        $this->app->register(ScoutServiceProvider::class);
40 50
        $this->app->bind(ImportSourceFactory::class, DefaultImportSourceFactory::class);
41 50
    }
42
43
    /**
44
     * Register artisan commands.
45
     *
46
     * @return void
47
     */
48 50
    private function registerCommands(): void
49
    {
50 50
        if ($this->app->runningInConsole()) {
51 50
            $this->commands([
52 50
                ImportCommand::class,
53
                FlushCommand::class,
54
            ]);
55
        }
56 50
    }
57
}
58