ElasticSearchServiceProvider   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 11
c 2
b 0
f 0
dl 0
loc 35
ccs 15
cts 15
cp 1
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A provides() 0 3 1
A boot() 0 5 1
A register() 0 11 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Matchish\ScoutElasticSearch;
6
7
use Elasticsearch\Client;
8
use Elasticsearch\ClientBuilder;
9
use Illuminate\Support\ServiceProvider;
10
11
final class ElasticSearchServiceProvider extends ServiceProvider
12
{
13
    /**
14
     * {@inheritdoc}
15
     */
16 50
    public function register(): void
17
    {
18 50
        $this->mergeConfigFrom(__DIR__.'/../config/elasticsearch.php', 'elasticsearch');
0 ignored issues
show
Bug introduced by
The method mergeConfigFrom() does not exist on Matchish\ScoutElasticSea...icSearchServiceProvider. ( Ignorable by Annotation )

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

18
        $this->/** @scrutinizer ignore-call */ 
19
               mergeConfigFrom(__DIR__.'/../config/elasticsearch.php', 'elasticsearch');

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...
19
20
        $this->app->bind(Client::class, function () {
0 ignored issues
show
Bug introduced by
The method bind() 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

20
        $this->app->/** @scrutinizer ignore-call */ 
21
                    bind(Client::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...
21 33
            return ClientBuilder::create()->setHosts([config('elasticsearch.host')])->build();
22 50
        });
23
24 50
        $this->app->bind(
25 50
            'Matchish\ScoutElasticSearch\ElasticSearch\HitsIteratorAggregate',
26 50
            'Matchish\ScoutElasticSearch\ElasticSearch\EloquentHitsIteratorAggregate'
27
        );
28 50
    }
29
30
    /**
31
     * {@inheritdoc}
32
     */
33 50
    public function boot(): void
34
    {
35 50
        $this->publishes([
0 ignored issues
show
Bug introduced by
The method publishes() does not exist on Matchish\ScoutElasticSea...icSearchServiceProvider. ( Ignorable by Annotation )

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

35
        $this->/** @scrutinizer ignore-call */ 
36
               publishes([

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...
36 50
            __DIR__.'/../config/elasticsearch.php' => config_path('elasticsearch.php'),
37 50
        ], 'config');
38 50
    }
39
40
    /**
41
     * {@inheritdoc}
42
     */
43 1
    public function provides(): array
44
    {
45 1
        return [Client::class];
46
    }
47
}
48