/**
  * @param CultureFeed_SimpleXMLElement $xml
  * @return CultureFeed_Uitpas_Passholder_ExecuteEventActionsResult_PointsPromotionsResponse
  */
 public static function createFromXML(CultureFeed_SimpleXMLElement $xml)
 {
     $response = new self();
     $response->code = $xml->xpath_str('code');
     $response->promotion = CultureFeed_Uitpas_Passholder_PointsPromotion::createFromXML($xml->xpath('promotion', false));
     if ($response->code === 'ACTION_NOT_ALLOWED') {
         $response->cashInState = $xml->xpath_str('cashInState');
     }
     return $response;
 }
 public static function createFromXML(CultureFeed_SimpleXMLElement $xml, $elementName = 'promotion')
 {
     $promotions = array();
     $objects = $xml->xpath('promotions/' . $elementName);
     $total = $xml->xpath_int('total');
     foreach ($objects as $object) {
         $promotions[] = CultureFeed_Uitpas_Passholder_PointsPromotion::createFromXML($object);
     }
     return new self($total, $promotions);
 }
Beispiel #3
0
 public function getPointsPromotion($id, CultureFeed_Uitpas_Promotion_PassholderParameter $passholder = NULL)
 {
     $path = 'uitpas/promotion/pointsPromotion/' . $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);
     }
     $promotion = CultureFeed_Uitpas_Passholder_PointsPromotion::createFromXML($xml);
     return $promotion;
 }