GlobeLabsSmsServiceProvider   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 17 1
A loadLang() 0 4 1
A publishLang() 0 7 1
1
<?php
2
3
namespace Coreproc\GlobeLabsSms;
4
5
use GuzzleHttp\Client;
6
use Illuminate\Support\ServiceProvider;
7
8
class GlobeLabsSmsServiceProvider extends ServiceProvider
9
{
10
    /**
11
     * Bootstrap the application services.
12
     */
13
    public function boot()
14
    {
15
        $this->app->when(GlobeLabsSmsChannel::class)
16
            ->needs(Client::class)
17
            ->give(function () {
18
                return new Client([
19
                    'headers' => [
20
                        'Content-Type' => 'application/json',
21
                    ],
22
                    'verify' => config('broadcasting.connections.globe_labs_sms.verify_ssl', true),
23
                ]);
24
            });
25
26
        $this->loadLang();
27
28
        $this->publishLang();
29
    }
30
31
    private function loadLang()
32
    {
33
        $this->loadTranslationsFrom(__DIR__ . '/../resources/lang', 'globe_labs_sms');
34
    }
35
36
    private function publishLang()
37
    {
38
        // Publish languages for override
39
        $this->publishes([
40
            __DIR__ . '/../resources/lang' => base_path('resources/lang/vendor/globe_labs_sms'),
41
        ], 'locales');
42
    }
43
}
44