public static function createFromXML(CultureFeed_SimpleXMLElement $object) { // TODO: implement properly $promotion = new CultureFeed_Uitpas_Passholder_CashedInPointsPromotion(); $promotion->id = $object->xpath_int('promotion/id'); $promotion->title = $object->xpath_str('promotion/title'); $promotion->points = $object->xpath_int('promotion/points'); $promotion->cashingDate = $object->xpath_time('cashingDate'); $promotion->location = $object->xpath_str('balie/name'); $promotion->counters = array(CultureFeed_Uitpas_Passholder_Counter::createFromXML($object->balie)); return $promotion; }
public static function createFromXML(CultureFeed_SimpleXMLElement $object) { $promotion = new CultureFeed_Uitpas_Passholder_PointsPromotion(); $promotion->id = $object->xpath_int('id'); $promotion->inSpotlight = $object->xpath_bool('inSpotlight'); $promotion->title = $object->xpath_str('title'); $promotion->description1 = $object->xpath_str('description1'); $promotion->description2 = $object->xpath_str('description2'); $promotion->pictures = $object->xpath_str('pictures/picture', TRUE); if (NULL === $promotion->pictures) { $promotion->pictures = array(); } $promotion->publicationPeriodBegin = $object->xpath_time('publicationPeriodBegin'); $promotion->publicationPeriodEnd = $object->xpath_time('publicationPeriodEnd'); $promotion->points = $object->xpath_int('points'); $promotion->cashedIn = $object->xpath_bool('cashedIn'); $promotion->counters = array(); foreach ($object->xpath('balies/balie') as $counter) { $promotion->counters[] = CultureFeed_Uitpas_Passholder_Counter::createFromXML($counter); } $promotion->creationDate = $object->xpath_time('creationDate'); $promotion->cashingPeriodBegin = $object->xpath_time('cashingPeriodBegin'); $promotion->cashingPeriodEnd = $object->xpath_time('cashingPeriodEnd'); $promotion->validForCities = $object->xpath_str('validForCities/city', TRUE); if (NULL === $promotion->validForCities) { $promotion->validForCities = array(); } $promotion->maxAvailableUnits = $object->xpath_int('maxAvailableUnits'); $promotion->unitsTaken = $object->xpath_int('unitsTaken'); $promotion->cashInState = $object->xpath_str('cashInState'); $periodConstraint = $object->xpath('periodConstraint', FALSE); if (!empty($periodConstraint)) { $promotion->periodConstraint = CultureFeed_Uitpas_Passholder_PeriodConstraint::createFromXml($periodConstraint); } $owningCardSystem = $object->xpath('owningCardSystem', FALSE); if ($owningCardSystem instanceof CultureFeed_SimpleXMLElement) { $promotion->owningCardSystem = CultureFeed_Uitpas_CardSystem::createFromXml($owningCardSystem); } $applicableCardSystems = $object->xpath('applicableCardSystems/cardsystem'); foreach ($applicableCardSystems as $applicableCardSystem) { $promotion->applicableCardSystems[] = CultureFeed_Uitpas_CardSystem::createFromXml($applicableCardSystem); } return $promotion; }
public static function createFromXML(CultureFeed_SimpleXMLElement $object) { $welcome_advantage = new CultureFeed_Uitpas_Passholder_WelcomeAdvantage(); $welcome_advantage->id = $object->xpath_int('id'); $welcome_advantage->title = $object->xpath_str('title'); $welcome_advantage->description1 = $object->xpath_str('description1'); $welcome_advantage->description2 = $object->xpath_str('description2'); $welcome_advantage->pictures = $object->xpath_str('pictures/picture', TRUE); if (NULL === $welcome_advantage->pictures) { $welcome_advantage->pictures = array(); } $welcome_advantage->publicationPeriodBegin = $object->xpath_time('publicationPeriodBegin'); $welcome_advantage->publicationPeriodEnd = $object->xpath_time('publicationPeriodEnd'); $welcome_advantage->points = $object->xpath_int('points'); $welcome_advantage->cashedIn = $object->xpath_bool('cashedIn'); $welcome_advantage->cashingDate = $object->xpath_time('cashingDate'); foreach ($object->xpath('balies/balie') as $counter) { $welcome_advantage->counters[] = CultureFeed_Uitpas_Passholder_Counter::createFromXML($counter); } $welcome_advantage->creationDate = $object->xpath_time('creationDate'); $welcome_advantage->cashingPeriodBegin = $object->xpath_time('cashingPeriodBegin'); $welcome_advantage->cashingPeriodEnd = $object->xpath_time('cashingPeriodEnd'); $welcome_advantage->grantingPeriodBegin = $object->xpath_time('grantingPeriodBegin'); $welcome_advantage->grantingPeriodEnd = $object->xpath_time('grantingPeriodEnd'); $welcome_advantage->cashingPeriodBegin = $object->xpath_time('cashingPeriodBegin'); $welcome_advantage->validForCities = $object->xpath_str('validForCities/city', true); if (NULL === $welcome_advantage->validForCities) { $welcome_advantage->validForCities = array(); } $welcome_advantage->maxAvailableUnits = $object->xpath_int('maxAvailableUnits'); $welcome_advantage->unitsTaken = $object->xpath_int('unitsTaken'); $owningCardSystem = $object->xpath('owningCardSystem', FALSE); if ($owningCardSystem instanceof CultureFeed_SimpleXMLElement) { $welcome_advantage->owningCardSystem = CultureFeed_Uitpas_CardSystem::createFromXml($owningCardSystem); } $applicableCardSystems = $object->xpath('applicableCardSystems/cardsystem'); foreach ($applicableCardSystems as $applicableCardSystem) { $welcome_advantage->applicableCardSystems[] = CultureFeed_Uitpas_CardSystem::createFromXml($applicableCardSystem); } return $welcome_advantage; }