AvstelecomsmsServiceProvider   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 7

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 7
dl 0
loc 36
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 11 2
A register() 0 15 1
1
<?php
2
3
namespace Tematech\Avstelecomsms;
4
5
use GuzzleHttp\Client;
6
use Illuminate\Support\ServiceProvider;
7
use Illuminate\Notifications\ChannelManager;
8
use Illuminate\Support\Facades\Notification;
9
10
class AvstelecomsmsServiceProvider extends ServiceProvider
11
{
12
    /**
13
     * Bootstrap the application services.
14
     */
15
    public function boot()
16
    {
17
        if ($this->app->runningInConsole()) {
18
            $this->publishes([
19
                __DIR__ . '/../config/config-avstelecomsms.php' => config_path('avstelecomsms.php'),
20
            ], 'config');
21
        }
22
        $this->app->singleton(Avstelecomsms::class, function () {
23
           return new Avstelecomsms();
24
        });
25
    }
26
27
    /**
28
     * Register the application services.
29
     */
30
    public function register()
31
    {
32
        // Automatically apply the package configuration
33
        $this->mergeConfigFrom(__DIR__ . '/../config/config-avstelecomsms.php', 'avstelecomsms');
34
35
        $this->app->singleton(Client::class, function () {
36
            new Client();
37
        });
38
        // Register the main class to use with the facade
39
        Notification::resolved(function (ChannelManager $service) {
40
            $service->extend('avstelecom', function () {
41
                return new AvsTelecomChannel;
42
            });
43
        });
44
    }
45
}
46