예제 #1
0
파일: Permanent.php 프로젝트: RustiSub/Cdb
 /**
  * @see CultureFeed_Cdb_IElement::parseFromCdbXml(SimpleXMLElement $xmlElement)
  * @return CultureFeed_Cdb_Data_Calendar_Permanent
  */
 public static function parseFromCdbXml(SimpleXMLElement $xmlElement)
 {
     if (!isset($xmlElement->permanentopeningtimes->permanent)) {
         throw new CultureFeed_Cdb_ParseException("Permanent data is missing for permanent opening times");
     }
     $permanentXml = $xmlElement->permanentopeningtimes->permanent;
     $calendar = new CultureFeed_Cdb_Data_Calendar_Permanent();
     if (!empty($permanentXml->weekscheme)) {
         $calendar->setWeekScheme(CultureFeed_Cdb_Data_Calendar_Weekscheme::parseFromCdbXml($permanentXml->weekscheme));
     }
     if (!empty($permanentXml->exceptions)) {
         $calendar->setExceptions(CultureFeed_Cdb_Data_Calendar_Exceptions::parseFromCdbXml($permanentXml->exceptions));
     }
     return $calendar;
 }