Passed
Push — master ( ac4415...6c0960 )
by Zing
04:55
created

PhoneNumber   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 35
ccs 8
cts 8
cp 1
rs 10
wmc 5

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getPrefixedIDDCode() 0 3 2
A getZeroPrefixedNumber() 0 3 1
A getPrefixedNumber() 0 3 1
A getUniversalNumber() 0 3 1
1
<?php
2
3
namespace Zing\LaravelSms;
4
5
class PhoneNumber extends \Overtrue\EasySms\PhoneNumber
6
{
7
    /**
8
     * +8618888888888.
9
     *
10
     * @return string
11
     */
12 12
    public function getUniversalNumber()
13
    {
14 12
        return $this->getPrefixedNumber('+');
15
    }
16
17
    /**
18
     * 008618888888888.
19
     *
20
     * @return string
21
     */
22 2
    public function getZeroPrefixedNumber()
23
    {
24 2
        return $this->getPrefixedNumber('00');
25
    }
26
27 12
    public function getPrefixedNumber($prefix)
28
    {
29 12
        return $this->getPrefixedIDDCode($prefix) . $this->number;
30
    }
31
32
    /**
33
     * @param string $prefix
34
     *
35
     * @return string|null
36
     */
37 12
    public function getPrefixedIDDCode($prefix)
38
    {
39 12
        return $this->IDDCode ? $prefix . $this->IDDCode : null;
40
    }
41
}
42