Test Failed
Push — develop ( 42667f...16570e )
by Reüel
03:52
created

src/Statuses.php (1 issue)

Labels
Severity
1
<?php
2
/**
3
 * Mollie statuses.
4
 *
5
 * @author    Pronamic <[email protected]>
6
 * @copyright 2005-2019 Pronamic
7
 * @license   GPL-3.0-or-later
8
 * @package   Pronamic\WordPress\Pay
9
 */
10
11
namespace Pronamic\WordPress\Pay\Gateways\Mollie;
12
13
use Pronamic\WordPress\Pay\Payments\PaymentStatus as Core_Statuses;
0 ignored issues
show
The type Pronamic\WordPress\Pay\Payments\PaymentStatus 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...
14
15
/**
16
 * Title: Mollie statuses constants
17
 * Description:
18
 * Copyright: 2005-2019 Pronamic
19
 * Company: Pronamic
20
 *
21
 * @link https://docs.mollie.com/payments/status-changes
22
 *
23
 * @author  Remco Tolsma
24
 * @version 2.1.0
25
 * @since   1.0.0
26
 */
27
class Statuses {
28
	/**
29
	 * Authorized.
30
	 *
31
	 * @var string
32
	 */
33
	const AUTHORIZED = 'authorized';
34
35
	/**
36
	 * Open.
37
	 *
38
	 * @var string
39
	 */
40
	const OPEN = 'open';
41
42
	/**
43
	 * Canceled.
44
	 *
45
	 * @var string
46
	 */
47
	const CANCELED = 'canceled';
48
49
	/**
50
	 * Paid.
51
	 *
52
	 * @var string
53
	 */
54
	const PAID = 'paid';
55
56
	/**
57
	 * Expired.
58
	 *
59
	 * @var string
60
	 */
61
	const EXPIRED = 'expired';
62
63
	/**
64
	 * Failed.
65
	 *
66
	 * @since 2.0.3
67
	 * @var string
68
	 */
69
	const FAILED = 'failed';
70
71
	/**
72
	 * Pending.
73
	 *
74
	 * @var string
75
	 */
76
	const PENDING = 'pending';
77
78
	/**
79
	 * Transform an Mollie state to an more global status.
80
	 *
81
	 * @param string $status Mollie status.
82
	 *
83
	 * @return string|null Pay status.
84
	 */
85
	public static function transform( $status ) {
86
		switch ( $status ) {
87
			case self::PENDING:
88
			case self::OPEN:
89
				return Core_Statuses::OPEN;
90
91 8
			case self::CANCELED:
92
				return Core_Statuses::CANCELLED;
93 8
94 8
			case self::PAID:
95 1
				return Core_Statuses::SUCCESS;
96
97 7
			case self::EXPIRED:
98 1
				return Core_Statuses::EXPIRED;
99
100 6
			case self::FAILED:
101 1
				return Core_Statuses::FAILURE;
102
103 5
			default:
104 1
				return null;
105
		}
106 4
	}
107
}
108