ResponseMessage   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 17
ccs 0
cts 6
cp 0
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A parse_create_date() 0 8 2
1
<?php
2
/**
3
 * 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 DateTimeImmutable;
14
use SimpleXMLElement;
15
16
/**
17
 * Title: iDEAL 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
abstract class ResponseMessage extends Message {
26
	/**
27
	 * Parse the specified XML into a response message object
28
	 *
29
	 * @param SimpleXMLElement $xml     XML.
30
	 * @param static           $message Message.
31
	 * @return static
32
	 * @throws \Exception Throws exception on date error.
33
	 */
34
	public static function parse_create_date( SimpleXMLElement $xml, $message ) {
35
		if ( ! empty( $xml->createDateTimestamp ) ) {
36
			$date = new DateTimeImmutable( (string) $xml->createDateTimestamp );
37
38
			$message->set_create_date( $date );
39
		}
40
41
		return $message;
42
	}
43
}
44