HablameSmsServiceProvider::register()   A
last analyzed

Complexity

Conditions 2
Paths 1

Size

Total Lines 15
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 2

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 8
c 2
b 0
f 0
dl 0
loc 15
ccs 7
cts 7
cp 1
rs 10
cc 2
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 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