/**
  * @param CultureFeed_SimpleXMLElement $object
  * @return CultureFeed_Uitpas_Event_TicketSale_Opportunity
  */
 public static function createFromXml(CultureFeed_SimpleXMLElement $object)
 {
     $opportunity = new CultureFeed_Uitpas_Event_TicketSale_Opportunity();
     $opportunity->type = CultureFeed_Uitpas_Event_TicketSale_Opportunity::TYPE_DEFAULT;
     if (isset($object['type'])) {
         $opportunity->type = (string) $object['type'];
     }
     $opportunity->buyConstraintReason = $object->xpath_str('buyConstraintReason', FALSE);
     foreach ($object->xpath('priceClasses/priceClass') as $priceClass) {
         $opportunity->priceClasses[] = CultureFeed_Uitpas_Event_PriceClass::createFromXml($priceClass);
     }
     $couponElement = $object->xpath('ticketSaleCoupon', FALSE);
     if ($couponElement instanceof CultureFeed_SimpleXMLElement) {
         $opportunity->ticketSaleCoupon = CultureFeed_Uitpas_Event_TicketSale_Coupon::createFromXml($couponElement);
     }
     $remainingForEventElement = $object->xpath('remainingForEvent', FALSE);
     if ($remainingForEventElement instanceof CultureFeed_SimpleXMLElement) {
         $opportunity->remainingForEvent = CultureFeed_Uitpas_PeriodConstraint::createFromXml($remainingForEventElement);
     }
     $remainingTotalElement = $object->xpath('remainingTotal', FALSE);
     if ($remainingTotalElement instanceof CultureFeed_SimpleXMLElement) {
         $opportunity->remainingTotal = CultureFeed_Uitpas_PeriodConstraint::createFromXml($remainingTotalElement);
     }
     return $opportunity;
 }
Beispiel #2
0
 /**
  * @param CultureFeed_SimpleXMLElement $object
  * @return CultureFeed_Uitpas_Event_TicketSale_Coupon
  */
 public static function createFromXml(CultureFeed_SimpleXMLElement $object)
 {
     $coupon = new CultureFeed_Uitpas_Event_TicketSale_Coupon();
     $coupon->id = $object->xpath_str('id', FALSE);
     $coupon->name = $object->xpath_str('name', FALSE);
     $coupon->description = $object->xpath_str('description', FALSE);
     $coupon->validFrom = $object->xpath_time('validFrom');
     $coupon->validTo = $object->xpath_time('validTo');
     $exchangeConstraintElement = $object->xpath('exchangeConstraint', FALSE);
     if ($exchangeConstraintElement instanceof CultureFeed_SimpleXMLElement) {
         $coupon->exchangeConstraint = CultureFeed_Uitpas_PeriodConstraint::createFromXML($exchangeConstraintElement);
     }
     $buyConstraintElement = $object->xpath('buyConstraint', FALSE);
     if ($buyConstraintElement instanceof CultureFeed_SimpleXMLElement) {
         $coupon->buyConstraint = CultureFeed_Uitpas_PeriodConstraint::createFromXML($buyConstraintElement);
     }
     $remainingTotalElement = $object->xpath('remainingTotal', FALSE);
     if ($remainingTotalElement instanceof CultureFeed_SimpleXMLElement) {
         $coupon->remainingTotal = CultureFeed_Uitpas_PeriodConstraint::createFromXML($remainingTotalElement);
     }
     return $coupon;
 }