Conditions | 2 |
Paths | 1 |
Total Lines | 26 |
Lines | 0 |
Ratio | 0 % |
Tests | 17 |
CRAP Score | 2 |
Changes | 0 |
1 | <?php |
||
14 | 2 | public function boot() |
|
15 | { |
||
16 | 2 | $this->app->when(TwilioChannel::class) |
|
17 | 2 | ->needs(Twilio::class) |
|
18 | ->give(function () { |
||
19 | 2 | return new Twilio( |
|
20 | 2 | $this->app->make(TwilioService::class), |
|
21 | 2 | $this->app->make(TwilioConfig::class) |
|
22 | ); |
||
23 | 2 | }); |
|
24 | |||
25 | $this->app->bind(TwilioService::class, function () { |
||
26 | 2 | $config = $this->app['config']['services.twilio']; |
|
27 | 2 | $account_sid = Arr::get($config, 'account_sid'); |
|
28 | 2 | $username = Arr::get($config, 'username'); |
|
29 | 2 | if (! empty($username)) { |
|
30 | 1 | $password = Arr::get($config, 'password'); |
|
31 | |||
32 | 1 | return new TwilioService($username, $password, $account_sid); |
|
33 | } else { |
||
34 | 1 | $auth_token = Arr::get($config, 'auth_token'); |
|
35 | |||
36 | 1 | return new TwilioService($account_sid, $auth_token); |
|
37 | } |
||
38 | 2 | }); |
|
39 | 2 | } |
|
40 | |||
51 |