href = $href; $this->calendarUri = $calendarUri; $this->inReplyTo = $inReplyTo; $this->summary = $summary; $this->status = $status; } /** * The deserialize method is called during xml parsing. * * This method is called statically, this is because in theory this method * may be used as a type of constructor, or factory method. * * Often you want to return an instance of the current class, but you are * free to return other data as well. * * You are responsible for advancing the reader to the next element. Not * doing anything will result in a never-ending loop. * * If you just want to skip parsing for this element altogether, you can * just call $reader->next(); * * $reader->parseInnerTree() will parse the entire sub-tree, and advance to * the next element. * * @return mixed */ public static function xmlDeserialize(Reader $reader) { $elems = KeyValue::xmlDeserialize($reader); $href = null; $calendarUri = null; $inReplyTo = null; $summary = null; $status = null; foreach ($elems as $name => $value) { switch ($name) { case '{'.Plugin::NS_CALENDARSERVER.'}hosturl': foreach ($value as $bla) { if ('{DAV:}href' === $bla['name']) { $calendarUri = $bla['value']; } } break; case '{'.Plugin::NS_CALENDARSERVER.'}invite-accepted': $status = DAV\Sharing\Plugin::INVITE_ACCEPTED; break; case '{'.Plugin::NS_CALENDARSERVER.'}invite-declined': $status = DAV\Sharing\Plugin::INVITE_DECLINED; break; case '{'.Plugin::NS_CALENDARSERVER.'}in-reply-to': $inReplyTo = $value; break; case '{'.Plugin::NS_CALENDARSERVER.'}summary': $summary = $value; break; case '{DAV:}href': $href = $value; break; } } if (is_null($calendarUri)) { throw new BadRequest('The {http://calendarserver.org/ns/}hosturl/{DAV:}href element must exist'); } return new self($href, $calendarUri, $inReplyTo, $summary, $status); } }