MockSmsHandler   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 76.92%
Metric Value
wmc 4
lcom 0
cbo 0
dl 0
loc 29
ccs 10
cts 13
cp 0.7692
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A setDefaultFrom() 0 4 1
A lookupNumber() 0 6 1
A sendSMS() 0 5 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;
0 ignored issues
show
Coding Style introduced by
There must be one blank line after the namespace declaration
Loading history...
12
13
14
use Silex\Application;
15
16
class MockSmsHandler implements SmsHandlerInterface
17
{
18
    protected $from;
19
    protected $container;
20
21 6
    public function __construct(Application $app)
22
    {
23 6
        $this->container = $app;
24 6
    }
25
26
    public function setDefaultFrom($from)
27
    {
28
        $this->from = $from;
29
    }
30
31 3
    public function lookupNumber($number, $countryCode)
32
    {
33 3
        $code = $this->container['session']->get('code');
34 3
        $fakeNumber = "+15005550000 ({$code})";
35 3
        return $fakeNumber;
36
    }
37
38 3
    public function sendSMS($to, $body, $from = null)
39
    {
40 3
        $fakeSid = 1;
41 3
        return $fakeSid;
42
    }
43
44
}
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...