SmsRuProvider   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 5

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 5
dl 0
loc 19
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A register() 0 9 1
A provides() 0 6 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Kafkiansky\SmsRuChannel;
6
7
use GuzzleHttp\Client;
8
use Illuminate\Contracts\Foundation\Application;
9
use Illuminate\Contracts\Support\DeferrableProvider;
10
use Illuminate\Support\ServiceProvider;
11
use Kafkiansky\SmsRu\SmsRuApi;
12
use Kafkiansky\SmsRu\SmsRuConfig;
13
14
final class SmsRuProvider extends ServiceProvider implements DeferrableProvider
15
{
16
    public function register()
17
    {
18
        $this->app->singleton(SmsRuApi::class, static function (Application $application) {
19
            return new SmsRuApi(
20
                new SmsRuConfig($application->make('config')['services.sms_ru']),
21
                new Client()
22
            );
23
        });
24
    }
25
26
    public function provides()
27
    {
28
        return [
29
            SmsRuApi::class,
30
        ];
31
    }
32
}
33