TwilioSmsHandlerProvider::boot()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 4
ccs 0
cts 4
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 1
crap 2
1
<?php
2
/**
3
 * This file is part of the Apiary SMS Login Provider package.
4
 *
5
 * (c) Darren Mothersele <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace Apiary\SmsLoginProvider\SmsHandler;
12
13
use Silex\Application;
14
use Silex\ServiceProviderInterface;
15
16
class TwilioSmsHandlerProvider implements ServiceProviderInterface
17
{
18
19
    public function register(Application $app)
20
    {
21
        if (!isset($app['sms.handler.from'])) {
22
            $app['sms.handler.from'] = 'Apiary';
23
        }
24
        $app['sms.handler'] = $app->share(function () use ($app) {
25
            $lookupClient = new \Lookups_Services_Twilio($app['sms.handler.twilio_sid'],
26
                $app['sms.handler.twilio_auth_token']);
27
            $client = new \Services_Twilio($app['sms.handler.twilio_sid'],
28
                $app['sms.handler.twilio_auth_token']);
29
            return new TwilioSmsHandler($lookupClient, $client);
30
        });
31
    }
32
33
    public function boot(Application $app)
34
    {
35
        $app['sms.handler']->setDefaultFrom($app['sms.handler.from']);
36
    }
37
38
}
0 ignored issues
show
Coding Style introduced by
According to PSR2, the closing brace of classes should be placed on the next line directly after the body.

Below you find some examples:

// Incorrect placement according to PSR2
class MyClass
{
    public function foo()
    {

    }
    // This blank line is not allowed.

}

// Correct
class MyClass
{
    public function foo()
    {

    } // No blank lines after this line.
}
Loading history...
39