DirectebankIssuers::transform()   A
last analyzed

Complexity

Conditions 5
Paths 5

Size

Total Lines 10
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 30

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 5
eloc 8
nc 5
nop 1
dl 0
loc 10
ccs 0
cts 9
cp 0
crap 30
rs 9.6111
c 1
b 0
f 0
1
<?php
2
/**
3
 * Directebank Issuers.
4
 *
5
 * @author    Pronamic <[email protected]>
6
 * @copyright 2005-2021 Pronamic
7
 * @license   GPL-3.0-or-later
8
 * @package   Pronamic\WordPress\Pay\Gateways\Icepay
9
 */
10
11
namespace Pronamic\WordPress\Pay\Gateways\Icepay;
12
13
use Pronamic\WordPress\Pay\Payments\PaymentLineType;
14
15
/**
16
 * Product categories.
17
 *
18
 * @author  Reüel van der Steege
19
 * @version 2.0.5
20
 * @since   2.0.5
21
 */
22
class DirectebankIssuers {
23
	/**
24
	 * Issuer 'RETAIL'.
25
	 *
26
	 * @var string
27
	 */
28
	const RETAIL = 'RETAIL';
29
30
	/**
31
	 * Issuer 'DIGITAL'.
32
	 *
33
	 * @var string
34
	 */
35
	const DIGITAL = 'DIGITAL';
36
37
	/**
38
	 * Issuer 'ADULT'.
39
	 *
40
	 * @var string
41
	 */
42
	const ADULT = 'ADULT';
43
44
	/**
45
	 * Transform Pronamic payment line type to Icepay Directebank issuer.
46
	 *
47
	 * @param string $type Pronamic payment line type.
48
	 *
49
	 * @return string
50
	 */
51
	public static function transform( $type ) {
52
		switch ( $type ) {
53
			case PaymentLineType::PHYSICAL:
54
				return self::RETAIL;
55
56
			case PaymentLineType::DIGITAL:
57
			case PaymentLineType::DISCOUNT:
58
			case PaymentLineType::SHIPPING:
59
			default:
60
				return self::DIGITAL;
61
		}
62
	}
63
}
64