@@ -21,90 +21,90 @@ |
||
21 | 21 | */ |
22 | 22 | class Prop implements XmlDeserializable |
23 | 23 | { |
24 | - /** |
|
25 | - * The deserialize method is called during xml parsing. |
|
26 | - * |
|
27 | - * This method is called statically, this is because in theory this method |
|
28 | - * may be used as a type of constructor, or factory method. |
|
29 | - * |
|
30 | - * Often you want to return an instance of the current class, but you are |
|
31 | - * free to return other data as well. |
|
32 | - * |
|
33 | - * You are responsible for advancing the reader to the next element. Not |
|
34 | - * doing anything will result in a never-ending loop. |
|
35 | - * |
|
36 | - * If you just want to skip parsing for this element altogether, you can |
|
37 | - * just call $reader->next(); |
|
38 | - * |
|
39 | - * $reader->parseInnerTree() will parse the entire sub-tree, and advance to |
|
40 | - * the next element. |
|
41 | - * |
|
42 | - * @return mixed |
|
43 | - */ |
|
44 | - public static function xmlDeserialize(Reader $reader) |
|
45 | - { |
|
46 | - // If there's no children, we don't do anything. |
|
47 | - if ($reader->isEmptyElement) { |
|
48 | - $reader->next(); |
|
24 | + /** |
|
25 | + * The deserialize method is called during xml parsing. |
|
26 | + * |
|
27 | + * This method is called statically, this is because in theory this method |
|
28 | + * may be used as a type of constructor, or factory method. |
|
29 | + * |
|
30 | + * Often you want to return an instance of the current class, but you are |
|
31 | + * free to return other data as well. |
|
32 | + * |
|
33 | + * You are responsible for advancing the reader to the next element. Not |
|
34 | + * doing anything will result in a never-ending loop. |
|
35 | + * |
|
36 | + * If you just want to skip parsing for this element altogether, you can |
|
37 | + * just call $reader->next(); |
|
38 | + * |
|
39 | + * $reader->parseInnerTree() will parse the entire sub-tree, and advance to |
|
40 | + * the next element. |
|
41 | + * |
|
42 | + * @return mixed |
|
43 | + */ |
|
44 | + public static function xmlDeserialize(Reader $reader) |
|
45 | + { |
|
46 | + // If there's no children, we don't do anything. |
|
47 | + if ($reader->isEmptyElement) { |
|
48 | + $reader->next(); |
|
49 | 49 | |
50 | - return []; |
|
51 | - } |
|
50 | + return []; |
|
51 | + } |
|
52 | 52 | |
53 | - $values = []; |
|
53 | + $values = []; |
|
54 | 54 | |
55 | - $reader->read(); |
|
56 | - do { |
|
57 | - if (Reader::ELEMENT === $reader->nodeType) { |
|
58 | - $clark = $reader->getClark(); |
|
59 | - $values[$clark] = self::parseCurrentElement($reader)['value']; |
|
60 | - } else { |
|
61 | - $reader->read(); |
|
62 | - } |
|
63 | - } while (Reader::END_ELEMENT !== $reader->nodeType); |
|
55 | + $reader->read(); |
|
56 | + do { |
|
57 | + if (Reader::ELEMENT === $reader->nodeType) { |
|
58 | + $clark = $reader->getClark(); |
|
59 | + $values[$clark] = self::parseCurrentElement($reader)['value']; |
|
60 | + } else { |
|
61 | + $reader->read(); |
|
62 | + } |
|
63 | + } while (Reader::END_ELEMENT !== $reader->nodeType); |
|
64 | 64 | |
65 | - $reader->read(); |
|
65 | + $reader->read(); |
|
66 | 66 | |
67 | - return $values; |
|
68 | - } |
|
67 | + return $values; |
|
68 | + } |
|
69 | 69 | |
70 | - /** |
|
71 | - * This function behaves similar to Sabre\Xml\Reader::parseCurrentElement, |
|
72 | - * but instead of creating deep xml array structures, it will turn any |
|
73 | - * top-level element it doesn't recognize into either a string, or an |
|
74 | - * XmlFragment class. |
|
75 | - * |
|
76 | - * This method returns arn array with 2 properties: |
|
77 | - * * name - A clark-notation XML element name. |
|
78 | - * * value - The parsed value. |
|
79 | - * |
|
80 | - * @return array |
|
81 | - */ |
|
82 | - private static function parseCurrentElement(Reader $reader) |
|
83 | - { |
|
84 | - $name = $reader->getClark(); |
|
70 | + /** |
|
71 | + * This function behaves similar to Sabre\Xml\Reader::parseCurrentElement, |
|
72 | + * but instead of creating deep xml array structures, it will turn any |
|
73 | + * top-level element it doesn't recognize into either a string, or an |
|
74 | + * XmlFragment class. |
|
75 | + * |
|
76 | + * This method returns arn array with 2 properties: |
|
77 | + * * name - A clark-notation XML element name. |
|
78 | + * * value - The parsed value. |
|
79 | + * |
|
80 | + * @return array |
|
81 | + */ |
|
82 | + private static function parseCurrentElement(Reader $reader) |
|
83 | + { |
|
84 | + $name = $reader->getClark(); |
|
85 | 85 | |
86 | - if (array_key_exists($name, $reader->elementMap)) { |
|
87 | - $deserializer = $reader->elementMap[$name]; |
|
88 | - if (is_subclass_of($deserializer, 'Sabre\\Xml\\XmlDeserializable')) { |
|
89 | - $value = call_user_func([$deserializer, 'xmlDeserialize'], $reader); |
|
90 | - } elseif (is_callable($deserializer)) { |
|
91 | - $value = call_user_func($deserializer, $reader); |
|
92 | - } else { |
|
93 | - $type = gettype($deserializer); |
|
94 | - if ('string' === $type) { |
|
95 | - $type .= ' ('.$deserializer.')'; |
|
96 | - } elseif ('object' === $type) { |
|
97 | - $type .= ' ('.get_class($deserializer).')'; |
|
98 | - } |
|
99 | - throw new \LogicException('Could not use this type as a deserializer: '.$type); |
|
100 | - } |
|
101 | - } else { |
|
102 | - $value = Complex::xmlDeserialize($reader); |
|
103 | - } |
|
86 | + if (array_key_exists($name, $reader->elementMap)) { |
|
87 | + $deserializer = $reader->elementMap[$name]; |
|
88 | + if (is_subclass_of($deserializer, 'Sabre\\Xml\\XmlDeserializable')) { |
|
89 | + $value = call_user_func([$deserializer, 'xmlDeserialize'], $reader); |
|
90 | + } elseif (is_callable($deserializer)) { |
|
91 | + $value = call_user_func($deserializer, $reader); |
|
92 | + } else { |
|
93 | + $type = gettype($deserializer); |
|
94 | + if ('string' === $type) { |
|
95 | + $type .= ' ('.$deserializer.')'; |
|
96 | + } elseif ('object' === $type) { |
|
97 | + $type .= ' ('.get_class($deserializer).')'; |
|
98 | + } |
|
99 | + throw new \LogicException('Could not use this type as a deserializer: '.$type); |
|
100 | + } |
|
101 | + } else { |
|
102 | + $value = Complex::xmlDeserialize($reader); |
|
103 | + } |
|
104 | 104 | |
105 | - return [ |
|
106 | - 'name' => $name, |
|
107 | - 'value' => $value, |
|
108 | - ]; |
|
109 | - } |
|
105 | + return [ |
|
106 | + 'name' => $name, |
|
107 | + 'value' => $value, |
|
108 | + ]; |
|
109 | + } |
|
110 | 110 | } |
@@ -22,63 +22,63 @@ |
||
22 | 22 | */ |
23 | 23 | class Lock implements XmlDeserializable |
24 | 24 | { |
25 | - /** |
|
26 | - * Owner of the lock. |
|
27 | - * |
|
28 | - * @var string |
|
29 | - */ |
|
30 | - public $owner; |
|
25 | + /** |
|
26 | + * Owner of the lock. |
|
27 | + * |
|
28 | + * @var string |
|
29 | + */ |
|
30 | + public $owner; |
|
31 | 31 | |
32 | - /** |
|
33 | - * Scope of the lock. |
|
34 | - * |
|
35 | - * Either LockInfo::SHARED or LockInfo::EXCLUSIVE |
|
36 | - * |
|
37 | - * @var int |
|
38 | - */ |
|
39 | - public $scope; |
|
32 | + /** |
|
33 | + * Scope of the lock. |
|
34 | + * |
|
35 | + * Either LockInfo::SHARED or LockInfo::EXCLUSIVE |
|
36 | + * |
|
37 | + * @var int |
|
38 | + */ |
|
39 | + public $scope; |
|
40 | 40 | |
41 | - /** |
|
42 | - * The deserialize method is called during xml parsing. |
|
43 | - * |
|
44 | - * This method is called statically, this is because in theory this method |
|
45 | - * may be used as a type of constructor, or factory method. |
|
46 | - * |
|
47 | - * Often you want to return an instance of the current class, but you are |
|
48 | - * free to return other data as well. |
|
49 | - * |
|
50 | - * You are responsible for advancing the reader to the next element. Not |
|
51 | - * doing anything will result in a never-ending loop. |
|
52 | - * |
|
53 | - * If you just want to skip parsing for this element altogether, you can |
|
54 | - * just call $reader->next(); |
|
55 | - * |
|
56 | - * $reader->parseInnerTree() will parse the entire sub-tree, and advance to |
|
57 | - * the next element. |
|
58 | - * |
|
59 | - * @return mixed |
|
60 | - */ |
|
61 | - public static function xmlDeserialize(Reader $reader) |
|
62 | - { |
|
63 | - $reader->pushContext(); |
|
64 | - $reader->elementMap['{DAV:}owner'] = 'Sabre\\Xml\\Element\\XmlFragment'; |
|
41 | + /** |
|
42 | + * The deserialize method is called during xml parsing. |
|
43 | + * |
|
44 | + * This method is called statically, this is because in theory this method |
|
45 | + * may be used as a type of constructor, or factory method. |
|
46 | + * |
|
47 | + * Often you want to return an instance of the current class, but you are |
|
48 | + * free to return other data as well. |
|
49 | + * |
|
50 | + * You are responsible for advancing the reader to the next element. Not |
|
51 | + * doing anything will result in a never-ending loop. |
|
52 | + * |
|
53 | + * If you just want to skip parsing for this element altogether, you can |
|
54 | + * just call $reader->next(); |
|
55 | + * |
|
56 | + * $reader->parseInnerTree() will parse the entire sub-tree, and advance to |
|
57 | + * the next element. |
|
58 | + * |
|
59 | + * @return mixed |
|
60 | + */ |
|
61 | + public static function xmlDeserialize(Reader $reader) |
|
62 | + { |
|
63 | + $reader->pushContext(); |
|
64 | + $reader->elementMap['{DAV:}owner'] = 'Sabre\\Xml\\Element\\XmlFragment'; |
|
65 | 65 | |
66 | - $values = KeyValue::xmlDeserialize($reader); |
|
66 | + $values = KeyValue::xmlDeserialize($reader); |
|
67 | 67 | |
68 | - $reader->popContext(); |
|
68 | + $reader->popContext(); |
|
69 | 69 | |
70 | - $new = new self(); |
|
71 | - $new->owner = !empty($values['{DAV:}owner']) ? $values['{DAV:}owner']->getXml() : null; |
|
72 | - $new->scope = LockInfo::SHARED; |
|
70 | + $new = new self(); |
|
71 | + $new->owner = !empty($values['{DAV:}owner']) ? $values['{DAV:}owner']->getXml() : null; |
|
72 | + $new->scope = LockInfo::SHARED; |
|
73 | 73 | |
74 | - if (isset($values['{DAV:}lockscope'])) { |
|
75 | - foreach ($values['{DAV:}lockscope'] as $elem) { |
|
76 | - if ('{DAV:}exclusive' === $elem['name']) { |
|
77 | - $new->scope = LockInfo::EXCLUSIVE; |
|
78 | - } |
|
79 | - } |
|
80 | - } |
|
74 | + if (isset($values['{DAV:}lockscope'])) { |
|
75 | + foreach ($values['{DAV:}lockscope'] as $elem) { |
|
76 | + if ('{DAV:}exclusive' === $elem['name']) { |
|
77 | + $new->scope = LockInfo::EXCLUSIVE; |
|
78 | + } |
|
79 | + } |
|
80 | + } |
|
81 | 81 | |
82 | - return $new; |
|
83 | - } |
|
82 | + return $new; |
|
83 | + } |
|
84 | 84 | } |
@@ -21,89 +21,89 @@ |
||
21 | 21 | */ |
22 | 22 | class PropPatch implements Element |
23 | 23 | { |
24 | - /** |
|
25 | - * The list of properties that will be updated and removed. |
|
26 | - * |
|
27 | - * If a property will be removed, it's value will be set to null. |
|
28 | - * |
|
29 | - * @var array |
|
30 | - */ |
|
31 | - public $properties = []; |
|
24 | + /** |
|
25 | + * The list of properties that will be updated and removed. |
|
26 | + * |
|
27 | + * If a property will be removed, it's value will be set to null. |
|
28 | + * |
|
29 | + * @var array |
|
30 | + */ |
|
31 | + public $properties = []; |
|
32 | 32 | |
33 | - /** |
|
34 | - * The xmlSerialize method is called during xml writing. |
|
35 | - * |
|
36 | - * Use the $writer argument to write its own xml serialization. |
|
37 | - * |
|
38 | - * An important note: do _not_ create a parent element. Any element |
|
39 | - * implementing XmlSerializable should only ever write what's considered |
|
40 | - * its 'inner xml'. |
|
41 | - * |
|
42 | - * The parent of the current element is responsible for writing a |
|
43 | - * containing element. |
|
44 | - * |
|
45 | - * This allows serializers to be re-used for different element names. |
|
46 | - * |
|
47 | - * If you are opening new elements, you must also close them again. |
|
48 | - */ |
|
49 | - public function xmlSerialize(Writer $writer) |
|
50 | - { |
|
51 | - foreach ($this->properties as $propertyName => $propertyValue) { |
|
52 | - if (is_null($propertyValue)) { |
|
53 | - $writer->startElement('{DAV:}remove'); |
|
54 | - $writer->write(['{DAV:}prop' => [$propertyName => $propertyValue]]); |
|
55 | - $writer->endElement(); |
|
56 | - } else { |
|
57 | - $writer->startElement('{DAV:}set'); |
|
58 | - $writer->write(['{DAV:}prop' => [$propertyName => $propertyValue]]); |
|
59 | - $writer->endElement(); |
|
60 | - } |
|
61 | - } |
|
62 | - } |
|
33 | + /** |
|
34 | + * The xmlSerialize method is called during xml writing. |
|
35 | + * |
|
36 | + * Use the $writer argument to write its own xml serialization. |
|
37 | + * |
|
38 | + * An important note: do _not_ create a parent element. Any element |
|
39 | + * implementing XmlSerializable should only ever write what's considered |
|
40 | + * its 'inner xml'. |
|
41 | + * |
|
42 | + * The parent of the current element is responsible for writing a |
|
43 | + * containing element. |
|
44 | + * |
|
45 | + * This allows serializers to be re-used for different element names. |
|
46 | + * |
|
47 | + * If you are opening new elements, you must also close them again. |
|
48 | + */ |
|
49 | + public function xmlSerialize(Writer $writer) |
|
50 | + { |
|
51 | + foreach ($this->properties as $propertyName => $propertyValue) { |
|
52 | + if (is_null($propertyValue)) { |
|
53 | + $writer->startElement('{DAV:}remove'); |
|
54 | + $writer->write(['{DAV:}prop' => [$propertyName => $propertyValue]]); |
|
55 | + $writer->endElement(); |
|
56 | + } else { |
|
57 | + $writer->startElement('{DAV:}set'); |
|
58 | + $writer->write(['{DAV:}prop' => [$propertyName => $propertyValue]]); |
|
59 | + $writer->endElement(); |
|
60 | + } |
|
61 | + } |
|
62 | + } |
|
63 | 63 | |
64 | - /** |
|
65 | - * The deserialize method is called during xml parsing. |
|
66 | - * |
|
67 | - * This method is called statically, this is because in theory this method |
|
68 | - * may be used as a type of constructor, or factory method. |
|
69 | - * |
|
70 | - * Often you want to return an instance of the current class, but you are |
|
71 | - * free to return other data as well. |
|
72 | - * |
|
73 | - * You are responsible for advancing the reader to the next element. Not |
|
74 | - * doing anything will result in a never-ending loop. |
|
75 | - * |
|
76 | - * If you just want to skip parsing for this element altogether, you can |
|
77 | - * just call $reader->next(); |
|
78 | - * |
|
79 | - * $reader->parseInnerTree() will parse the entire sub-tree, and advance to |
|
80 | - * the next element. |
|
81 | - * |
|
82 | - * @return mixed |
|
83 | - */ |
|
84 | - public static function xmlDeserialize(Reader $reader) |
|
85 | - { |
|
86 | - $self = new self(); |
|
64 | + /** |
|
65 | + * The deserialize method is called during xml parsing. |
|
66 | + * |
|
67 | + * This method is called statically, this is because in theory this method |
|
68 | + * may be used as a type of constructor, or factory method. |
|
69 | + * |
|
70 | + * Often you want to return an instance of the current class, but you are |
|
71 | + * free to return other data as well. |
|
72 | + * |
|
73 | + * You are responsible for advancing the reader to the next element. Not |
|
74 | + * doing anything will result in a never-ending loop. |
|
75 | + * |
|
76 | + * If you just want to skip parsing for this element altogether, you can |
|
77 | + * just call $reader->next(); |
|
78 | + * |
|
79 | + * $reader->parseInnerTree() will parse the entire sub-tree, and advance to |
|
80 | + * the next element. |
|
81 | + * |
|
82 | + * @return mixed |
|
83 | + */ |
|
84 | + public static function xmlDeserialize(Reader $reader) |
|
85 | + { |
|
86 | + $self = new self(); |
|
87 | 87 | |
88 | - $elementMap = $reader->elementMap; |
|
89 | - $elementMap['{DAV:}prop'] = 'Sabre\DAV\Xml\Element\Prop'; |
|
90 | - $elementMap['{DAV:}set'] = 'Sabre\Xml\Element\KeyValue'; |
|
91 | - $elementMap['{DAV:}remove'] = 'Sabre\Xml\Element\KeyValue'; |
|
88 | + $elementMap = $reader->elementMap; |
|
89 | + $elementMap['{DAV:}prop'] = 'Sabre\DAV\Xml\Element\Prop'; |
|
90 | + $elementMap['{DAV:}set'] = 'Sabre\Xml\Element\KeyValue'; |
|
91 | + $elementMap['{DAV:}remove'] = 'Sabre\Xml\Element\KeyValue'; |
|
92 | 92 | |
93 | - $elems = $reader->parseInnerTree($elementMap); |
|
93 | + $elems = $reader->parseInnerTree($elementMap); |
|
94 | 94 | |
95 | - foreach ($elems as $elem) { |
|
96 | - if ('{DAV:}set' === $elem['name']) { |
|
97 | - $self->properties = array_merge($self->properties, $elem['value']['{DAV:}prop']); |
|
98 | - } |
|
99 | - if ('{DAV:}remove' === $elem['name']) { |
|
100 | - // Ensuring there are no values. |
|
101 | - foreach ($elem['value']['{DAV:}prop'] as $remove => $value) { |
|
102 | - $self->properties[$remove] = null; |
|
103 | - } |
|
104 | - } |
|
105 | - } |
|
95 | + foreach ($elems as $elem) { |
|
96 | + if ('{DAV:}set' === $elem['name']) { |
|
97 | + $self->properties = array_merge($self->properties, $elem['value']['{DAV:}prop']); |
|
98 | + } |
|
99 | + if ('{DAV:}remove' === $elem['name']) { |
|
100 | + // Ensuring there are no values. |
|
101 | + foreach ($elem['value']['{DAV:}prop'] as $remove => $value) { |
|
102 | + $self->properties[$remove] = null; |
|
103 | + } |
|
104 | + } |
|
105 | + } |
|
106 | 106 | |
107 | - return $self; |
|
108 | - } |
|
107 | + return $self; |
|
108 | + } |
|
109 | 109 | } |
@@ -20,61 +20,61 @@ |
||
20 | 20 | */ |
21 | 21 | class MkCol implements XmlDeserializable |
22 | 22 | { |
23 | - /** |
|
24 | - * The list of properties that will be set. |
|
25 | - * |
|
26 | - * @var array |
|
27 | - */ |
|
28 | - protected $properties = []; |
|
23 | + /** |
|
24 | + * The list of properties that will be set. |
|
25 | + * |
|
26 | + * @var array |
|
27 | + */ |
|
28 | + protected $properties = []; |
|
29 | 29 | |
30 | - /** |
|
31 | - * Returns a key=>value array with properties that are supposed to get set |
|
32 | - * during creation of the new collection. |
|
33 | - * |
|
34 | - * @return array |
|
35 | - */ |
|
36 | - public function getProperties() |
|
37 | - { |
|
38 | - return $this->properties; |
|
39 | - } |
|
30 | + /** |
|
31 | + * Returns a key=>value array with properties that are supposed to get set |
|
32 | + * during creation of the new collection. |
|
33 | + * |
|
34 | + * @return array |
|
35 | + */ |
|
36 | + public function getProperties() |
|
37 | + { |
|
38 | + return $this->properties; |
|
39 | + } |
|
40 | 40 | |
41 | - /** |
|
42 | - * The deserialize method is called during xml parsing. |
|
43 | - * |
|
44 | - * This method is called statically, this is because in theory this method |
|
45 | - * may be used as a type of constructor, or factory method. |
|
46 | - * |
|
47 | - * Often you want to return an instance of the current class, but you are |
|
48 | - * free to return other data as well. |
|
49 | - * |
|
50 | - * You are responsible for advancing the reader to the next element. Not |
|
51 | - * doing anything will result in a never-ending loop. |
|
52 | - * |
|
53 | - * If you just want to skip parsing for this element altogether, you can |
|
54 | - * just call $reader->next(); |
|
55 | - * |
|
56 | - * $reader->parseInnerTree() will parse the entire sub-tree, and advance to |
|
57 | - * the next element. |
|
58 | - * |
|
59 | - * @return mixed |
|
60 | - */ |
|
61 | - public static function xmlDeserialize(Reader $reader) |
|
62 | - { |
|
63 | - $self = new self(); |
|
41 | + /** |
|
42 | + * The deserialize method is called during xml parsing. |
|
43 | + * |
|
44 | + * This method is called statically, this is because in theory this method |
|
45 | + * may be used as a type of constructor, or factory method. |
|
46 | + * |
|
47 | + * Often you want to return an instance of the current class, but you are |
|
48 | + * free to return other data as well. |
|
49 | + * |
|
50 | + * You are responsible for advancing the reader to the next element. Not |
|
51 | + * doing anything will result in a never-ending loop. |
|
52 | + * |
|
53 | + * If you just want to skip parsing for this element altogether, you can |
|
54 | + * just call $reader->next(); |
|
55 | + * |
|
56 | + * $reader->parseInnerTree() will parse the entire sub-tree, and advance to |
|
57 | + * the next element. |
|
58 | + * |
|
59 | + * @return mixed |
|
60 | + */ |
|
61 | + public static function xmlDeserialize(Reader $reader) |
|
62 | + { |
|
63 | + $self = new self(); |
|
64 | 64 | |
65 | - $elementMap = $reader->elementMap; |
|
66 | - $elementMap['{DAV:}prop'] = 'Sabre\DAV\Xml\Element\Prop'; |
|
67 | - $elementMap['{DAV:}set'] = 'Sabre\Xml\Element\KeyValue'; |
|
68 | - $elementMap['{DAV:}remove'] = 'Sabre\Xml\Element\KeyValue'; |
|
65 | + $elementMap = $reader->elementMap; |
|
66 | + $elementMap['{DAV:}prop'] = 'Sabre\DAV\Xml\Element\Prop'; |
|
67 | + $elementMap['{DAV:}set'] = 'Sabre\Xml\Element\KeyValue'; |
|
68 | + $elementMap['{DAV:}remove'] = 'Sabre\Xml\Element\KeyValue'; |
|
69 | 69 | |
70 | - $elems = $reader->parseInnerTree($elementMap); |
|
70 | + $elems = $reader->parseInnerTree($elementMap); |
|
71 | 71 | |
72 | - foreach ($elems as $elem) { |
|
73 | - if ('{DAV:}set' === $elem['name']) { |
|
74 | - $self->properties = array_merge($self->properties, $elem['value']['{DAV:}prop']); |
|
75 | - } |
|
76 | - } |
|
72 | + foreach ($elems as $elem) { |
|
73 | + if ('{DAV:}set' === $elem['name']) { |
|
74 | + $self->properties = array_merge($self->properties, $elem['value']['{DAV:}prop']); |
|
75 | + } |
|
76 | + } |
|
77 | 77 | |
78 | - return $self; |
|
79 | - } |
|
78 | + return $self; |
|
79 | + } |
|
80 | 80 | } |
@@ -21,60 +21,60 @@ |
||
21 | 21 | */ |
22 | 22 | class ShareResource implements XmlDeserializable |
23 | 23 | { |
24 | - /** |
|
25 | - * The list of new people added or updated or removed from the share. |
|
26 | - * |
|
27 | - * @var Sharee[] |
|
28 | - */ |
|
29 | - public $sharees = []; |
|
24 | + /** |
|
25 | + * The list of new people added or updated or removed from the share. |
|
26 | + * |
|
27 | + * @var Sharee[] |
|
28 | + */ |
|
29 | + public $sharees = []; |
|
30 | 30 | |
31 | - /** |
|
32 | - * Constructor. |
|
33 | - * |
|
34 | - * @param Sharee[] $sharees |
|
35 | - */ |
|
36 | - public function __construct(array $sharees) |
|
37 | - { |
|
38 | - $this->sharees = $sharees; |
|
39 | - } |
|
31 | + /** |
|
32 | + * Constructor. |
|
33 | + * |
|
34 | + * @param Sharee[] $sharees |
|
35 | + */ |
|
36 | + public function __construct(array $sharees) |
|
37 | + { |
|
38 | + $this->sharees = $sharees; |
|
39 | + } |
|
40 | 40 | |
41 | - /** |
|
42 | - * The deserialize method is called during xml parsing. |
|
43 | - * |
|
44 | - * This method is called statically, this is because in theory this method |
|
45 | - * may be used as a type of constructor, or factory method. |
|
46 | - * |
|
47 | - * Often you want to return an instance of the current class, but you are |
|
48 | - * free to return other data as well. |
|
49 | - * |
|
50 | - * You are responsible for advancing the reader to the next element. Not |
|
51 | - * doing anything will result in a never-ending loop. |
|
52 | - * |
|
53 | - * If you just want to skip parsing for this element altogether, you can |
|
54 | - * just call $reader->next(); |
|
55 | - * |
|
56 | - * $reader->parseInnerTree() will parse the entire sub-tree, and advance to |
|
57 | - * the next element. |
|
58 | - * |
|
59 | - * @return mixed |
|
60 | - */ |
|
61 | - public static function xmlDeserialize(Reader $reader) |
|
62 | - { |
|
63 | - $elems = $reader->parseInnerTree([ |
|
64 | - '{DAV:}sharee' => 'Sabre\DAV\Xml\Element\Sharee', |
|
65 | - '{DAV:}share-access' => 'Sabre\DAV\Xml\Property\ShareAccess', |
|
66 | - '{DAV:}prop' => 'Sabre\Xml\Deserializer\keyValue', |
|
67 | - ]); |
|
41 | + /** |
|
42 | + * The deserialize method is called during xml parsing. |
|
43 | + * |
|
44 | + * This method is called statically, this is because in theory this method |
|
45 | + * may be used as a type of constructor, or factory method. |
|
46 | + * |
|
47 | + * Often you want to return an instance of the current class, but you are |
|
48 | + * free to return other data as well. |
|
49 | + * |
|
50 | + * You are responsible for advancing the reader to the next element. Not |
|
51 | + * doing anything will result in a never-ending loop. |
|
52 | + * |
|
53 | + * If you just want to skip parsing for this element altogether, you can |
|
54 | + * just call $reader->next(); |
|
55 | + * |
|
56 | + * $reader->parseInnerTree() will parse the entire sub-tree, and advance to |
|
57 | + * the next element. |
|
58 | + * |
|
59 | + * @return mixed |
|
60 | + */ |
|
61 | + public static function xmlDeserialize(Reader $reader) |
|
62 | + { |
|
63 | + $elems = $reader->parseInnerTree([ |
|
64 | + '{DAV:}sharee' => 'Sabre\DAV\Xml\Element\Sharee', |
|
65 | + '{DAV:}share-access' => 'Sabre\DAV\Xml\Property\ShareAccess', |
|
66 | + '{DAV:}prop' => 'Sabre\Xml\Deserializer\keyValue', |
|
67 | + ]); |
|
68 | 68 | |
69 | - $sharees = []; |
|
69 | + $sharees = []; |
|
70 | 70 | |
71 | - foreach ($elems as $elem) { |
|
72 | - if ('{DAV:}sharee' !== $elem['name']) { |
|
73 | - continue; |
|
74 | - } |
|
75 | - $sharees[] = $elem['value']; |
|
76 | - } |
|
71 | + foreach ($elems as $elem) { |
|
72 | + if ('{DAV:}sharee' !== $elem['name']) { |
|
73 | + continue; |
|
74 | + } |
|
75 | + $sharees[] = $elem['value']; |
|
76 | + } |
|
77 | 77 | |
78 | - return new self($sharees); |
|
79 | - } |
|
78 | + return new self($sharees); |
|
79 | + } |
|
80 | 80 | } |
@@ -22,97 +22,97 @@ |
||
22 | 22 | */ |
23 | 23 | class SyncCollectionReport implements XmlDeserializable |
24 | 24 | { |
25 | - /** |
|
26 | - * The sync-token the client supplied for the report. |
|
27 | - * |
|
28 | - * @var string|null |
|
29 | - */ |
|
30 | - public $syncToken; |
|
31 | - |
|
32 | - /** |
|
33 | - * The 'depth' of the sync the client is interested in. |
|
34 | - * |
|
35 | - * @var int |
|
36 | - */ |
|
37 | - public $syncLevel; |
|
38 | - |
|
39 | - /** |
|
40 | - * Maximum amount of items returned. |
|
41 | - * |
|
42 | - * @var int|null |
|
43 | - */ |
|
44 | - public $limit; |
|
45 | - |
|
46 | - /** |
|
47 | - * The list of properties that are being requested for every change. |
|
48 | - * |
|
49 | - * @var array|null |
|
50 | - */ |
|
51 | - public $properties; |
|
52 | - |
|
53 | - /** |
|
54 | - * The deserialize method is called during xml parsing. |
|
55 | - * |
|
56 | - * This method is called statically, this is because in theory this method |
|
57 | - * may be used as a type of constructor, or factory method. |
|
58 | - * |
|
59 | - * Often you want to return an instance of the current class, but you are |
|
60 | - * free to return other data as well. |
|
61 | - * |
|
62 | - * You are responsible for advancing the reader to the next element. Not |
|
63 | - * doing anything will result in a never-ending loop. |
|
64 | - * |
|
65 | - * If you just want to skip parsing for this element altogether, you can |
|
66 | - * just call $reader->next(); |
|
67 | - * |
|
68 | - * $reader->parseInnerTree() will parse the entire sub-tree, and advance to |
|
69 | - * the next element. |
|
70 | - * |
|
71 | - * @return mixed |
|
72 | - */ |
|
73 | - public static function xmlDeserialize(Reader $reader) |
|
74 | - { |
|
75 | - $self = new self(); |
|
76 | - |
|
77 | - $reader->pushContext(); |
|
78 | - |
|
79 | - $reader->elementMap['{DAV:}prop'] = 'Sabre\Xml\Element\Elements'; |
|
80 | - $elems = KeyValue::xmlDeserialize($reader); |
|
81 | - |
|
82 | - $reader->popContext(); |
|
83 | - |
|
84 | - $required = [ |
|
85 | - '{DAV:}sync-token', |
|
86 | - '{DAV:}prop', |
|
87 | - ]; |
|
88 | - |
|
89 | - foreach ($required as $elem) { |
|
90 | - if (!array_key_exists($elem, $elems)) { |
|
91 | - throw new BadRequest('The '.$elem.' element in the {DAV:}sync-collection report is required'); |
|
92 | - } |
|
93 | - } |
|
94 | - |
|
95 | - $self->properties = $elems['{DAV:}prop']; |
|
96 | - $self->syncToken = $elems['{DAV:}sync-token']; |
|
97 | - |
|
98 | - if (isset($elems['{DAV:}limit'])) { |
|
99 | - $nresults = null; |
|
100 | - foreach ($elems['{DAV:}limit'] as $child) { |
|
101 | - if ('{DAV:}nresults' === $child['name']) { |
|
102 | - $nresults = (int) $child['value']; |
|
103 | - } |
|
104 | - } |
|
105 | - $self->limit = $nresults; |
|
106 | - } |
|
107 | - |
|
108 | - if (isset($elems['{DAV:}sync-level'])) { |
|
109 | - $value = $elems['{DAV:}sync-level']; |
|
110 | - if ('infinity' === $value) { |
|
111 | - $value = \Sabre\DAV\Server::DEPTH_INFINITY; |
|
112 | - } |
|
113 | - $self->syncLevel = $value; |
|
114 | - } |
|
115 | - |
|
116 | - return $self; |
|
117 | - } |
|
25 | + /** |
|
26 | + * The sync-token the client supplied for the report. |
|
27 | + * |
|
28 | + * @var string|null |
|
29 | + */ |
|
30 | + public $syncToken; |
|
31 | + |
|
32 | + /** |
|
33 | + * The 'depth' of the sync the client is interested in. |
|
34 | + * |
|
35 | + * @var int |
|
36 | + */ |
|
37 | + public $syncLevel; |
|
38 | + |
|
39 | + /** |
|
40 | + * Maximum amount of items returned. |
|
41 | + * |
|
42 | + * @var int|null |
|
43 | + */ |
|
44 | + public $limit; |
|
45 | + |
|
46 | + /** |
|
47 | + * The list of properties that are being requested for every change. |
|
48 | + * |
|
49 | + * @var array|null |
|
50 | + */ |
|
51 | + public $properties; |
|
52 | + |
|
53 | + /** |
|
54 | + * The deserialize method is called during xml parsing. |
|
55 | + * |
|
56 | + * This method is called statically, this is because in theory this method |
|
57 | + * may be used as a type of constructor, or factory method. |
|
58 | + * |
|
59 | + * Often you want to return an instance of the current class, but you are |
|
60 | + * free to return other data as well. |
|
61 | + * |
|
62 | + * You are responsible for advancing the reader to the next element. Not |
|
63 | + * doing anything will result in a never-ending loop. |
|
64 | + * |
|
65 | + * If you just want to skip parsing for this element altogether, you can |
|
66 | + * just call $reader->next(); |
|
67 | + * |
|
68 | + * $reader->parseInnerTree() will parse the entire sub-tree, and advance to |
|
69 | + * the next element. |
|
70 | + * |
|
71 | + * @return mixed |
|
72 | + */ |
|
73 | + public static function xmlDeserialize(Reader $reader) |
|
74 | + { |
|
75 | + $self = new self(); |
|
76 | + |
|
77 | + $reader->pushContext(); |
|
78 | + |
|
79 | + $reader->elementMap['{DAV:}prop'] = 'Sabre\Xml\Element\Elements'; |
|
80 | + $elems = KeyValue::xmlDeserialize($reader); |
|
81 | + |
|
82 | + $reader->popContext(); |
|
83 | + |
|
84 | + $required = [ |
|
85 | + '{DAV:}sync-token', |
|
86 | + '{DAV:}prop', |
|
87 | + ]; |
|
88 | + |
|
89 | + foreach ($required as $elem) { |
|
90 | + if (!array_key_exists($elem, $elems)) { |
|
91 | + throw new BadRequest('The '.$elem.' element in the {DAV:}sync-collection report is required'); |
|
92 | + } |
|
93 | + } |
|
94 | + |
|
95 | + $self->properties = $elems['{DAV:}prop']; |
|
96 | + $self->syncToken = $elems['{DAV:}sync-token']; |
|
97 | + |
|
98 | + if (isset($elems['{DAV:}limit'])) { |
|
99 | + $nresults = null; |
|
100 | + foreach ($elems['{DAV:}limit'] as $child) { |
|
101 | + if ('{DAV:}nresults' === $child['name']) { |
|
102 | + $nresults = (int) $child['value']; |
|
103 | + } |
|
104 | + } |
|
105 | + $self->limit = $nresults; |
|
106 | + } |
|
107 | + |
|
108 | + if (isset($elems['{DAV:}sync-level'])) { |
|
109 | + $value = $elems['{DAV:}sync-level']; |
|
110 | + if ('infinity' === $value) { |
|
111 | + $value = \Sabre\DAV\Server::DEPTH_INFINITY; |
|
112 | + } |
|
113 | + $self->syncLevel = $value; |
|
114 | + } |
|
115 | + |
|
116 | + return $self; |
|
117 | + } |
|
118 | 118 | } |
@@ -21,59 +21,59 @@ |
||
21 | 21 | */ |
22 | 22 | class PropFind implements XmlDeserializable |
23 | 23 | { |
24 | - /** |
|
25 | - * If this is set to true, this was an 'allprop' request. |
|
26 | - * |
|
27 | - * @var bool |
|
28 | - */ |
|
29 | - public $allProp = false; |
|
24 | + /** |
|
25 | + * If this is set to true, this was an 'allprop' request. |
|
26 | + * |
|
27 | + * @var bool |
|
28 | + */ |
|
29 | + public $allProp = false; |
|
30 | 30 | |
31 | - /** |
|
32 | - * The property list. |
|
33 | - * |
|
34 | - * @var array|null |
|
35 | - */ |
|
36 | - public $properties; |
|
31 | + /** |
|
32 | + * The property list. |
|
33 | + * |
|
34 | + * @var array|null |
|
35 | + */ |
|
36 | + public $properties; |
|
37 | 37 | |
38 | - /** |
|
39 | - * The deserialize method is called during xml parsing. |
|
40 | - * |
|
41 | - * This method is called statically, this is because in theory this method |
|
42 | - * may be used as a type of constructor, or factory method. |
|
43 | - * |
|
44 | - * Often you want to return an instance of the current class, but you are |
|
45 | - * free to return other data as well. |
|
46 | - * |
|
47 | - * You are responsible for advancing the reader to the next element. Not |
|
48 | - * doing anything will result in a never-ending loop. |
|
49 | - * |
|
50 | - * If you just want to skip parsing for this element altogether, you can |
|
51 | - * just call $reader->next(); |
|
52 | - * |
|
53 | - * $reader->parseInnerTree() will parse the entire sub-tree, and advance to |
|
54 | - * the next element. |
|
55 | - * |
|
56 | - * @return mixed |
|
57 | - */ |
|
58 | - public static function xmlDeserialize(Reader $reader) |
|
59 | - { |
|
60 | - $self = new self(); |
|
38 | + /** |
|
39 | + * The deserialize method is called during xml parsing. |
|
40 | + * |
|
41 | + * This method is called statically, this is because in theory this method |
|
42 | + * may be used as a type of constructor, or factory method. |
|
43 | + * |
|
44 | + * Often you want to return an instance of the current class, but you are |
|
45 | + * free to return other data as well. |
|
46 | + * |
|
47 | + * You are responsible for advancing the reader to the next element. Not |
|
48 | + * doing anything will result in a never-ending loop. |
|
49 | + * |
|
50 | + * If you just want to skip parsing for this element altogether, you can |
|
51 | + * just call $reader->next(); |
|
52 | + * |
|
53 | + * $reader->parseInnerTree() will parse the entire sub-tree, and advance to |
|
54 | + * the next element. |
|
55 | + * |
|
56 | + * @return mixed |
|
57 | + */ |
|
58 | + public static function xmlDeserialize(Reader $reader) |
|
59 | + { |
|
60 | + $self = new self(); |
|
61 | 61 | |
62 | - $reader->pushContext(); |
|
63 | - $reader->elementMap['{DAV:}prop'] = 'Sabre\Xml\Element\Elements'; |
|
62 | + $reader->pushContext(); |
|
63 | + $reader->elementMap['{DAV:}prop'] = 'Sabre\Xml\Element\Elements'; |
|
64 | 64 | |
65 | - foreach (KeyValue::xmlDeserialize($reader) as $k => $v) { |
|
66 | - switch ($k) { |
|
67 | - case '{DAV:}prop': |
|
68 | - $self->properties = $v; |
|
69 | - break; |
|
70 | - case '{DAV:}allprop': |
|
71 | - $self->allProp = true; |
|
72 | - } |
|
73 | - } |
|
65 | + foreach (KeyValue::xmlDeserialize($reader) as $k => $v) { |
|
66 | + switch ($k) { |
|
67 | + case '{DAV:}prop': |
|
68 | + $self->properties = $v; |
|
69 | + break; |
|
70 | + case '{DAV:}allprop': |
|
71 | + $self->allProp = true; |
|
72 | + } |
|
73 | + } |
|
74 | 74 | |
75 | - $reader->popContext(); |
|
75 | + $reader->popContext(); |
|
76 | 76 | |
77 | - return $self; |
|
78 | - } |
|
77 | + return $self; |
|
78 | + } |
|
79 | 79 | } |
@@ -23,114 +23,114 @@ |
||
23 | 23 | */ |
24 | 24 | class MultiStatus implements Element |
25 | 25 | { |
26 | - /** |
|
27 | - * The responses. |
|
28 | - * |
|
29 | - * @var \Sabre\DAV\Xml\Element\Response[] |
|
30 | - */ |
|
31 | - protected $responses; |
|
26 | + /** |
|
27 | + * The responses. |
|
28 | + * |
|
29 | + * @var \Sabre\DAV\Xml\Element\Response[] |
|
30 | + */ |
|
31 | + protected $responses; |
|
32 | 32 | |
33 | - /** |
|
34 | - * A sync token (from RFC6578). |
|
35 | - * |
|
36 | - * @var string |
|
37 | - */ |
|
38 | - protected $syncToken; |
|
33 | + /** |
|
34 | + * A sync token (from RFC6578). |
|
35 | + * |
|
36 | + * @var string |
|
37 | + */ |
|
38 | + protected $syncToken; |
|
39 | 39 | |
40 | - /** |
|
41 | - * Constructor. |
|
42 | - * |
|
43 | - * @param \Sabre\DAV\Xml\Element\Response[] $responses |
|
44 | - * @param string $syncToken |
|
45 | - */ |
|
46 | - public function __construct(array $responses, $syncToken = null) |
|
47 | - { |
|
48 | - $this->responses = $responses; |
|
49 | - $this->syncToken = $syncToken; |
|
50 | - } |
|
40 | + /** |
|
41 | + * Constructor. |
|
42 | + * |
|
43 | + * @param \Sabre\DAV\Xml\Element\Response[] $responses |
|
44 | + * @param string $syncToken |
|
45 | + */ |
|
46 | + public function __construct(array $responses, $syncToken = null) |
|
47 | + { |
|
48 | + $this->responses = $responses; |
|
49 | + $this->syncToken = $syncToken; |
|
50 | + } |
|
51 | 51 | |
52 | - /** |
|
53 | - * Returns the response list. |
|
54 | - * |
|
55 | - * @return \Sabre\DAV\Xml\Element\Response[] |
|
56 | - */ |
|
57 | - public function getResponses() |
|
58 | - { |
|
59 | - return $this->responses; |
|
60 | - } |
|
52 | + /** |
|
53 | + * Returns the response list. |
|
54 | + * |
|
55 | + * @return \Sabre\DAV\Xml\Element\Response[] |
|
56 | + */ |
|
57 | + public function getResponses() |
|
58 | + { |
|
59 | + return $this->responses; |
|
60 | + } |
|
61 | 61 | |
62 | - /** |
|
63 | - * Returns the sync-token, if available. |
|
64 | - * |
|
65 | - * @return string|null |
|
66 | - */ |
|
67 | - public function getSyncToken() |
|
68 | - { |
|
69 | - return $this->syncToken; |
|
70 | - } |
|
62 | + /** |
|
63 | + * Returns the sync-token, if available. |
|
64 | + * |
|
65 | + * @return string|null |
|
66 | + */ |
|
67 | + public function getSyncToken() |
|
68 | + { |
|
69 | + return $this->syncToken; |
|
70 | + } |
|
71 | 71 | |
72 | - /** |
|
73 | - * The serialize method is called during xml writing. |
|
74 | - * |
|
75 | - * It should use the $writer argument to encode this object into XML. |
|
76 | - * |
|
77 | - * Important note: it is not needed to create the parent element. The |
|
78 | - * parent element is already created, and we only have to worry about |
|
79 | - * attributes, child elements and text (if any). |
|
80 | - * |
|
81 | - * Important note 2: If you are writing any new elements, you are also |
|
82 | - * responsible for closing them. |
|
83 | - */ |
|
84 | - public function xmlSerialize(Writer $writer) |
|
85 | - { |
|
86 | - foreach ($this->getResponses() as $response) { |
|
87 | - $writer->writeElement('{DAV:}response', $response); |
|
88 | - } |
|
89 | - if ($syncToken = $this->getSyncToken()) { |
|
90 | - $writer->writeElement('{DAV:}sync-token', $syncToken); |
|
91 | - } |
|
92 | - } |
|
72 | + /** |
|
73 | + * The serialize method is called during xml writing. |
|
74 | + * |
|
75 | + * It should use the $writer argument to encode this object into XML. |
|
76 | + * |
|
77 | + * Important note: it is not needed to create the parent element. The |
|
78 | + * parent element is already created, and we only have to worry about |
|
79 | + * attributes, child elements and text (if any). |
|
80 | + * |
|
81 | + * Important note 2: If you are writing any new elements, you are also |
|
82 | + * responsible for closing them. |
|
83 | + */ |
|
84 | + public function xmlSerialize(Writer $writer) |
|
85 | + { |
|
86 | + foreach ($this->getResponses() as $response) { |
|
87 | + $writer->writeElement('{DAV:}response', $response); |
|
88 | + } |
|
89 | + if ($syncToken = $this->getSyncToken()) { |
|
90 | + $writer->writeElement('{DAV:}sync-token', $syncToken); |
|
91 | + } |
|
92 | + } |
|
93 | 93 | |
94 | - /** |
|
95 | - * The deserialize method is called during xml parsing. |
|
96 | - * |
|
97 | - * This method is called statically, this is because in theory this method |
|
98 | - * may be used as a type of constructor, or factory method. |
|
99 | - * |
|
100 | - * Often you want to return an instance of the current class, but you are |
|
101 | - * free to return other data as well. |
|
102 | - * |
|
103 | - * You are responsible for advancing the reader to the next element. Not |
|
104 | - * doing anything will result in a never-ending loop. |
|
105 | - * |
|
106 | - * If you just want to skip parsing for this element altogether, you can |
|
107 | - * just call $reader->next(); |
|
108 | - * |
|
109 | - * $reader->parseInnerTree() will parse the entire sub-tree, and advance to |
|
110 | - * the next element. |
|
111 | - * |
|
112 | - * @return mixed |
|
113 | - */ |
|
114 | - public static function xmlDeserialize(Reader $reader) |
|
115 | - { |
|
116 | - $elementMap = $reader->elementMap; |
|
117 | - $elementMap['{DAV:}prop'] = 'Sabre\\DAV\\Xml\\Element\\Prop'; |
|
118 | - $elements = $reader->parseInnerTree($elementMap); |
|
94 | + /** |
|
95 | + * The deserialize method is called during xml parsing. |
|
96 | + * |
|
97 | + * This method is called statically, this is because in theory this method |
|
98 | + * may be used as a type of constructor, or factory method. |
|
99 | + * |
|
100 | + * Often you want to return an instance of the current class, but you are |
|
101 | + * free to return other data as well. |
|
102 | + * |
|
103 | + * You are responsible for advancing the reader to the next element. Not |
|
104 | + * doing anything will result in a never-ending loop. |
|
105 | + * |
|
106 | + * If you just want to skip parsing for this element altogether, you can |
|
107 | + * just call $reader->next(); |
|
108 | + * |
|
109 | + * $reader->parseInnerTree() will parse the entire sub-tree, and advance to |
|
110 | + * the next element. |
|
111 | + * |
|
112 | + * @return mixed |
|
113 | + */ |
|
114 | + public static function xmlDeserialize(Reader $reader) |
|
115 | + { |
|
116 | + $elementMap = $reader->elementMap; |
|
117 | + $elementMap['{DAV:}prop'] = 'Sabre\\DAV\\Xml\\Element\\Prop'; |
|
118 | + $elements = $reader->parseInnerTree($elementMap); |
|
119 | 119 | |
120 | - $responses = []; |
|
121 | - $syncToken = null; |
|
120 | + $responses = []; |
|
121 | + $syncToken = null; |
|
122 | 122 | |
123 | - if ($elements) { |
|
124 | - foreach ($elements as $elem) { |
|
125 | - if ('{DAV:}response' === $elem['name']) { |
|
126 | - $responses[] = $elem['value']; |
|
127 | - } |
|
128 | - if ('{DAV:}sync-token' === $elem['name']) { |
|
129 | - $syncToken = $elem['value']; |
|
130 | - } |
|
131 | - } |
|
132 | - } |
|
123 | + if ($elements) { |
|
124 | + foreach ($elements as $elem) { |
|
125 | + if ('{DAV:}response' === $elem['name']) { |
|
126 | + $responses[] = $elem['value']; |
|
127 | + } |
|
128 | + if ('{DAV:}sync-token' === $elem['name']) { |
|
129 | + $syncToken = $elem['value']; |
|
130 | + } |
|
131 | + } |
|
132 | + } |
|
133 | 133 | |
134 | - return new self($responses, $syncToken); |
|
135 | - } |
|
134 | + return new self($responses, $syncToken); |
|
135 | + } |
|
136 | 136 | } |
@@ -24,43 +24,43 @@ |
||
24 | 24 | */ |
25 | 25 | class Invite implements XmlSerializable |
26 | 26 | { |
27 | - /** |
|
28 | - * A list of sharees. |
|
29 | - * |
|
30 | - * @var Sharee[] |
|
31 | - */ |
|
32 | - public $sharees = []; |
|
27 | + /** |
|
28 | + * A list of sharees. |
|
29 | + * |
|
30 | + * @var Sharee[] |
|
31 | + */ |
|
32 | + public $sharees = []; |
|
33 | 33 | |
34 | - /** |
|
35 | - * Creates the property. |
|
36 | - * |
|
37 | - * @param Sharee[] $sharees |
|
38 | - */ |
|
39 | - public function __construct(array $sharees) |
|
40 | - { |
|
41 | - $this->sharees = $sharees; |
|
42 | - } |
|
34 | + /** |
|
35 | + * Creates the property. |
|
36 | + * |
|
37 | + * @param Sharee[] $sharees |
|
38 | + */ |
|
39 | + public function __construct(array $sharees) |
|
40 | + { |
|
41 | + $this->sharees = $sharees; |
|
42 | + } |
|
43 | 43 | |
44 | - /** |
|
45 | - * The xmlSerialize method is called during xml writing. |
|
46 | - * |
|
47 | - * Use the $writer argument to write its own xml serialization. |
|
48 | - * |
|
49 | - * An important note: do _not_ create a parent element. Any element |
|
50 | - * implementing XmlSerializable should only ever write what's considered |
|
51 | - * its 'inner xml'. |
|
52 | - * |
|
53 | - * The parent of the current element is responsible for writing a |
|
54 | - * containing element. |
|
55 | - * |
|
56 | - * This allows serializers to be re-used for different element names. |
|
57 | - * |
|
58 | - * If you are opening new elements, you must also close them again. |
|
59 | - */ |
|
60 | - public function xmlSerialize(Writer $writer) |
|
61 | - { |
|
62 | - foreach ($this->sharees as $sharee) { |
|
63 | - $writer->writeElement('{DAV:}sharee', $sharee); |
|
64 | - } |
|
65 | - } |
|
44 | + /** |
|
45 | + * The xmlSerialize method is called during xml writing. |
|
46 | + * |
|
47 | + * Use the $writer argument to write its own xml serialization. |
|
48 | + * |
|
49 | + * An important note: do _not_ create a parent element. Any element |
|
50 | + * implementing XmlSerializable should only ever write what's considered |
|
51 | + * its 'inner xml'. |
|
52 | + * |
|
53 | + * The parent of the current element is responsible for writing a |
|
54 | + * containing element. |
|
55 | + * |
|
56 | + * This allows serializers to be re-used for different element names. |
|
57 | + * |
|
58 | + * If you are opening new elements, you must also close them again. |
|
59 | + */ |
|
60 | + public function xmlSerialize(Writer $writer) |
|
61 | + { |
|
62 | + foreach ($this->sharees as $sharee) { |
|
63 | + $writer->writeElement('{DAV:}sharee', $sharee); |
|
64 | + } |
|
65 | + } |
|
66 | 66 | } |