Completed
Pull Request — master (#23)
by
unknown
11:18
created

ServiceProvider::boot()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

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