/** * The deserialize method is called during xml parsing. * * This method is called statictly, 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. * * @param Reader $reader * @return mixed */ static function xmlDeserialize(Reader $reader) { $reader->pushContext(); $reader->elementMap['{DAV:}prop'] = 'Sabre\\Xml\\Deserializer\\enum'; $elems = Deserializer\keyValue($reader, 'DAV:'); $reader->popContext(); $report = new self(); if (!empty($elems['prop'])) { $report->properties = $elems['prop']; } return $report; }
/** * The deserialize method is called during xml parsing. * * This method is called statictly, 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. * * @param Reader $reader * @return mixed */ static function xmlDeserialize(Reader $reader) { $reader->pushContext(); $reader->elementMap['{DAV:}prop'] = 'Sabre\\Xml\\Deserializer\\enum'; $elems = Deserializer\keyValue($reader, 'DAV:'); $reader->popContext(); $principalMatch = new self(); if (array_key_exists('self', $elems)) { $principalMatch->type = self::SELF; } if (array_key_exists('principal-property', $elems)) { $principalMatch->type = self::PRINCIPAL_PROPERTY; $principalMatch->principalProperty = $elems['principal-property'][0]['name']; } if (!empty($elems['prop'])) { $principalMatch->properties = $elems['prop']; } return $principalMatch; }
/** * The deserialize method is called during xml parsing. * * This method is called statictly, 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. * * @param Reader $reader * @return mixed */ static function xmlDeserialize(Reader $reader) { // Temporarily override configuration $reader->pushContext(); $reader->elementMap['{DAV:}share-access'] = 'Sabre\\DAV\\Xml\\Property\\ShareAccess'; $reader->elementMap['{DAV:}prop'] = 'Sabre\\Xml\\Deserializer\\keyValue'; $elems = Deserializer\keyValue($reader, 'DAV:'); // Restore previous configuration $reader->popContext(); $sharee = new self(); if (!isset($elems['href'])) { throw new BadRequest('Every {DAV:}sharee must have a {DAV:}href child-element'); } $sharee->href = $elems['href']; if (isset($elems['prop'])) { $sharee->properties = $elems['prop']; } if (isset($elems['comment'])) { $sharee->comment = $elems['comment']; } if (!isset($elems['share-access'])) { throw new BadRequest('Every {DAV:}sharee must have a {DAV:}share-access child element'); } $sharee->access = $elems['share-access']->getValue(); return $sharee; }
/** * The deserialize method is called during xml parsing. * * This method is called staticly, 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. * * Important note 2: 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. * * @param Xml\Reader $reader * @return mixed */ static function xmlDeserialize(Xml\Reader $reader) { return Deserializer\keyValue($reader); }