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