ReservationParser::parse()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 8
ccs 0
cts 6
cp 0
rs 10
cc 2
nc 2
nop 1
crap 6
1
<?php
2
/**
3
 * Reservation parser
4
 *
5
 * @author    Pronamic <[email protected]>
6
 * @copyright 2005-2022 Pronamic
7
 * @license   GPL-3.0-or-later
8
 * @package   Pronamic\WordPress\Pay\Payments
9
 */
10
11
namespace Pronamic\WordPress\Pay\Gateways\Sisow\XML;
12
13
use Pronamic\WordPress\Pay\Core\XML\Security;
14
use Pronamic\WordPress\Pay\Gateways\Sisow\Reservation;
15
use SimpleXMLElement;
16
17
/**
18
 * Reservation parser
19
 * Description:
20
 * Copyright: 2005-2022 Pronamic
21
 * Company: Pronamic
22
 *
23
 * @author  Reüel van der Steege
24
 * @version 2.0.1
25
 * @since   2.0.1
26
 */
27
class ReservationParser implements Parser {
28
	/**
29
	 * Parse XML element.
30
	 *
31
	 * @param SimpleXMLElement $xml XML element to parse.
32
	 *
33
	 * @return Reservation
34
	 */
35
	public static function parse( SimpleXMLElement $xml ) {
36
		$reservation = new Reservation();
37
38
		if ( isset( $xml->status ) ) {
39
			$reservation->status = Security::filter( $xml->status );
40
		}
41
42
		return $reservation;
43
	}
44
}
45