| Conditions | 2 |
| Paths | 2 |
| Total Lines | 13 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 2 |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 31 | 2 | public static function transform( Money $money ) { |
|
| 32 | 2 | $currency = $money->get_currency()->get_alphabetic_code(); |
|
| 33 | |||
| 34 | 2 | if ( null === $currency ) { |
|
| 35 | 1 | throw new InvalidArgumentException( 'Can not transform WordPress money object to Adyen amount object due to empty currency code.' ); |
|
| 36 | } |
||
| 37 | |||
| 38 | 1 | $amount = new Amount( |
|
| 39 | 1 | $currency, |
|
| 40 | 1 | $money->get_minor_units() |
|
| 41 | ); |
||
| 42 | |||
| 43 | 1 | return $amount; |
|
| 44 | } |
||
| 46 |