1 | <?php |
||
2 | /** |
||
3 | * Amount transformer. |
||
4 | * |
||
5 | * @author Pronamic <[email protected]> |
||
6 | * @copyright 2005-2021 Pronamic |
||
7 | * @license GPL-3.0-or-later |
||
8 | * @package Pronamic\WordPress\Pay\Gateways\Mollie |
||
9 | */ |
||
10 | |||
11 | namespace Pronamic\WordPress\Pay\Gateways\Mollie; |
||
12 | |||
13 | use Pronamic\WordPress\Money\Money; |
||
14 | |||
15 | /** |
||
16 | * Amount transformer |
||
17 | * |
||
18 | * @author Reüel van der Steege |
||
19 | * @version 2.1.0 |
||
20 | * @since 2.1.0 |
||
21 | */ |
||
22 | class AmountTransformer { |
||
23 | /** |
||
24 | * Transform Pronamic money to Mollie amount. |
||
25 | * |
||
26 | * @param Money $money Pronamic money to convert. |
||
27 | * @return Amount |
||
28 | * @throws \InvalidArgumentException Throws exception on invalid alphabetic currency code in given money object. |
||
29 | */ |
||
30 | 2 | public static function transform( Money $money ) { |
|
31 | 2 | $alphabetic_code = $money->get_currency()->get_alphabetic_code(); |
|
32 | |||
33 | 2 | $amount = new Amount( |
|
34 | $alphabetic_code, |
||
35 | /** |
||
36 | * Make sure to send the right amount of decimals and omit the |
||
37 | 2 | * thousands separator. Non-string values are not accepted. |
|
38 | 2 | * |
|
39 | 2 | * @link https://docs.mollie.com/reference/v2/payments-api/create-payment |
|
40 | */ |
||
41 | $money->number_format( null, '.', '' ) |
||
0 ignored issues
–
show
|
|||
42 | 2 | ); |
|
43 | |||
44 | return $amount; |
||
45 | } |
||
46 | } |
||
47 |
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.