Conditions | 2 |
Paths | 2 |
Total Lines | 12 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Tests | 4 |
CRAP Score | 2.1481 |
Changes | 5 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
15 | function phone_format($phone, $country = null, $format = PhoneNumberFormat::INTERNATIONAL) |
||
16 | { |
||
17 | 3 | $lib = App::make('libphonenumber'); |
|
18 | |||
19 | 3 | if (!$country) { |
|
|
|||
20 | $country = App::getLocale(); |
||
21 | } |
||
22 | |||
23 | 3 | $phoneNumber = $lib->parse($phone, $country); |
|
24 | |||
25 | 3 | return $lib->format($phoneNumber, $format); |
|
26 | } |
||
27 | } |
||
28 |
In PHP, under loose comparison (like
==
, or!=
, orswitch
conditions), values of different types might be equal.For
string
values, the empty string''
is a special case, in particular the following results might be unexpected: