Completed
Push — master ( 83a557...8e0143 )
by Remco
11:52 queued 05:23
created

ResponseObject   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Test Coverage

Coverage 77.78%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 7
c 2
b 0
f 0
dl 0
loc 38
ccs 7
cts 9
cp 0.7778
rs 10
wmc 4

3 Methods

Rating   Name   Duplication   Size   Complexity  
A set_original_object() 0 2 1
A get_json() 0 6 2
A get_original_object() 0 2 1
1
<?php
2
/**
3
 * Response
4
 *
5
 * @author    Pronamic <[email protected]>
6
 * @copyright 2005-2019 Pronamic
7
 * @license   GPL-3.0-or-later
8
 * @package   Pronamic\WordPress\Pay\Gateways\Adyen
9
 */
10
11
namespace Pronamic\WordPress\Pay\Gateways\Adyen;
12
13
use Pronamic\WordPress\Pay\Core\Statuses as Core_Statuses;
14
15
/**
16
 * Response object
17
 *
18
 * @author  Remco Tolsma
19
 * @version 1.0.0
20
 * @since   1.0.0
21
 */
22
abstract class ResponseObject {
23
	/**
24
	 * Originale response object.
25
	 *
26
	 * @var object|null
27
	 */
28
	private $original_object;
29
30
	/**
31
	 * Get original object.
32
	 *
33
	 * @return object|null
34
	 */
35
	public function get_original_object() {
36
		return $this->original_object;
37
	}
38
39
	/**
40
	 * Set original object.
41
	 *
42
	 * @param object|null $object Object.
43
	 * @return void
44
	 */
45 12
	public function set_original_object( $object ) {
46 12
		$this->original_object = $object;
47 12
	}
48
49
	/**
50
	 * Get JSON.
51
	 *
52
	 * @return object
53
	 */
54 2
	public function get_json() {
55 2
		if ( null !== $this->original_object ) {
56 1
			return $this->original_object;
57
		}
58
59 1
		return (object) array();
60
	}
61
}
62