TwilioSmsHandlerProvider   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Test Coverage

Coverage 0%

Importance

Changes 3
Bugs 0 Features 0
Metric Value
wmc 3
c 3
b 0
f 0
lcom 0
cbo 4
dl 0
loc 23
ccs 0
cts 17
cp 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A register() 0 13 2
A boot() 0 4 1
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