DirectoryResponseMessage   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 8
c 0
b 0
f 0
dl 0
loc 43
ccs 0
cts 10
cp 0
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A parse() 0 6 1
A get_directory() 0 2 1
A __construct() 0 2 1
1
<?php
2
/**
3
 * Directory response message.
4
 *
5
 * @author    Pronamic <[email protected]>
6
 * @copyright 2005-2021 Pronamic
7
 * @license   GPL-3.0-or-later
8
 * @package   Pronamic\WordPress\Pay
9
 */
10
11
namespace Pronamic\WordPress\Pay\Gateways\IDealAdvancedV3\XML;
12
13
use Pronamic\WordPress\Pay\Gateways\IDealAdvancedV3\Directory;
14
use SimpleXMLElement;
15
16
/**
17
 * Title: iDEAL directory response XML message
18
 * Description:
19
 * Copyright: 2005-2021 Pronamic
20
 * Company: Pronamic
21
 *
22
 * @author  Remco Tolsma
23
 * @version 2.0.0
24
 */
25
class DirectoryResponseMessage extends ResponseMessage {
26
	/**
27
	 * The document element name
28
	 *
29
	 * @var string
30
	 */
31
	const NAME = 'DirectoryRes';
32
33
	/**
34
	 * The directory
35
	 *
36
	 * @var Directory
37
	 */
38
	public $directory;
39
40
	/**
41
	 * Constructs and initialize an directory response message
42
	 */
43
	final public function __construct() {
44
		parent::__construct( self::NAME );
45
	}
46
47
	/**
48
	 * Get the directory
49
	 *
50
	 * @return Directory
51
	 */
52
	public function get_directory() {
53
		return $this->directory;
54
	}
55
56
	/**
57
	 * Parse the specified XML into an directory response message object
58
	 *
59
	 * @param SimpleXMLElement $xml XML.
60
	 * @return DirectoryResponseMessage
61
	 */
62
	public static function parse( SimpleXMLElement $xml ) {
63
		$message = self::parse_create_date( $xml, new static() );
64
65
		$message->directory = DirectoryParser::parse( $xml->Directory );
66
67
		return $message;
68
	}
69
}
70