/** * @param CultureFeed_SimpleXMLElement $xml * @return CultureFeed_Uitpas_Passholder_ExecuteEventActionsResult_WelcomeAdvantageResponse */ public static function createFromXML(CultureFeed_SimpleXMLElement $xml) { $response = new self(); $response->code = $xml->xpath_str('code'); $response->promotion = CultureFeed_Uitpas_Passholder_WelcomeAdvantage::createFromXML($xml->xpath('promotion', false)); return $response; }
public static function createFromXML(CultureFeed_SimpleXMLElement $xml, $promotionElementName = 'promotion') { $advantages = array(); $objects = $xml->xpath('promotions/' . $promotionElementName); $total = $xml->xpath_int('total'); foreach ($objects as $object) { $advantages[] = CultureFeed_Uitpas_Passholder_WelcomeAdvantage::createFromXML($object); } return new self($total, $advantages); }
/** * (non-PHPdoc) * @see CultureFeed_Uitpas::getWelcomeAdvantage() */ public function getWelcomeAdvantage($id, CultureFeed_Uitpas_Promotion_PassholderParameter $passholder = NULL) { $path = 'uitpas/promotion/welcomeAdvantage/' . $id; $params = array(); if ($passholder) { $params += $passholder->params(); } $result = $this->oauth_client->consumerGetAsXml($path, $params); try { $xml = new CultureFeed_SimpleXMLElement($result); } catch (Exception $e) { throw new CultureFeed_ParseException($result); } $advantage = CultureFeed_Uitpas_Passholder_WelcomeAdvantage::createFromXML($xml); return $advantage; }