Test Failed
Push — develop ( a27985...65fb41 )
by Reüel
12:25
created

src/Statuses.php (1 issue)

Labels
Severity
1
<?php
2
3
namespace Pronamic\WordPress\Pay\Gateways\Nocks;
4
5
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...
6
7
/**
8
 * Title: Nocks statuses
9
 * Description:
10
 * Copyright: 2005-2019 Pronamic
11
 * Company: Pronamic
12
 *
13
 * @author  Reüel van der Steege
14
 * @version 2.0.0
15
 * @since   1.0.0
16
 */
17
class Statuses {
18
	/**
19
	 * Cancelled
20
	 *
21
	 * @var string
22
	 */
23
	const CANCELLED = 'cancelled';
24
25
	/**
26
	 * Completed
27
	 *
28
	 * @var string
29
	 */
30
	const COMPLETED = 'completed';
31
32
	/**
33
	 * Expired.
34
	 *
35
	 * @var string
36
	 */
37
	const EXPIRED = 'expired';
38
39
	/**
40
	 * Failed
41
	 *
42
	 * @var string
43
	 */
44
	const FAILED = 'failed';
45
46
	/**
47
	 * Pending
48
	 *
49
	 * @var string
50
	 */
51
	const PENDING = 'pending';
52
53
	/**
54
	 * Processing
55
	 *
56
	 * @var string
57
	 */
58
	const PROCESSING = 'processing';
59
60
	/**
61
	 * Transform a Nocks status to Pronamic Pay status.
62
	 *
63
	 * @param string $status
64
	 *
65
	 * @return string|null
66
	 */
67
	public static function transform( $status ) {
68
		switch ( $status ) {
69
			case self::CANCELLED:
70
				return Core_Statuses::CANCELLED;
71
72
			case self::COMPLETED:
73
				return Core_Statuses::SUCCESS;
74
75
			case self::EXPIRED:
76
				return Core_Statuses::EXPIRED;
77
78
			case self::FAILED:
79
				return Core_Statuses::FAILURE;
80
81
			case self::PENDING:
82
				return Core_Statuses::OPEN;
83
84
			default:
85
				return null;
86
		}
87
	}
88
}
89