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

PhoneNumber::getPrefixedIDDCode()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 2

Importance

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