Conditions | 3 |
Paths | 3 |
Total Lines | 15 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 3.072 |
Changes | 0 |
1 | <?php |
||
35 | 2 | public function formatPhoneLength($length = 10) |
|
36 | { |
||
37 | 2 | $phone_length = strlen($this->phone); |
|
38 | 2 | $phone_diff = $phone_length - $length; |
|
39 | |||
40 | 2 | if ($phone_diff == 0) { |
|
41 | 2 | return $this; |
|
42 | 1 | } elseif($phone_diff == 1) { |
|
43 | 1 | $this->phone = mb_substr($this->phone, 1); |
|
44 | 1 | return $this; |
|
45 | } else { |
||
46 | $this->phone = false; |
||
47 | return $this; |
||
48 | } |
||
49 | } |
||
50 | |||
61 |