Test Failed
Push — develop ( 1009b1...0ad1b1 )
by Reüel
02:49
created

src/Util.php (1 issue)

Labels
Severity
1
<?php
2
3
namespace Pronamic\WordPress\Pay\Gateways\IDealBasic;
4
5
use Pronamic\WordPress\Pay\Core\Util as Core_Util;
6
use Pronamic\WordPress\Pay\Gateways\IDealBasic\XML\NotificationParser;
7
8
/**
9
 * Title: iDEAL Basic utility class
10
 * Description:
11
 * Copyright: 2005-2019 Pronamic
12
 * Company: Pronamic
13
 *
14
 * @author  Reüel van der Steege
15
 * @version 2.0.0
16
 * @since   1.0.0
17
 */
18
class Util {
19
	/**
20
	 * Get parsed notification.
21
	 */
22
	public static function get_notification() {
23
		if ( ! filter_has_var( INPUT_GET, 'xml_notification' ) && ! filter_has_var( INPUT_GET, 'xml_notifaction' ) ) {
24
			// Also check for typo 'xml_notifaction', as this has been used in the past.
25
			return;
26
		}
27
28
		$data = file_get_contents( 'php://input' );
29
30
		$xml = Core_Util::simplexml_load_string( $data );
31
32
		if ( is_wp_error( $xml ) ) {
0 ignored issues
show
The function is_wp_error was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

32
		if ( /** @scrutinizer ignore-call */ is_wp_error( $xml ) ) {
Loading history...
33
			return;
34
		}
35
36
		return NotificationParser::parse( $xml );
37
	}
38
}
39