Passed
Push — master ( d7421a...71d0aa )
by Andrés
19:00
created

HablameSmsServiceProvider::boot()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 3
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 2
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
    public function boot()
14
    {
15
        // Bootstrap code here.
16
    }
17
18
    /**
19
     * Register the application services.
20
     */
21
    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
            $callback = Config::get('services.hablame_sms.guzzle');
27
28
            /** @var \GuzzleHttp\Client|null $http */
29
            $http = isset($callback) ? $callback() : null;
30
31
            return new Client(
32
                Config::get('services.hablame_sms.cliente'),
33
                Config::get('services.hablame_sms.api'),
34
                $http
35
            );
36
        });
37
    }
38
}
39