Test Failed
Push — master ( 272cf6...4fb2a3 )
by Remco
21:31 queued 14:28
created

AmountTransformer::transform()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 7
rs 10
cc 1
nc 1
nop 1
1
<?php
2
/**
3
 * Amount transformer.
4
 *
5
 * @author    Pronamic <[email protected]>
6
 * @copyright 2005-2019 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
	 *
28
	 * @return Amount
29
	 */
30
	public static function transform( Money $money ) {
31
		$amount = new Amount(
32
			strval( $money->get_currency()->get_alphabetic_code() ),
33
			$money->format()
34
		);
35
36
		return $amount;
37
	}
38
}
39