Completed
Pull Request — master (#23)
by
unknown
04:54
created

ServiceProvider   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 4
dl 0
loc 33
ccs 0
cts 17
cp 0
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 10 1
A register() 0 9 1
1
<?php
2
3
namespace NotificationChannels\Webhook\Providers;
4
5
use GuzzleHttp\Client;
6
use GuzzleHttp\ClientInterface;
7
use NotificationChannels\Webhook\WebhookChannel;
8
use Illuminate\Support\ServiceProvider as BaseProvider;
9
10
class ServiceProvider extends Baseprovider
11
{
12
    /**
13
     * Bootstrap any application services.
14
     *
15
     * @return void
16
     */
17
    public function boot()
18
    {
19
        $this->publishes([
20
            __DIR__.'/../config/config.php' => config_path('webhook-notifications.php'),
21
        ]);
22
23
        $this->mergeConfigFrom(
24
            __DIR__.'/../config/config.php', 'webhook-notifications'
25
        );
26
    }
27
28
    /**
29
     * Register any application services.
30
     *
31
     * @return void
32
     */
33
    public function register()
34
    {
35
        $this->app
36
            ->when(WebhookChannel::class)
37
            ->needs(ClientInterface::class)
38
            ->give(function ($app) {
39
                return new Client($app['config.webhook-notifications']['default-config']);
40
            });
41
    }
42
}
43