SMSOfficeServiceProvider::boot()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 3
Bugs 0 Features 0
Metric Value
c 3
b 0
f 0
dl 0
loc 8
ccs 5
cts 5
cp 1
rs 9.4285
cc 1
eloc 4
nc 1
nop 0
crap 1
1
<?php
2
3
namespace Gabievi\LaravelSMSOffice;
4
5
use Illuminate\Support\ServiceProvider;
6
use Gabievi\LaravelSMSOffice\Exceptions\InvalidConfiguration;
7
8
class SMSOfficeServiceProvider extends ServiceProvider
9
{
10
    /**
11
     * Perform post-registration booting of services.
12
     *
13
     * @return void
14
     * @throws InvalidConfiguration
15
     */
16 3
    public function boot()
17
    {
18 3
        $config = config('services.smsoffice');
19
20 3
        throw_unless($config, InvalidConfiguration::class);
21
22 2
        $this->app->singleton(SMSOffice::class, function () use ($config) {
23 1
            return new SMSOffice($config['key'], $config['sender']);
24 2
        });
25
    }
26
}
27