/** * * @param SimpleXMLElement $elt * @return FzRule */ public static function fromXml(SimpleXMLElement $elt) { $fzRule = new FzRule(); $fzRule->setSpeed((int) $elt['Speed']); $fzRule->setDays((int) $elt->Days); //Date if (count($elt->Date)) { $date = array(); $date['Year'] = (string) $elt->Date['Year']; $date['Month'] = (string) $elt->Date['Month']; $date['Day'] = (string) $elt->Date['Day']; $fzRule->setDate($date); } //From if (count($elt->From)) { $from = array(); $from['Hour'] = (string) $elt->From['Hour']; $from['Minute'] = (string) $elt->From['Minute']; $from['Second'] = (string) $elt->From['Second']; $fzRule->setFrom($from); } //To if (count($elt->To)) { $to = array(); $to['Hour'] = (string) $elt->To['Hour']; $to['Minute'] = (string) $elt->To['Minute']; $to['Second'] = (string) $elt->To['Second']; $fzRule->setTo($to); } return $fzRule; }