HablameSmsServiceProvider::boot()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 0
c 1
b 0
f 0
dl 0
loc 2
ccs 1
cts 1
cp 1
rs 10
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
namespace Andreshg112\HablameSms;
4
5
use Illuminate\Support\Facades\Config;
6
use Illuminate\Support\ServiceProvider;
7
8
class HablameSmsServiceProvider extends ServiceProvider
9
{
10
    /**
11
     * Bootstrap the application services.
12
     */
13 6
    public function boot()
14
    {
15
        // Bootstrap code here.
16 6
    }
17
18
    /**
19
     * Register the application services.
20
     */
21 6
    public function register()
22
    {
23
        // Register the main class to use with the facade
24
        $this->app->singleton('hablame-sms', function () {
25
            /** @var \Closure $callback */
26 6
            $callback = Config::get('services.hablame_sms.guzzle');
27
28
            /** @var \GuzzleHttp\Client|null $http */
29 6
            $http = isset($callback) ? $callback() : null;
30
31 6
            return new Client(
32 6
                Config::get('services.hablame_sms.account'),
33 6
                Config::get('services.hablame_sms.apikey'),
34 6
                Config::get('services.hablame_sms.token'),
35
                $http
36 6
            );
37 6
        });
38
    }
39
}
40