1 | <?php |
||
2 | /** |
||
3 | * Country parser. |
||
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 Pronamic\WordPress\Pay\Core\XML\Security; |
||
14 | use Pronamic\WordPress\Pay\Gateways\IDealAdvancedV3\Country; |
||
15 | use SimpleXMLElement; |
||
16 | |||
17 | /** |
||
18 | * Title: Issuer XML parser |
||
19 | * Description: |
||
20 | * Copyright: 2005-2021 Pronamic |
||
21 | * Company: Pronamic |
||
22 | * |
||
23 | * @author Remco Tolsma |
||
24 | * @version 2.0.0 |
||
25 | */ |
||
26 | class CountryParser implements Parser { |
||
27 | /** |
||
28 | * Parse |
||
29 | * |
||
30 | * @param SimpleXMLElement $xml XML. |
||
31 | * @return Country |
||
32 | */ |
||
33 | public static function parse( SimpleXMLElement $xml ) { |
||
34 | $country = new Country(); |
||
35 | |||
36 | // Name. |
||
37 | $name = Security::filter( $xml->countryNames ); |
||
38 | |||
39 | if ( null !== $name ) { |
||
40 | $country->set_name( $name ); |
||
41 | } |
||
42 | |||
43 | // Issuers. |
||
44 | foreach ( $xml->Issuer as $element ) { |
||
45 | $issuer = IssuerParser::parse( $element ); |
||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||
46 | |||
47 | $country->add_issuer( $issuer ); |
||
48 | } |
||
49 | |||
50 | return $country; |
||
51 | } |
||
52 | } |
||
53 |