ErrorParser::parse()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 7
ccs 0
cts 6
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 2
1
<?php
2
/**
3
 * Error 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\Error as Sisow_Error;
15
use SimpleXMLElement;
16
17
/**
18
 * Title: Error XML parser
19
 * Description:
20
 * Copyright: 2005-2022 Pronamic
21
 * Company: Pronamic
22
 *
23
 * @author  Remco Tolsma
24
 * @version 2.0.0
25
 * @since   1.0.0
26
 */
27
class ErrorParser implements Parser {
28
	/**
29
	 * Parse the specified XML element.
30
	 *
31
	 * @param SimpleXMLElement $xml XML element to parse.
32
	 * @return Sisow_Error
33
	 */
34
	public static function parse( SimpleXMLElement $xml ) {
35
		$error = new Sisow_Error(
36
			(string) Security::filter( $xml->errorcode ),
37
			(string) Security::filter( $xml->errormessage )
38
		);
39
40
		return $error;
41
	}
42
}
43