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