Failed Conditions
Push — feature/post-pay ( 4d43ec...e3663d )
by Remco
04:52
created

Category   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 14
dl 0
loc 33
ccs 0
cts 12
cp 0
rs 10
c 0
b 0
f 0
wmc 5

1 Method

Rating   Name   Duplication   Size   Complexity  
A transform() 0 12 5
1
<?php
2
/**
3
 * Category
4
 *
5
 * @author    Pronamic <[email protected]>
6
 * @copyright 2005-2018 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\Pay\Payments\PaymentLineType;
14
15
/**
16
 * Category
17
 *
18
 * @author  Remco Tolsma
19
 * @version 2.0.2
20
 * @since   1.0.0
21
 */
22
class Category {
23
	/**
24
	 * Physical.
25
	 *
26
	 * @var string
27
	 */
28
	const PHYSICAL = 'PHYSICAL';
29
30
	/**
31
	 * Digital.
32
	 *
33
	 * @var string
34
	 */
35
	const DIGITAL = 'DIGITAL';
36
37
	/**
38
	 * Transform an OmniKassa 2.0 status to Pronamic Pay status.
39
	 *
40
	 * @param string $status OmniKassa 2.0 status.
41
	 * @return string|null
42
	 */
43
	public static function transform( $type ) {
44
		switch ( $type ) {
45
			case PaymentLineType::DIGITAL:
46
				return self::DIGITAL;
47
			case PaymentLineType::DISCOUNT:
48
				return self::DIGITAL;
49
			case PaymentLineType::PHYSICAL:
50
				return self::PHYSICAL;
51
			case PaymentLineType::SHIPPING:
52
				return self::DIGITAL;
53
			default:
54
				return self::DIGITAL;
55
		}
56
	}
57
}
58