/**
  * @param CultureFeed_SimpleXMLElement $object
  * @return CultureFeed_Uitpas_PeriodConstraint
  */
 public static function createFromXml(CultureFeed_SimpleXMLElement $object)
 {
     $periodConstraint = new CultureFeed_Uitpas_PeriodConstraint();
     $periodConstraint->type = $object->xpath_str('periodType', FALSE);
     $periodConstraint->volume = $object->xpath_int('periodVolume', FALSE);
     return $periodConstraint;
 }
Example #2
0
 public static function createFromXML(CultureFeed_SimpleXMLElement $object)
 {
     $counter = new CultureFeed_Uitpas_Passholder_Counter();
     $counter->id = $object->xpath_str('id');
     $counter->name = $object->xpath_str('name');
     return $counter;
 }
 public static function createFromXML(CultureFeed_SimpleXMLElement $xml)
 {
     $response = new self();
     $response->code = $xml->xpath_str('code');
     $response->points = $xml->xpath_int('points');
     return $response;
 }
 public static function createFromXML(CultureFeed_SimpleXMLElement $object)
 {
     $constraint = new CultureFeed_Uitpas_Passholder_PeriodConstraint();
     $constraint->periodVolume = $object->xpath_int('periodVolume');
     $constraint->periodType = $object->xpath_str('periodType');
     return $constraint;
 }
Example #5
0
 /**
  * @param CultureFeed_SimpleXMLElement $object
  * @return CultureFeed_Uitpas_GroupPass
  */
 public static function createFromXML(CultureFeed_SimpleXMLElement $object)
 {
     $pass = new self();
     $pass->name = $object->xpath_str('name');
     $pass->availableTickets = $object->xpath_int('availableTickets');
     return $pass;
 }
Example #6
0
 public static function createFromXML(CultureFeed_SimpleXMLElement $object)
 {
     $response = new CultureFeed_Uitpas_Response();
     $response->code = $object->xpath_str('code');
     $response->message = $object->xpath_str('message');
     return $response;
 }
 /**
  * @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;
 }
Example #8
0
 public static function createFromXML(CultureFeed_SimpleXMLElement $object)
 {
     $condition = new self();
     $condition->definition = $object->xpath_str('definition');
     $condition->operator = $object->xpath_str('operator');
     $condition->value = $object->xpath_str('value');
     return $condition;
 }
 public static function createFromXML(CultureFeed_SimpleXMLElement $xml)
 {
     $response = new self();
     $response->code = $xml->xpath_str('code');
     $response->price = $xml->xpath_float('price');
     $response->id = $xml->xpath_str('id');
     $response->tariff = $xml->xpath_float('tariff');
     return $response;
 }
 /**
  * @param CultureFeed_SimpleXMLElement $xml
  * @return CultureFeed_Uitpas_Passholder_EventBuyTicket
  */
 public static function createFromXml(CultureFeed_SimpleXMLElement $xml)
 {
     $buyTicket = new self();
     $buyTicket->tariff = $xml->xpath_float('tariff');
     $buyTicket->price = $xml->xpath_float('price');
     $buyTicket->cdbid = $xml->xpath_str('cdbid');
     $buyTicket->buyConstraintReason = $xml->xpath_str('buyConstraintReason');
     return $buyTicket;
 }
Example #11
0
 public static function createFromXML(CultureFeed_SimpleXMLElement $object)
 {
     $member = new CultureFeed_Uitpas_Counter_Member();
     $object->registerXPathNamespace('rdf', 'http://www.w3.org/1999/02/22-rdf-syntax-ns');
     $object->registerXPathNamespace('foaf', 'http://xmlns.com/foaf/0.1/');
     $member->id = $object->xpath_str('rdf:id');
     $member->nick = $object->xpath_str('foaf:nick');
     return $member;
 }
 public static function createFromXML(CultureFeed_SimpleXMLElement $object)
 {
     $card_counter = new CultureFeed_Uitpas_Counter_CardCounter();
     $card_counter->status = $object->xpath_str('status');
     $card_counter->kansenstatuut = $object->xpath_bool('kansenstatuut');
     $card_counter->count = $object->xpath_int('count');
     $card_counter->cardSystem = CultureFeed_Uitpas_CardSystem::createFromXML($object->xpath('cardSystem', FALSE));
     return $card_counter;
 }
Example #13
0
 /**
  * @param CultureFeed_SimpleXMLElement $object
  *
  * @return self
  */
 public static function createFromXml(CultureFeed_SimpleXMLElement $object)
 {
     $instance = new static();
     $instance->cardSystem = CultureFeed_Uitpas_CardSystem::createFromXML($object->xpath('cardSystem', FALSE));
     $instance->uitpasNumber = $object->xpath_str('uitpasNumber');
     $instance->status = $object->xpath_str('status');
     $instance->type = $object->xpath_str('cardType');
     return $instance;
 }
 /**
  * @param CultureFeed_SimpleXMLElement $xml
  * @return CultureFeed_Uitpas_Passholder_EventCheckin
  */
 public static function createFromXml(CultureFeed_SimpleXMLElement $xml)
 {
     $eventCheckin = new self();
     $eventCheckin->checkinAllowed = $xml->xpath_bool('checkinAllowed');
     $eventCheckin->numberOfPoints = $xml->xpath_int('numberOfPoints');
     $eventCheckin->cdbid = $xml->xpath_str('cdbid');
     $eventCheckin->checkinConstraintReason = $xml->xpath_str('checkinConstraintReason');
     return $eventCheckin;
 }
 /**
  * @param CultureFeed_SimpleXMLElement $xml
  * @return CultureFeed_Uitpas_Passholder_ExecuteEventActionsResult
  */
 public static function createFromXML(CultureFeed_SimpleXMLElement $xml)
 {
     $result = new self();
     $result->passholder = CultureFeed_Uitpas_Passholder::createFromXML($xml->xpath('passHolder', false));
     foreach ($xml->xpath('actions/action') as $action) {
         $result->addActionFromXML($action);
     }
     return $result;
 }
 /**
  * @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, $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);
 }
Example #18
0
 /**
  * @param CultureFeed_SimpleXMLElement $object
  *
  * @return CultureFeed_Uitpas_CardSystem
  */
 public static function createFromXML(CultureFeed_SimpleXMLElement $object)
 {
     $card_system = new static();
     $card_system->id = $object->xpath_int('id');
     $card_system->name = $object->xpath_str('name');
     $card_system->distributionKeys = array();
     foreach ($object->xpath('distributionKeys/distributionKey') as $distributionKey) {
         $card_system->distributionKeys[] = CultureFeed_Uitpas_DistributionKey::createFromXML($distributionKey, FALSE);
     }
     return $card_system;
 }
 /**
  * Validate the request result.
  *
  * @param string $result
  *   Result from the request.
  * @param string $valid_status_code
  *   Status code if this is a valid request.
  * @param string $status_xml_tag
  *   Xml tag where the status code can be checked.
  * @return CultureFeed_SimpleXMLElement The parsed xml.
  *
  * @throws CultureFeed_ParseException
  *   If the result could not be parsed.
  * @throws CultureFeed_InvalidCodeException
  *   If no valid result status code.
  */
 protected function validateResult($result, $valid_status_code, $status_xml_tag = 'code')
 {
     try {
         $xml = new CultureFeed_SimpleXMLElement($result);
     } catch (Exception $e) {
         throw new CultureFeed_ParseException($result);
     }
     $status_code = $xml->xpath_str($status_xml_tag);
     if ($status_code == $valid_status_code) {
         return $xml;
     }
     throw new CultureFeed_InvalidCodeException($xml->xpath_str('message'), $status_code);
 }
 public static function createFromXML(CultureFeed_SimpleXMLElement $object)
 {
     $price = new CultureFeed_Uitpas_Passholder_UitpasPrice();
     $price->id = $object->xpath_str('id');
     $price->reason = $object->xpath_str('reason');
     $price->kansenStatuut = $object->xpath_bool('kansenstatuut');
     $price->price = $object->xpath_float('price');
     $price->cardType = $object->xpath_str('cardType');
     $ageRange = $object->xpath('ageRange', FALSE);
     if ($ageRange) {
         $ageFrom = $ageRange->xpath_int('ageFrom', FALSE);
         if ($ageFrom) {
             $price->ageRange->ageFrom = $ageFrom;
         }
         $ageTo = $ageRange->xpath_int('ageTo', FALSE);
         if ($ageTo) {
             $price->ageRange->ageTo = $ageTo;
         }
     }
     $voucherType = $object->xpath('voucherType', FALSE);
     if ($voucherType) {
         $price->voucherType = new CultureFeed_Uitpas_Passholder_VoucherType();
         $name = $voucherType->xpath_str('name', FALSE);
         if ($name) {
             $price->voucherType->name = $name;
         }
         $prefix = $voucherType->xpath_str('prefix', FALSE);
         if ($prefix) {
             $price->voucherType->prefix = $prefix;
         }
     }
     $price->cardSystem = CultureFeed_Uitpas_CardSystem::createFromXML($object->xpath('cardSystem', FALSE));
     return $price;
 }
Example #21
0
 public static function createFromXML(CultureFeed_SimpleXMLElement $object)
 {
     $membership = new CultureFeed_Uitpas_Passholder_Membership();
     $membership->id = $object->xpath_str('id');
     $membership->association = CultureFeed_Uitpas_Association::createFromXML($object->xpath('association', false));
     $membership->associationId = $object->xpath_str('association/id');
     $membership->name = $object->xpath_str('association/name');
     $membership->endDate = $object->xpath_time('endDate');
     $membership->renewable = $object->xpath_bool('renewable');
     $membership->newEndDate = $object->xpath_time('newEndDate');
     $membership->renewDate = $object->xpath_time('renewDate');
     $membership->expired = $object->xpath_bool('expired');
     return $membership;
 }
 /**
  * @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;
 }
Example #23
0
 /**
  * @param CultureFeed_SimpleXMLElement $object
  * @return self
  */
 public static function createFromXml(CultureFeed_SimpleXMLElement $object)
 {
     $identity = new static();
     $cardXml = $object->xpath('card', false);
     $identity->card = CultureFeed_Uitpas_Passholder_Card::createFromXml($cardXml);
     $passHolderXml = $object->xpath('passHolder', false);
     if ($passHolderXml instanceof CultureFeed_SimpleXMLElement) {
         $identity->passHolder = CultureFeed_Uitpas_Passholder::createFromXML($passHolderXml);
     }
     $groupPassXml = $object->xpath('groupPass', false);
     if ($groupPassXml instanceof CultureFeed_SimpleXMLElement) {
         $identity->groupPass = CultureFeed_Uitpas_GroupPass::createFromXml($groupPassXml);
     }
     return $identity;
 }
 /**
  * @param CultureFeed_SimpleXMLElement $object
  * @return CultureFeed_Uitpas_Passholder_CardSystemSpecific
  */
 public static function createFromXML(CultureFeed_SimpleXMLElement $object)
 {
     $cardSystemSpecific = new self();
     $cardSystemSpecific->cardSystem = CultureFeed_Uitpas_CardSystem::createFromXml($object->xpath('cardSystem', false));
     $currentCard = $object->xpath('currentCard', false);
     if ($currentCard instanceof CultureFeed_SimpleXMLElement) {
         $cardSystemSpecific->currentCard = CultureFeed_Uitpas_Passholder_Card::createFromXML($currentCard);
     }
     $cardSystemSpecific->emailPreference = $object->xpath_str('emailPreference');
     $cardSystemSpecific->smsPreference = $object->xpath_str('smsPreference');
     $cardSystemSpecific->kansenStatuut = $object->xpath_bool('kansenStatuut');
     $cardSystemSpecific->kansenStatuutExpired = $object->xpath_bool('kansenStatuutExpired');
     $cardSystemSpecific->kansenStatuutEndDate = $object->xpath_time('kansenStatuutEndDate');
     $cardSystemSpecific->kansenStatuutInGracePeriod = $object->xpath_bool('kansenStatuutInGracePeriod');
     $cardSystemSpecific->status = $object->xpath_str('status');
     return $cardSystemSpecific;
 }
Example #25
0
 /**
  * @see CultureFee_Messages::getMessageCount().
  */
 public function getMessageCount()
 {
     $result = $this->oauth_client->authenticatedGetAsXml('message/totals');
     try {
         $xmlElement = new CultureFeed_SimpleXMLElement($result);
     } catch (Exception $e) {
         throw new CultureFeed_ParseException($result);
     }
     $message_count = array();
     $total = $xmlElement->xpath('/response/total');
     if (!$total) {
         return array();
     }
     foreach ($total as $count) {
         $attributes = $count->attributes();
         $message_count[(string) $attributes['type']] = (string) $count;
     }
     return $message_count;
 }
Example #26
0
 public static function createFromXML(CultureFeed_SimpleXMLElement $object)
 {
     $object->registerXPathNamespace('cdb', CultureFeed_Cdb_Default::CDB_SCHEME_URL);
     $calendar = new CultureFeed_Uitpas_Calendar();
     foreach ($object->xpath('cdb:periods/cdb:period') as $timeObject) {
         $timeObject->registerXPathNamespace('cdb', CultureFeed_Cdb_Default::CDB_SCHEME_URL);
         $period = new CultureFeed_Uitpas_Calendar_Period();
         $period->datefrom = $timeObject->xpath_time('cdb:datefrom');
         $period->dateto = $timeObject->xpath_time('cdb:dateto');
         $calendar->addPeriod($period);
     }
     foreach ($object->xpath('cdb:timestamps/cdb:timestamp') as $timeObject) {
         $timeObject->registerXPathNamespace('cdb', CultureFeed_Cdb_Default::CDB_SCHEME_URL);
         $timestamp = new CultureFeed_Uitpas_Calendar_Timestamp();
         $timestamp->date = $timeObject->xpath_time('cdb:date');
         $timestamp->timestart = $timeObject->xpath_str('cdb:timestart');
         $timestamp->timeend = $timeObject->xpath_str('cdb:timeend');
         $calendar->addTimestamp($timestamp);
     }
     return $calendar;
 }
Example #27
0
 public static function createFromXML(CultureFeed_SimpleXMLElement $object)
 {
     $counter = new CultureFeed_Uitpas_Counter();
     $counter->id = $object->xpath_str('id');
     $counter->name = $object->xpath_str('name');
     $counter->type = $object->xpath_str('type');
     $counter->street = $object->xpath_str('street');
     $counter->number = $object->xpath_int('number');
     $counter->box = $object->xpath_str('box');
     $counter->postalCode = $object->xpath_str('postalCode');
     $counter->city = $object->xpath_str('city');
     $counter->cityPart = $object->xpath_str('cityPart');
     $counter->telephoneNumber = $object->xpath_str('telephoneNumber');
     $counter->contactPerson = $object->xpath_str('contactPerson');
     $counter->consumerKey = $object->xpath_str('consumerKey');
     foreach ($object->xpath('cardSystems/cardSystem') as $card_system) {
         $cardSystem = CultureFeed_Uitpas_CardSystem::createFromXml($card_system);
         $counter->cardSystems[$cardSystem->id] = $cardSystem;
     }
     return $counter;
 }
 /**
  * @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;
 }
Example #29
0
 public static function createFromXML(CultureFeed_SimpleXMLElement $object)
 {
     $card = new CultureFeed_Uitpas_Passholder_Card();
     $card->city = $object->xpath_str('city');
     $card->uitpasNumber = $object->xpath_str('uitpasNumber/uitpasNumber');
     $card->kansenpas = $object->xpath_bool('kansenpas');
     $card->status = $object->xpath_str('status');
     $card->type = $object->xpath_str('cardType');
     $cardSystemXml = $object->xpath('cardSystem', false);
     if ($cardSystemXml instanceof CultureFeed_SimpleXMLElement) {
         $card->cardSystem = CultureFeed_Uitpas_CardSystem::createFromXML($cardSystemXml);
     } elseif (!is_null($object->xpath_int('cardSystemId'))) {
         $card->cardSystem = new CultureFeed_Uitpas_CardSystem();
         $card->cardSystem->id = $object->xpath_int('cardSystemId');
         $card->cardSystem->name = '';
     }
     return $card;
 }
 public static function createFromXML(CultureFeed_SimpleXMLElement $object)
 {
     $distribution_key = new CultureFeed_Uitpas_DistributionKey();
     $distribution_key->id = $object->xpath_int('id');
     $distribution_key->name = $object->xpath_str('name');
     $distribution_key->conditions = array();
     foreach ($object->xpath('conditions/condition') as $condition) {
         $distribution_key->conditions[] = CultureFeed_Uitpas_DistributionKey_Condition::createFromXML($condition, FALSE);
     }
     foreach ($object->xpath('priceClasses/priceClass') as $priceClass) {
         $distribution_key->priceClasses[] = CultureFeed_Uitpas_Event_PriceClass::createFromXML($priceClass);
     }
     $distribution_key->tariff = $object->xpath_str('tariff');
     $distribution_key->automatic = $object->xpath_bool('automatic');
     $distribution_key->sameRegion = $object->xpath_bool('sameRegion');
     return $distribution_key;
 }