public function writeRule(SimpleXMLElement $dl, FzRule $rule) { $r = $dl->addChild('Rule'); $r->addAttribute('Speed', $rule->getSpeed()); $r->addChild('Days', $rule->getDays()); if ($rule->getDate()) { $date = $rule->getDate(); $dateElt = $r->addChild('Date'); $dateElt->addAttribute('Year', $date['Year']); $dateElt->addAttribute('Month', $date['Month']); $dateElt->addAttribute('Day', $date['Day']); } if (count($rule->getFrom()) > 0) { $from = $rule->getFrom(); $fromElt = $r->addChild('From'); $fromElt->addAttribute('Year', $from['Hour']); $fromElt->addAttribute('Month', $from['Minute']); $fromElt->addAttribute('Day', $from['Second']); } if (count($rule->getTo()) > 0) { $to = $rule->getTo(); $toElt = $r->addChild('To'); $toElt->addAttribute('Year', $to['Hour']); $toElt->addAttribute('Month', $to['Minute']); $toElt->addAttribute('Day', $to['Second']); } }