Failed Conditions
Push — develop ( 3861b4...1ec521 )
by Reüel
07:46
created

AmountTransformer::transform()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 7
c 0
b 0
f 0
ccs 5
cts 5
cp 1
rs 10
cc 1
nc 1
nop 1
crap 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 PronamicMoney $pronamic_money Pronamic money to convert.
0 ignored issues
show
Bug introduced by
The type Pronamic\WordPress\Pay\G...ys\Mollie\PronamicMoney was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
27
	 * @return Money
28
	 */
29 2
	public static function transform( Money $money ) {
30 2
		$amount = new Amount(
31 2
			strval( $money->get_currency()->get_alphabetic_code() ),
32 2
			$money->format()
33
		);
34
35 2
		return $amount;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $amount returns the type Pronamic\WordPress\Pay\Gateways\Mollie\Amount which is incompatible with the documented return type Pronamic\WordPress\Money\Money.
Loading history...
36
	}
37
}
38