next(); * * $reader->parseInnerTree() will parse the entire sub-tree, and advance to * the next element. * * @param Reader $reader * @return mixed */ static function xmlDeserialize(Reader $reader) { $timeRange = '{' . Plugin::NS_CALDAV . '}time-range'; $start = null; $end = null; foreach ((array)$reader->parseInnerTree([]) as $elem) { if ($elem['name'] !== $timeRange) continue; $start = empty($elem['attributes']['start']) ?: $elem['attributes']['start']; $end = empty($elem['attributes']['end']) ?: $elem['attributes']['end']; } if (!$start && !$end) { throw new BadRequest('The freebusy report must have a time-range element'); } if ($start) { $start = DateTimeParser::parseDateTime($start); } if ($end) { $end = DateTimeParser::parseDateTime($end); } $result = new self(); $result->start = $start; $result->end = $end; return $result; } }