| Conditions | 5 |
| Paths | 6 |
| Total Lines | 35 |
| Code Lines | 21 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 30 |
| Changes | 0 | ||
| 1 | <?php |
||
| 29 | public static function transform( Pay_Address $address ) { |
||
| 30 | $country = $address->get_country(); |
||
|
|
|||
| 31 | |||
| 32 | if ( null === $country ) { |
||
| 33 | return null; |
||
| 34 | } |
||
| 35 | |||
| 36 | $country_code = $country->get_code(); |
||
| 37 | |||
| 38 | if ( null === $country_code ) { |
||
| 39 | return null; |
||
| 40 | } |
||
| 41 | |||
| 42 | $state_or_province = null; |
||
| 43 | |||
| 44 | $region = $address->get_region(); |
||
| 45 | |||
| 46 | if ( null !== $region ) { |
||
| 47 | $state_or_province = $region->get_code(); |
||
| 48 | } |
||
| 49 | |||
| 50 | try { |
||
| 51 | $address = new Address( |
||
| 52 | $country_code, |
||
| 53 | $address->get_street_name(), |
||
| 54 | strval( $address->get_house_number() ), |
||
| 55 | $address->get_postal_code(), |
||
| 56 | $address->get_city(), |
||
| 57 | $state_or_province |
||
| 58 | ); |
||
| 59 | } catch ( InvalidArgumentException $exception ) { |
||
| 60 | return null; |
||
| 61 | } |
||
| 62 | |||
| 63 | return $address; |
||
| 64 | } |
||
| 66 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.