| Conditions | 7 | 
| Paths | 5 | 
| Total Lines | 35 | 
| Code Lines | 19 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Tests | 0 | 
| CRAP Score | 56 | 
| Changes | 0 | ||
| 1 | <?php  | 
            ||
| 20 | public function parse($xmlString)  | 
            ||
| 21 |     { | 
            ||
| 22 | $response = new Response();  | 
            ||
| 23 | |||
| 24 |         try { | 
            ||
| 25 | $response->loadXml($xmlString);  | 
            ||
| 26 |         } catch (\Exception $e) { | 
            ||
| 27 | throw new ParserException($e->getMessage(), $e->getCode(), $e);  | 
            ||
| 28 | }  | 
            ||
| 29 | |||
| 30 |         if ($response->isFault()) { | 
            ||
| 31 | $fault = $response->getFault();  | 
            ||
| 32 | |||
| 33 | throw new FaultException($fault->getMessage(), $fault->getCode());  | 
            ||
| 34 | }  | 
            ||
| 35 | |||
| 36 | $result = $response->getReturnValue();  | 
            ||
| 37 | |||
| 38 | $toBeVisited = [&$result];  | 
            ||
| 39 | |||
| 40 |         while (isset($toBeVisited[0]) && $value = &$toBeVisited[0]) { | 
            ||
| 41 | $type = gettype($value);  | 
            ||
| 42 |             if ($type === 'array') { | 
            ||
| 43 |                 foreach ($value as &$element) { | 
            ||
| 44 | $toBeVisited[] = &$element;  | 
            ||
| 45 | }  | 
            ||
| 46 | |||
| 47 | reset($value); // Reset all array pointers  | 
            ||
| 48 | }  | 
            ||
| 49 | |||
| 50 | array_shift($toBeVisited);  | 
            ||
| 51 | }  | 
            ||
| 52 | |||
| 53 | return $result;  | 
            ||
| 54 | }  | 
            ||
| 55 | }  | 
            ||
| 56 |