/** * @param string $code. * @param CultureFeed_SimpleXMLElement $xml * * @return self */ public static function createFromXML($code, $xml) { $message = $xml->xpath_str('/response/message'); $exception = new static($message, $code); if ($code == 'INSZ_ALREADY_USED') { $exception->cardSystemLinks = array(); foreach ($xml->xpath('cardSystemLinks/cardSystemLink') as $cardSystemLink) { $cardSystemId = $cardSystemLink->xpath_int('cardSystem/id', FALSE); $exception->cardSystemLinks[$cardSystemId] = CultureFeed_Uitpas_CardInfo::createFromXml($cardSystemLink, FALSE); } $exception->userId = $xml->xpath_str('/response/userId'); } return $exception; }
/** * {@inheritdoc} */ public function getCard(CultureFeed_Uitpas_CardInfoQuery $card_query) { $data = $card_query->toPostData(); $result = $this->oauth_client->authenticatedGetAsXml('uitpas/card', $data); try { $xml = new CultureFeed_SimpleXMLElement($result); } catch (Exception $e) { throw new CultureFeed_ParseException($result); } $card = CultureFeed_Uitpas_CardInfo::createFromXML($xml->xpath('/response', FALSE)); return $card; }