Failed Conditions
Push — develop ( aef6a8...cf0116 )
by Remco
08:22 queued 02:22
created

src/MoneyTransformer.php (1 issue)

Labels
Severity
1
<?php
2
/**
3
 * Money 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\OmniKassa2
9
 */
10
11
namespace Pronamic\WordPress\Pay\Gateways\OmniKassa2;
12
13
use Pronamic\WordPress\Money\Money as PronamicMoney;
14
15
/**
16
 * Money transformer
17
 *
18
 * @author  Remco Tolsma
19
 * @version 2.1.8
20
 * @since   2.0.2
21
 */
22
class MoneyTransformer {
23
	/**
24
	 * Transform Pronamic money to OmniKassa 2.0 money.
25
	 *
26
	 * @param PronamicMoney $pronamic_money Pronamic money to convert.
27
	 * @return Money
28
	 * @throws \InvalidArgumentException Throws exception on invalid alphabetic currency code in given Pronamic money object.
29
	 */
30
	public static function transform( PronamicMoney $pronamic_money ) {
31
		$money = new Money(
32
			$pronamic_money->get_currency()->get_alphabetic_code(),
33
			$pronamic_money->get_minor_units()->to_int()
0 ignored issues
show
The method to_int() does not exist on integer. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

33
			$pronamic_money->get_minor_units()->/** @scrutinizer ignore-call */ to_int()

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.

Loading history...
34
		);
35
36
		return $money;
37
	}
38
}
39