Failed Conditions
Push — develop ( ea4858...c314dc )
by Reüel
07:27
created

src/XML/ErrorParser.php (2 issues)

1
<?php
2
3
namespace Pronamic\WordPress\Pay\Gateways\IDealAdvancedV3\XML;
4
5
use Pronamic\WordPress\Pay\Gateways\IDealAdvancedV3\Error;
6
use Pronamic\WordPress\Pay\Core\XML\Security;
7
use SimpleXMLElement;
8
9
/**
10
 * Title: iDEAL Advanced v3 error parser
11
 * Description:
12
 * Copyright: 2005-2020 Pronamic
13
 * Company: Pronamic
14
 *
15
 * @author  Remco Tolsma
16
 * @version 2.0.0
17
 */
18
class ErrorParser {
19
	/**
20
	 * Parse the specified XML element into an acquirer error response
21
	 *
22
	 * @param SimpleXMLElement $xml
23
	 *
24
	 * @return IDeal_Error|null
0 ignored issues
show
The type Pronamic\WordPress\Pay\G...ancedV3\XML\IDeal_Error was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
25
	 */
26 1
	public function parse( SimpleXMLElement $xml ) {
27 1
		$error = null;
28
29 1
		if ( 'Error' === $xml->getName() ) {
30 1
			$error = new Error();
31
32 1
			$error->set_code( Security::filter( $xml->errorCode ) );
33 1
			$error->set_message( Security::filter( $xml->errorMessage ) );
34 1
			$error->set_detail( Security::filter( $xml->errorDetail ) );
35 1
			$error->set_suggested_action( Security::filter( $xml->suggestedAction ) );
36 1
			$error->set_consumer_message( Security::filter( $xml->consumerMessage ) );
37
		}
38
39 1
		return $error;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $error also could return the type Pronamic\WordPress\Pay\G...s\IDealAdvancedV3\Error which is incompatible with the documented return type Pronamic\WordPress\Pay\G...V3\XML\IDeal_Error|null.
Loading history...
40
	}
41
}
42