TwilioSmsHandlerProvider::register()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 13
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 3
Bugs 0 Features 0
Metric Value
c 3
b 0
f 0
dl 0
loc 13
ccs 0
cts 13
cp 0
rs 9.4286
cc 2
eloc 9
nc 2
nop 1
crap 6
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