Passed
Push — master ( 2dfbed...0dc38a )
by Jonas
13:30
created

IdeHelperServiceProvider   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
c 1
b 0
f 0
dl 0
loc 20
ccs 12
cts 12
cp 1
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A register() 0 10 1
A provides() 0 4 1
1
<?php
2
3
namespace Staudenmeir\EloquentJsonRelations;
4
5
use Barryvdh\LaravelIdeHelper\Console\ModelsCommand;
6
use Illuminate\Contracts\Support\DeferrableProvider;
7
use Illuminate\Support\ServiceProvider;
8
use Staudenmeir\EloquentJsonRelations\IdeHelper\JsonRelationsHook;
9
10
class IdeHelperServiceProvider extends ServiceProvider implements DeferrableProvider
11
{
12 5
    public function register(): void
13
    {
14
        /** @var \Illuminate\Contracts\Config\Repository $config */
15 5
        $config = $this->app->get('config');
16
17 5
        $config->set(
18 5
            'ide-helper.model_hooks',
19 5
            array_merge(
20 5
                [JsonRelationsHook::class],
21 5
                $config->get('ide-helper.model_hooks', [])
22 5
            )
23 5
        );
24
    }
25
26 5
    public function provides(): array
27
    {
28 5
        return [
29 5
            ModelsCommand::class,
30 5
        ];
31
    }
32
}
33