/** * @param \SimpleXMLElement $xml * @return Day */ public static function createFromXML(\SimpleXMLElement $xml) { $day = new Day(); $day->setDay($xml->getName()); if (isset($xml->AMOpen) && $xml->AMOpen != '') { $day->setAmOpen((string) $xml->AMOpen); } if (isset($xml->AMClose) && $xml->AMClose != '') { $day->setAmClose((string) $xml->AMClose); } if (isset($xml->PMOpen) && $xml->PMOpen != '') { $day->setPmOpen((string) $xml->PMOpen); } if (isset($xml->PMClose) && $xml->PMClose != '') { $day->setPmClose((string) $xml->PMClose); } return $day; }