| Conditions | 3 |
| Paths | 4 |
| Total Lines | 18 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 12 |
| Changes | 0 | ||
| 1 | <?php |
||
| 35 | public static function parse( SimpleXMLElement $xml ) { |
||
| 36 | $directory = new Directory(); |
||
| 37 | |||
| 38 | // Date. |
||
| 39 | $timestamp = Security::filter( $xml->directoryDateTimestamp ); |
||
| 40 | |||
| 41 | if ( null !== $timestamp ) { |
||
| 42 | $directory->set_date( new DateTime( $timestamp ) ); |
||
| 43 | } |
||
| 44 | |||
| 45 | // Country. |
||
| 46 | foreach ( $xml->Country as $element ) { |
||
| 47 | $country = CountryParser::parse( $element ); |
||
|
|
|||
| 48 | |||
| 49 | $directory->add_country( $country ); |
||
| 50 | } |
||
| 51 | |||
| 52 | return $directory; |
||
| 53 | } |
||
| 55 |