SmsBroadcastServiceProvider   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

Changes 2
Bugs 1 Features 0
Metric Value
eloc 9
c 2
b 1
f 0
dl 0
loc 17
rs 10
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A register() 0 12 3
1
<?php
2
3
namespace NotificationChannels\SmsBroadcast;
4
5
use Atymic\SmsBroadcast\Api\Client;
6
use Atymic\SmsBroadcast\Factory\ClientFactory;
7
use Illuminate\Support\ServiceProvider;
8
9
class SmsBroadcastServiceProvider extends ServiceProvider
10
{
11
    /**
12
     * Register the application services.
13
     */
14
    public function register()
15
    {
16
        $this->app->singleton(Client::class, function ($app) {
17
            if (empty($app['config']['services.smsbroadcast.username'])
18
                || empty($app['config']['services.smsbroadcast.password'])) {
19
                throw new \InvalidArgumentException('Missing SMS broadcast config in services');
20
            }
21
22
            return ClientFactory::create(
23
                $app['config']['services.smsbroadcast.username'],
24
                $app['config']['services.smsbroadcast.password'],
25
                $app['config']['services.smsbroadcast.default_sender']
26
            );
27
        });
28
    }
29
}
30