@@ -26,69 +26,69 @@ |
||
26 | 26 | */ |
27 | 27 | class CompFilter implements XmlDeserializable |
28 | 28 | { |
29 | - /** |
|
30 | - * The deserialize method is called during xml parsing. |
|
31 | - * |
|
32 | - * This method is called statically, this is because in theory this method |
|
33 | - * may be used as a type of constructor, or factory method. |
|
34 | - * |
|
35 | - * Often you want to return an instance of the current class, but you are |
|
36 | - * free to return other data as well. |
|
37 | - * |
|
38 | - * You are responsible for advancing the reader to the next element. Not |
|
39 | - * doing anything will result in a never-ending loop. |
|
40 | - * |
|
41 | - * If you just want to skip parsing for this element altogether, you can |
|
42 | - * just call $reader->next(); |
|
43 | - * |
|
44 | - * $reader->parseInnerTree() will parse the entire sub-tree, and advance to |
|
45 | - * the next element. |
|
46 | - * |
|
47 | - * @return mixed |
|
48 | - */ |
|
49 | - public static function xmlDeserialize(Reader $reader) |
|
50 | - { |
|
51 | - $result = [ |
|
52 | - 'name' => null, |
|
53 | - 'is-not-defined' => false, |
|
54 | - 'comp-filters' => [], |
|
55 | - 'prop-filters' => [], |
|
56 | - 'time-range' => false, |
|
57 | - ]; |
|
29 | + /** |
|
30 | + * The deserialize method is called during xml parsing. |
|
31 | + * |
|
32 | + * This method is called statically, this is because in theory this method |
|
33 | + * may be used as a type of constructor, or factory method. |
|
34 | + * |
|
35 | + * Often you want to return an instance of the current class, but you are |
|
36 | + * free to return other data as well. |
|
37 | + * |
|
38 | + * You are responsible for advancing the reader to the next element. Not |
|
39 | + * doing anything will result in a never-ending loop. |
|
40 | + * |
|
41 | + * If you just want to skip parsing for this element altogether, you can |
|
42 | + * just call $reader->next(); |
|
43 | + * |
|
44 | + * $reader->parseInnerTree() will parse the entire sub-tree, and advance to |
|
45 | + * the next element. |
|
46 | + * |
|
47 | + * @return mixed |
|
48 | + */ |
|
49 | + public static function xmlDeserialize(Reader $reader) |
|
50 | + { |
|
51 | + $result = [ |
|
52 | + 'name' => null, |
|
53 | + 'is-not-defined' => false, |
|
54 | + 'comp-filters' => [], |
|
55 | + 'prop-filters' => [], |
|
56 | + 'time-range' => false, |
|
57 | + ]; |
|
58 | 58 | |
59 | - $att = $reader->parseAttributes(); |
|
60 | - $result['name'] = $att['name']; |
|
59 | + $att = $reader->parseAttributes(); |
|
60 | + $result['name'] = $att['name']; |
|
61 | 61 | |
62 | - $elems = $reader->parseInnerTree(); |
|
62 | + $elems = $reader->parseInnerTree(); |
|
63 | 63 | |
64 | - if (is_array($elems)) { |
|
65 | - foreach ($elems as $elem) { |
|
66 | - switch ($elem['name']) { |
|
67 | - case '{'.Plugin::NS_CALDAV.'}comp-filter': |
|
68 | - $result['comp-filters'][] = $elem['value']; |
|
69 | - break; |
|
70 | - case '{'.Plugin::NS_CALDAV.'}prop-filter': |
|
71 | - $result['prop-filters'][] = $elem['value']; |
|
72 | - break; |
|
73 | - case '{'.Plugin::NS_CALDAV.'}is-not-defined': |
|
74 | - $result['is-not-defined'] = true; |
|
75 | - break; |
|
76 | - case '{'.Plugin::NS_CALDAV.'}time-range': |
|
77 | - if ('VCALENDAR' === $result['name']) { |
|
78 | - throw new BadRequest('You cannot add time-range filters on the VCALENDAR component'); |
|
79 | - } |
|
80 | - $result['time-range'] = [ |
|
81 | - 'start' => isset($elem['attributes']['start']) ? DateTimeParser::parseDateTime($elem['attributes']['start']) : null, |
|
82 | - 'end' => isset($elem['attributes']['end']) ? DateTimeParser::parseDateTime($elem['attributes']['end']) : null, |
|
83 | - ]; |
|
84 | - if ($result['time-range']['start'] && $result['time-range']['end'] && $result['time-range']['end'] <= $result['time-range']['start']) { |
|
85 | - throw new BadRequest('The end-date must be larger than the start-date'); |
|
86 | - } |
|
87 | - break; |
|
88 | - } |
|
89 | - } |
|
90 | - } |
|
64 | + if (is_array($elems)) { |
|
65 | + foreach ($elems as $elem) { |
|
66 | + switch ($elem['name']) { |
|
67 | + case '{'.Plugin::NS_CALDAV.'}comp-filter': |
|
68 | + $result['comp-filters'][] = $elem['value']; |
|
69 | + break; |
|
70 | + case '{'.Plugin::NS_CALDAV.'}prop-filter': |
|
71 | + $result['prop-filters'][] = $elem['value']; |
|
72 | + break; |
|
73 | + case '{'.Plugin::NS_CALDAV.'}is-not-defined': |
|
74 | + $result['is-not-defined'] = true; |
|
75 | + break; |
|
76 | + case '{'.Plugin::NS_CALDAV.'}time-range': |
|
77 | + if ('VCALENDAR' === $result['name']) { |
|
78 | + throw new BadRequest('You cannot add time-range filters on the VCALENDAR component'); |
|
79 | + } |
|
80 | + $result['time-range'] = [ |
|
81 | + 'start' => isset($elem['attributes']['start']) ? DateTimeParser::parseDateTime($elem['attributes']['start']) : null, |
|
82 | + 'end' => isset($elem['attributes']['end']) ? DateTimeParser::parseDateTime($elem['attributes']['end']) : null, |
|
83 | + ]; |
|
84 | + if ($result['time-range']['start'] && $result['time-range']['end'] && $result['time-range']['end'] <= $result['time-range']['start']) { |
|
85 | + throw new BadRequest('The end-date must be larger than the start-date'); |
|
86 | + } |
|
87 | + break; |
|
88 | + } |
|
89 | + } |
|
90 | + } |
|
91 | 91 | |
92 | - return $result; |
|
93 | - } |
|
92 | + return $result; |
|
93 | + } |
|
94 | 94 | } |
@@ -64,27 +64,27 @@ |
||
64 | 64 | if (is_array($elems)) { |
65 | 65 | foreach ($elems as $elem) { |
66 | 66 | switch ($elem['name']) { |
67 | - case '{'.Plugin::NS_CALDAV.'}comp-filter': |
|
68 | - $result['comp-filters'][] = $elem['value']; |
|
69 | - break; |
|
70 | - case '{'.Plugin::NS_CALDAV.'}prop-filter': |
|
71 | - $result['prop-filters'][] = $elem['value']; |
|
72 | - break; |
|
73 | - case '{'.Plugin::NS_CALDAV.'}is-not-defined': |
|
74 | - $result['is-not-defined'] = true; |
|
75 | - break; |
|
76 | - case '{'.Plugin::NS_CALDAV.'}time-range': |
|
77 | - if ('VCALENDAR' === $result['name']) { |
|
78 | - throw new BadRequest('You cannot add time-range filters on the VCALENDAR component'); |
|
79 | - } |
|
80 | - $result['time-range'] = [ |
|
81 | - 'start' => isset($elem['attributes']['start']) ? DateTimeParser::parseDateTime($elem['attributes']['start']) : null, |
|
82 | - 'end' => isset($elem['attributes']['end']) ? DateTimeParser::parseDateTime($elem['attributes']['end']) : null, |
|
83 | - ]; |
|
84 | - if ($result['time-range']['start'] && $result['time-range']['end'] && $result['time-range']['end'] <= $result['time-range']['start']) { |
|
85 | - throw new BadRequest('The end-date must be larger than the start-date'); |
|
86 | - } |
|
87 | - break; |
|
67 | + case '{'.Plugin::NS_CALDAV.'}comp-filter': |
|
68 | + $result['comp-filters'][] = $elem['value']; |
|
69 | + break; |
|
70 | + case '{'.Plugin::NS_CALDAV.'}prop-filter': |
|
71 | + $result['prop-filters'][] = $elem['value']; |
|
72 | + break; |
|
73 | + case '{'.Plugin::NS_CALDAV.'}is-not-defined': |
|
74 | + $result['is-not-defined'] = true; |
|
75 | + break; |
|
76 | + case '{'.Plugin::NS_CALDAV.'}time-range': |
|
77 | + if ('VCALENDAR' === $result['name']) { |
|
78 | + throw new BadRequest('You cannot add time-range filters on the VCALENDAR component'); |
|
79 | + } |
|
80 | + $result['time-range'] = [ |
|
81 | + 'start' => isset($elem['attributes']['start']) ? DateTimeParser::parseDateTime($elem['attributes']['start']) : null, |
|
82 | + 'end' => isset($elem['attributes']['end']) ? DateTimeParser::parseDateTime($elem['attributes']['end']) : null, |
|
83 | + ]; |
|
84 | + if ($result['time-range']['start'] && $result['time-range']['end'] && $result['time-range']['end'] <= $result['time-range']['start']) { |
|
85 | + throw new BadRequest('The end-date must be larger than the start-date'); |
|
86 | + } |
|
87 | + break; |
|
88 | 88 | } |
89 | 89 | } |
90 | 90 | } |
@@ -64,28 +64,28 @@ |
||
64 | 64 | if (is_array($elems)) { |
65 | 65 | foreach ($elems as $elem) { |
66 | 66 | switch ($elem['name']) { |
67 | - case '{'.Plugin::NS_CALDAV.'}param-filter': |
|
68 | - $result['param-filters'][] = $elem['value']; |
|
69 | - break; |
|
70 | - case '{'.Plugin::NS_CALDAV.'}is-not-defined': |
|
71 | - $result['is-not-defined'] = true; |
|
72 | - break; |
|
73 | - case '{'.Plugin::NS_CALDAV.'}time-range': |
|
74 | - $result['time-range'] = [ |
|
75 | - 'start' => isset($elem['attributes']['start']) ? DateTimeParser::parseDateTime($elem['attributes']['start']) : null, |
|
76 | - 'end' => isset($elem['attributes']['end']) ? DateTimeParser::parseDateTime($elem['attributes']['end']) : null, |
|
77 | - ]; |
|
78 | - if ($result['time-range']['start'] && $result['time-range']['end'] && $result['time-range']['end'] <= $result['time-range']['start']) { |
|
79 | - throw new BadRequest('The end-date must be larger than the start-date'); |
|
80 | - } |
|
81 | - break; |
|
82 | - case '{'.Plugin::NS_CALDAV.'}text-match': |
|
83 | - $result['text-match'] = [ |
|
84 | - 'negate-condition' => isset($elem['attributes']['negate-condition']) && 'yes' === $elem['attributes']['negate-condition'], |
|
85 | - 'collation' => isset($elem['attributes']['collation']) ? $elem['attributes']['collation'] : 'i;ascii-casemap', |
|
86 | - 'value' => $elem['value'], |
|
87 | - ]; |
|
88 | - break; |
|
67 | + case '{'.Plugin::NS_CALDAV.'}param-filter': |
|
68 | + $result['param-filters'][] = $elem['value']; |
|
69 | + break; |
|
70 | + case '{'.Plugin::NS_CALDAV.'}is-not-defined': |
|
71 | + $result['is-not-defined'] = true; |
|
72 | + break; |
|
73 | + case '{'.Plugin::NS_CALDAV.'}time-range': |
|
74 | + $result['time-range'] = [ |
|
75 | + 'start' => isset($elem['attributes']['start']) ? DateTimeParser::parseDateTime($elem['attributes']['start']) : null, |
|
76 | + 'end' => isset($elem['attributes']['end']) ? DateTimeParser::parseDateTime($elem['attributes']['end']) : null, |
|
77 | + ]; |
|
78 | + if ($result['time-range']['start'] && $result['time-range']['end'] && $result['time-range']['end'] <= $result['time-range']['start']) { |
|
79 | + throw new BadRequest('The end-date must be larger than the start-date'); |
|
80 | + } |
|
81 | + break; |
|
82 | + case '{'.Plugin::NS_CALDAV.'}text-match': |
|
83 | + $result['text-match'] = [ |
|
84 | + 'negate-condition' => isset($elem['attributes']['negate-condition']) && 'yes' === $elem['attributes']['negate-condition'], |
|
85 | + 'collation' => isset($elem['attributes']['collation']) ? $elem['attributes']['collation'] : 'i;ascii-casemap', |
|
86 | + 'value' => $elem['value'], |
|
87 | + ]; |
|
88 | + break; |
|
89 | 89 | } |
90 | 90 | } |
91 | 91 | } |
@@ -26,70 +26,70 @@ |
||
26 | 26 | */ |
27 | 27 | class PropFilter implements XmlDeserializable |
28 | 28 | { |
29 | - /** |
|
30 | - * The deserialize method is called during xml parsing. |
|
31 | - * |
|
32 | - * This method is called statically, this is because in theory this method |
|
33 | - * may be used as a type of constructor, or factory method. |
|
34 | - * |
|
35 | - * Often you want to return an instance of the current class, but you are |
|
36 | - * free to return other data as well. |
|
37 | - * |
|
38 | - * You are responsible for advancing the reader to the next element. Not |
|
39 | - * doing anything will result in a never-ending loop. |
|
40 | - * |
|
41 | - * If you just want to skip parsing for this element altogether, you can |
|
42 | - * just call $reader->next(); |
|
43 | - * |
|
44 | - * $reader->parseInnerTree() will parse the entire sub-tree, and advance to |
|
45 | - * the next element. |
|
46 | - * |
|
47 | - * @return mixed |
|
48 | - */ |
|
49 | - public static function xmlDeserialize(Reader $reader) |
|
50 | - { |
|
51 | - $result = [ |
|
52 | - 'name' => null, |
|
53 | - 'is-not-defined' => false, |
|
54 | - 'param-filters' => [], |
|
55 | - 'text-match' => null, |
|
56 | - 'time-range' => [], |
|
57 | - ]; |
|
29 | + /** |
|
30 | + * The deserialize method is called during xml parsing. |
|
31 | + * |
|
32 | + * This method is called statically, this is because in theory this method |
|
33 | + * may be used as a type of constructor, or factory method. |
|
34 | + * |
|
35 | + * Often you want to return an instance of the current class, but you are |
|
36 | + * free to return other data as well. |
|
37 | + * |
|
38 | + * You are responsible for advancing the reader to the next element. Not |
|
39 | + * doing anything will result in a never-ending loop. |
|
40 | + * |
|
41 | + * If you just want to skip parsing for this element altogether, you can |
|
42 | + * just call $reader->next(); |
|
43 | + * |
|
44 | + * $reader->parseInnerTree() will parse the entire sub-tree, and advance to |
|
45 | + * the next element. |
|
46 | + * |
|
47 | + * @return mixed |
|
48 | + */ |
|
49 | + public static function xmlDeserialize(Reader $reader) |
|
50 | + { |
|
51 | + $result = [ |
|
52 | + 'name' => null, |
|
53 | + 'is-not-defined' => false, |
|
54 | + 'param-filters' => [], |
|
55 | + 'text-match' => null, |
|
56 | + 'time-range' => [], |
|
57 | + ]; |
|
58 | 58 | |
59 | - $att = $reader->parseAttributes(); |
|
60 | - $result['name'] = $att['name']; |
|
59 | + $att = $reader->parseAttributes(); |
|
60 | + $result['name'] = $att['name']; |
|
61 | 61 | |
62 | - $elems = $reader->parseInnerTree(); |
|
62 | + $elems = $reader->parseInnerTree(); |
|
63 | 63 | |
64 | - if (is_array($elems)) { |
|
65 | - foreach ($elems as $elem) { |
|
66 | - switch ($elem['name']) { |
|
67 | - case '{'.Plugin::NS_CALDAV.'}param-filter': |
|
68 | - $result['param-filters'][] = $elem['value']; |
|
69 | - break; |
|
70 | - case '{'.Plugin::NS_CALDAV.'}is-not-defined': |
|
71 | - $result['is-not-defined'] = true; |
|
72 | - break; |
|
73 | - case '{'.Plugin::NS_CALDAV.'}time-range': |
|
74 | - $result['time-range'] = [ |
|
75 | - 'start' => isset($elem['attributes']['start']) ? DateTimeParser::parseDateTime($elem['attributes']['start']) : null, |
|
76 | - 'end' => isset($elem['attributes']['end']) ? DateTimeParser::parseDateTime($elem['attributes']['end']) : null, |
|
77 | - ]; |
|
78 | - if ($result['time-range']['start'] && $result['time-range']['end'] && $result['time-range']['end'] <= $result['time-range']['start']) { |
|
79 | - throw new BadRequest('The end-date must be larger than the start-date'); |
|
80 | - } |
|
81 | - break; |
|
82 | - case '{'.Plugin::NS_CALDAV.'}text-match': |
|
83 | - $result['text-match'] = [ |
|
84 | - 'negate-condition' => isset($elem['attributes']['negate-condition']) && 'yes' === $elem['attributes']['negate-condition'], |
|
85 | - 'collation' => isset($elem['attributes']['collation']) ? $elem['attributes']['collation'] : 'i;ascii-casemap', |
|
86 | - 'value' => $elem['value'], |
|
87 | - ]; |
|
88 | - break; |
|
89 | - } |
|
90 | - } |
|
91 | - } |
|
64 | + if (is_array($elems)) { |
|
65 | + foreach ($elems as $elem) { |
|
66 | + switch ($elem['name']) { |
|
67 | + case '{'.Plugin::NS_CALDAV.'}param-filter': |
|
68 | + $result['param-filters'][] = $elem['value']; |
|
69 | + break; |
|
70 | + case '{'.Plugin::NS_CALDAV.'}is-not-defined': |
|
71 | + $result['is-not-defined'] = true; |
|
72 | + break; |
|
73 | + case '{'.Plugin::NS_CALDAV.'}time-range': |
|
74 | + $result['time-range'] = [ |
|
75 | + 'start' => isset($elem['attributes']['start']) ? DateTimeParser::parseDateTime($elem['attributes']['start']) : null, |
|
76 | + 'end' => isset($elem['attributes']['end']) ? DateTimeParser::parseDateTime($elem['attributes']['end']) : null, |
|
77 | + ]; |
|
78 | + if ($result['time-range']['start'] && $result['time-range']['end'] && $result['time-range']['end'] <= $result['time-range']['start']) { |
|
79 | + throw new BadRequest('The end-date must be larger than the start-date'); |
|
80 | + } |
|
81 | + break; |
|
82 | + case '{'.Plugin::NS_CALDAV.'}text-match': |
|
83 | + $result['text-match'] = [ |
|
84 | + 'negate-condition' => isset($elem['attributes']['negate-condition']) && 'yes' === $elem['attributes']['negate-condition'], |
|
85 | + 'collation' => isset($elem['attributes']['collation']) ? $elem['attributes']['collation'] : 'i;ascii-casemap', |
|
86 | + 'value' => $elem['value'], |
|
87 | + ]; |
|
88 | + break; |
|
89 | + } |
|
90 | + } |
|
91 | + } |
|
92 | 92 | |
93 | - return $result; |
|
94 | - } |
|
93 | + return $result; |
|
94 | + } |
|
95 | 95 | } |
@@ -29,52 +29,52 @@ |
||
29 | 29 | */ |
30 | 30 | class CalendarData implements XmlDeserializable |
31 | 31 | { |
32 | - /** |
|
33 | - * The deserialize method is called during xml parsing. |
|
34 | - * |
|
35 | - * This method is called statically, this is because in theory this method |
|
36 | - * may be used as a type of constructor, or factory method. |
|
37 | - * |
|
38 | - * Often you want to return an instance of the current class, but you are |
|
39 | - * free to return other data as well. |
|
40 | - * |
|
41 | - * You are responsible for advancing the reader to the next element. Not |
|
42 | - * doing anything will result in a never-ending loop. |
|
43 | - * |
|
44 | - * If you just want to skip parsing for this element altogether, you can |
|
45 | - * just call $reader->next(); |
|
46 | - * |
|
47 | - * $reader->parseInnerTree() will parse the entire sub-tree, and advance to |
|
48 | - * the next element. |
|
49 | - * |
|
50 | - * @return mixed |
|
51 | - */ |
|
52 | - public static function xmlDeserialize(Reader $reader) |
|
53 | - { |
|
54 | - $result = [ |
|
55 | - 'contentType' => $reader->getAttribute('content-type') ?: 'text/calendar', |
|
56 | - 'version' => $reader->getAttribute('version') ?: '2.0', |
|
57 | - ]; |
|
32 | + /** |
|
33 | + * The deserialize method is called during xml parsing. |
|
34 | + * |
|
35 | + * This method is called statically, this is because in theory this method |
|
36 | + * may be used as a type of constructor, or factory method. |
|
37 | + * |
|
38 | + * Often you want to return an instance of the current class, but you are |
|
39 | + * free to return other data as well. |
|
40 | + * |
|
41 | + * You are responsible for advancing the reader to the next element. Not |
|
42 | + * doing anything will result in a never-ending loop. |
|
43 | + * |
|
44 | + * If you just want to skip parsing for this element altogether, you can |
|
45 | + * just call $reader->next(); |
|
46 | + * |
|
47 | + * $reader->parseInnerTree() will parse the entire sub-tree, and advance to |
|
48 | + * the next element. |
|
49 | + * |
|
50 | + * @return mixed |
|
51 | + */ |
|
52 | + public static function xmlDeserialize(Reader $reader) |
|
53 | + { |
|
54 | + $result = [ |
|
55 | + 'contentType' => $reader->getAttribute('content-type') ?: 'text/calendar', |
|
56 | + 'version' => $reader->getAttribute('version') ?: '2.0', |
|
57 | + ]; |
|
58 | 58 | |
59 | - $elems = (array) $reader->parseInnerTree(); |
|
60 | - foreach ($elems as $elem) { |
|
61 | - switch ($elem['name']) { |
|
62 | - case '{'.Plugin::NS_CALDAV.'}expand': |
|
63 | - $result['expand'] = [ |
|
64 | - 'start' => isset($elem['attributes']['start']) ? DateTimeParser::parseDateTime($elem['attributes']['start']) : null, |
|
65 | - 'end' => isset($elem['attributes']['end']) ? DateTimeParser::parseDateTime($elem['attributes']['end']) : null, |
|
66 | - ]; |
|
59 | + $elems = (array) $reader->parseInnerTree(); |
|
60 | + foreach ($elems as $elem) { |
|
61 | + switch ($elem['name']) { |
|
62 | + case '{'.Plugin::NS_CALDAV.'}expand': |
|
63 | + $result['expand'] = [ |
|
64 | + 'start' => isset($elem['attributes']['start']) ? DateTimeParser::parseDateTime($elem['attributes']['start']) : null, |
|
65 | + 'end' => isset($elem['attributes']['end']) ? DateTimeParser::parseDateTime($elem['attributes']['end']) : null, |
|
66 | + ]; |
|
67 | 67 | |
68 | - if (!$result['expand']['start'] || !$result['expand']['end']) { |
|
69 | - throw new BadRequest('The "start" and "end" attributes are required when expanding calendar-data'); |
|
70 | - } |
|
71 | - if ($result['expand']['end'] <= $result['expand']['start']) { |
|
72 | - throw new BadRequest('The end-date must be larger than the start-date when expanding calendar-data'); |
|
73 | - } |
|
74 | - break; |
|
75 | - } |
|
76 | - } |
|
68 | + if (!$result['expand']['start'] || !$result['expand']['end']) { |
|
69 | + throw new BadRequest('The "start" and "end" attributes are required when expanding calendar-data'); |
|
70 | + } |
|
71 | + if ($result['expand']['end'] <= $result['expand']['start']) { |
|
72 | + throw new BadRequest('The end-date must be larger than the start-date when expanding calendar-data'); |
|
73 | + } |
|
74 | + break; |
|
75 | + } |
|
76 | + } |
|
77 | 77 | |
78 | - return $result; |
|
79 | - } |
|
78 | + return $result; |
|
79 | + } |
|
80 | 80 | } |
@@ -25,96 +25,96 @@ |
||
25 | 25 | */ |
26 | 26 | class Invite implements XmlSerializable |
27 | 27 | { |
28 | - /** |
|
29 | - * The list of users a calendar has been shared to. |
|
30 | - * |
|
31 | - * @var Sharee[] |
|
32 | - */ |
|
33 | - protected $sharees; |
|
28 | + /** |
|
29 | + * The list of users a calendar has been shared to. |
|
30 | + * |
|
31 | + * @var Sharee[] |
|
32 | + */ |
|
33 | + protected $sharees; |
|
34 | 34 | |
35 | - /** |
|
36 | - * Creates the property. |
|
37 | - * |
|
38 | - * @param Sharee[] $sharees |
|
39 | - */ |
|
40 | - public function __construct(array $sharees) |
|
41 | - { |
|
42 | - $this->sharees = $sharees; |
|
43 | - } |
|
35 | + /** |
|
36 | + * Creates the property. |
|
37 | + * |
|
38 | + * @param Sharee[] $sharees |
|
39 | + */ |
|
40 | + public function __construct(array $sharees) |
|
41 | + { |
|
42 | + $this->sharees = $sharees; |
|
43 | + } |
|
44 | 44 | |
45 | - /** |
|
46 | - * Returns the list of users, as it was passed to the constructor. |
|
47 | - * |
|
48 | - * @return array |
|
49 | - */ |
|
50 | - public function getValue() |
|
51 | - { |
|
52 | - return $this->sharees; |
|
53 | - } |
|
45 | + /** |
|
46 | + * Returns the list of users, as it was passed to the constructor. |
|
47 | + * |
|
48 | + * @return array |
|
49 | + */ |
|
50 | + public function getValue() |
|
51 | + { |
|
52 | + return $this->sharees; |
|
53 | + } |
|
54 | 54 | |
55 | - /** |
|
56 | - * The xmlSerialize method is called during xml writing. |
|
57 | - * |
|
58 | - * Use the $writer argument to write its own xml serialization. |
|
59 | - * |
|
60 | - * An important note: do _not_ create a parent element. Any element |
|
61 | - * implementing XmlSerializable should only ever write what's considered |
|
62 | - * its 'inner xml'. |
|
63 | - * |
|
64 | - * The parent of the current element is responsible for writing a |
|
65 | - * containing element. |
|
66 | - * |
|
67 | - * This allows serializers to be re-used for different element names. |
|
68 | - * |
|
69 | - * If you are opening new elements, you must also close them again. |
|
70 | - */ |
|
71 | - public function xmlSerialize(Writer $writer) |
|
72 | - { |
|
73 | - $cs = '{'.Plugin::NS_CALENDARSERVER.'}'; |
|
55 | + /** |
|
56 | + * The xmlSerialize method is called during xml writing. |
|
57 | + * |
|
58 | + * Use the $writer argument to write its own xml serialization. |
|
59 | + * |
|
60 | + * An important note: do _not_ create a parent element. Any element |
|
61 | + * implementing XmlSerializable should only ever write what's considered |
|
62 | + * its 'inner xml'. |
|
63 | + * |
|
64 | + * The parent of the current element is responsible for writing a |
|
65 | + * containing element. |
|
66 | + * |
|
67 | + * This allows serializers to be re-used for different element names. |
|
68 | + * |
|
69 | + * If you are opening new elements, you must also close them again. |
|
70 | + */ |
|
71 | + public function xmlSerialize(Writer $writer) |
|
72 | + { |
|
73 | + $cs = '{'.Plugin::NS_CALENDARSERVER.'}'; |
|
74 | 74 | |
75 | - foreach ($this->sharees as $sharee) { |
|
76 | - if (DAV\Sharing\Plugin::ACCESS_SHAREDOWNER === $sharee->access) { |
|
77 | - $writer->startElement($cs.'organizer'); |
|
78 | - } else { |
|
79 | - $writer->startElement($cs.'user'); |
|
75 | + foreach ($this->sharees as $sharee) { |
|
76 | + if (DAV\Sharing\Plugin::ACCESS_SHAREDOWNER === $sharee->access) { |
|
77 | + $writer->startElement($cs.'organizer'); |
|
78 | + } else { |
|
79 | + $writer->startElement($cs.'user'); |
|
80 | 80 | |
81 | - switch ($sharee->inviteStatus) { |
|
82 | - case DAV\Sharing\Plugin::INVITE_ACCEPTED: |
|
83 | - $writer->writeElement($cs.'invite-accepted'); |
|
84 | - break; |
|
85 | - case DAV\Sharing\Plugin::INVITE_DECLINED: |
|
86 | - $writer->writeElement($cs.'invite-declined'); |
|
87 | - break; |
|
88 | - case DAV\Sharing\Plugin::INVITE_NORESPONSE: |
|
89 | - $writer->writeElement($cs.'invite-noresponse'); |
|
90 | - break; |
|
91 | - case DAV\Sharing\Plugin::INVITE_INVALID: |
|
92 | - $writer->writeElement($cs.'invite-invalid'); |
|
93 | - break; |
|
94 | - } |
|
81 | + switch ($sharee->inviteStatus) { |
|
82 | + case DAV\Sharing\Plugin::INVITE_ACCEPTED: |
|
83 | + $writer->writeElement($cs.'invite-accepted'); |
|
84 | + break; |
|
85 | + case DAV\Sharing\Plugin::INVITE_DECLINED: |
|
86 | + $writer->writeElement($cs.'invite-declined'); |
|
87 | + break; |
|
88 | + case DAV\Sharing\Plugin::INVITE_NORESPONSE: |
|
89 | + $writer->writeElement($cs.'invite-noresponse'); |
|
90 | + break; |
|
91 | + case DAV\Sharing\Plugin::INVITE_INVALID: |
|
92 | + $writer->writeElement($cs.'invite-invalid'); |
|
93 | + break; |
|
94 | + } |
|
95 | 95 | |
96 | - $writer->startElement($cs.'access'); |
|
97 | - switch ($sharee->access) { |
|
98 | - case DAV\Sharing\Plugin::ACCESS_READWRITE: |
|
99 | - $writer->writeElement($cs.'read-write'); |
|
100 | - break; |
|
101 | - case DAV\Sharing\Plugin::ACCESS_READ: |
|
102 | - $writer->writeElement($cs.'read'); |
|
103 | - break; |
|
104 | - } |
|
105 | - $writer->endElement(); // access |
|
106 | - } |
|
96 | + $writer->startElement($cs.'access'); |
|
97 | + switch ($sharee->access) { |
|
98 | + case DAV\Sharing\Plugin::ACCESS_READWRITE: |
|
99 | + $writer->writeElement($cs.'read-write'); |
|
100 | + break; |
|
101 | + case DAV\Sharing\Plugin::ACCESS_READ: |
|
102 | + $writer->writeElement($cs.'read'); |
|
103 | + break; |
|
104 | + } |
|
105 | + $writer->endElement(); // access |
|
106 | + } |
|
107 | 107 | |
108 | - $href = new DAV\Xml\Property\Href($sharee->href); |
|
109 | - $href->xmlSerialize($writer); |
|
108 | + $href = new DAV\Xml\Property\Href($sharee->href); |
|
109 | + $href->xmlSerialize($writer); |
|
110 | 110 | |
111 | - if (isset($sharee->properties['{DAV:}displayname'])) { |
|
112 | - $writer->writeElement($cs.'common-name', $sharee->properties['{DAV:}displayname']); |
|
113 | - } |
|
114 | - if ($sharee->comment) { |
|
115 | - $writer->writeElement($cs.'summary', $sharee->comment); |
|
116 | - } |
|
117 | - $writer->endElement(); // organizer or user |
|
118 | - } |
|
119 | - } |
|
111 | + if (isset($sharee->properties['{DAV:}displayname'])) { |
|
112 | + $writer->writeElement($cs.'common-name', $sharee->properties['{DAV:}displayname']); |
|
113 | + } |
|
114 | + if ($sharee->comment) { |
|
115 | + $writer->writeElement($cs.'summary', $sharee->comment); |
|
116 | + } |
|
117 | + $writer->endElement(); // organizer or user |
|
118 | + } |
|
119 | + } |
|
120 | 120 | } |
@@ -21,51 +21,51 @@ |
||
21 | 21 | */ |
22 | 22 | class EmailAddressSet implements XmlSerializable |
23 | 23 | { |
24 | - /** |
|
25 | - * emails. |
|
26 | - * |
|
27 | - * @var array |
|
28 | - */ |
|
29 | - private $emails; |
|
24 | + /** |
|
25 | + * emails. |
|
26 | + * |
|
27 | + * @var array |
|
28 | + */ |
|
29 | + private $emails; |
|
30 | 30 | |
31 | - /** |
|
32 | - * __construct. |
|
33 | - */ |
|
34 | - public function __construct(array $emails) |
|
35 | - { |
|
36 | - $this->emails = $emails; |
|
37 | - } |
|
31 | + /** |
|
32 | + * __construct. |
|
33 | + */ |
|
34 | + public function __construct(array $emails) |
|
35 | + { |
|
36 | + $this->emails = $emails; |
|
37 | + } |
|
38 | 38 | |
39 | - /** |
|
40 | - * Returns the email addresses. |
|
41 | - * |
|
42 | - * @return array |
|
43 | - */ |
|
44 | - public function getValue() |
|
45 | - { |
|
46 | - return $this->emails; |
|
47 | - } |
|
39 | + /** |
|
40 | + * Returns the email addresses. |
|
41 | + * |
|
42 | + * @return array |
|
43 | + */ |
|
44 | + public function getValue() |
|
45 | + { |
|
46 | + return $this->emails; |
|
47 | + } |
|
48 | 48 | |
49 | - /** |
|
50 | - * The xmlSerialize method is called during xml writing. |
|
51 | - * |
|
52 | - * Use the $writer argument to write its own xml serialization. |
|
53 | - * |
|
54 | - * An important note: do _not_ create a parent element. Any element |
|
55 | - * implementing XmlSerializable should only ever write what's considered |
|
56 | - * its 'inner xml'. |
|
57 | - * |
|
58 | - * The parent of the current element is responsible for writing a |
|
59 | - * containing element. |
|
60 | - * |
|
61 | - * This allows serializers to be re-used for different element names. |
|
62 | - * |
|
63 | - * If you are opening new elements, you must also close them again. |
|
64 | - */ |
|
65 | - public function xmlSerialize(Writer $writer) |
|
66 | - { |
|
67 | - foreach ($this->emails as $email) { |
|
68 | - $writer->writeElement('{http://calendarserver.org/ns/}email-address', $email); |
|
69 | - } |
|
70 | - } |
|
49 | + /** |
|
50 | + * The xmlSerialize method is called during xml writing. |
|
51 | + * |
|
52 | + * Use the $writer argument to write its own xml serialization. |
|
53 | + * |
|
54 | + * An important note: do _not_ create a parent element. Any element |
|
55 | + * implementing XmlSerializable should only ever write what's considered |
|
56 | + * its 'inner xml'. |
|
57 | + * |
|
58 | + * The parent of the current element is responsible for writing a |
|
59 | + * containing element. |
|
60 | + * |
|
61 | + * This allows serializers to be re-used for different element names. |
|
62 | + * |
|
63 | + * If you are opening new elements, you must also close them again. |
|
64 | + */ |
|
65 | + public function xmlSerialize(Writer $writer) |
|
66 | + { |
|
67 | + foreach ($this->emails as $email) { |
|
68 | + $writer->writeElement('{http://calendarserver.org/ns/}email-address', $email); |
|
69 | + } |
|
70 | + } |
|
71 | 71 | } |
@@ -28,97 +28,97 @@ |
||
28 | 28 | */ |
29 | 29 | class ScheduleCalendarTransp implements Element |
30 | 30 | { |
31 | - const TRANSPARENT = 'transparent'; |
|
32 | - const OPAQUE = 'opaque'; |
|
31 | + const TRANSPARENT = 'transparent'; |
|
32 | + const OPAQUE = 'opaque'; |
|
33 | 33 | |
34 | - /** |
|
35 | - * value. |
|
36 | - * |
|
37 | - * @var string |
|
38 | - */ |
|
39 | - protected $value; |
|
34 | + /** |
|
35 | + * value. |
|
36 | + * |
|
37 | + * @var string |
|
38 | + */ |
|
39 | + protected $value; |
|
40 | 40 | |
41 | - /** |
|
42 | - * Creates the property. |
|
43 | - * |
|
44 | - * @param string $value |
|
45 | - */ |
|
46 | - public function __construct($value) |
|
47 | - { |
|
48 | - if (self::TRANSPARENT !== $value && self::OPAQUE !== $value) { |
|
49 | - throw new \InvalidArgumentException('The value must either be specified as "transparent" or "opaque"'); |
|
50 | - } |
|
51 | - $this->value = $value; |
|
52 | - } |
|
41 | + /** |
|
42 | + * Creates the property. |
|
43 | + * |
|
44 | + * @param string $value |
|
45 | + */ |
|
46 | + public function __construct($value) |
|
47 | + { |
|
48 | + if (self::TRANSPARENT !== $value && self::OPAQUE !== $value) { |
|
49 | + throw new \InvalidArgumentException('The value must either be specified as "transparent" or "opaque"'); |
|
50 | + } |
|
51 | + $this->value = $value; |
|
52 | + } |
|
53 | 53 | |
54 | - /** |
|
55 | - * Returns the current value. |
|
56 | - * |
|
57 | - * @return string |
|
58 | - */ |
|
59 | - public function getValue() |
|
60 | - { |
|
61 | - return $this->value; |
|
62 | - } |
|
54 | + /** |
|
55 | + * Returns the current value. |
|
56 | + * |
|
57 | + * @return string |
|
58 | + */ |
|
59 | + public function getValue() |
|
60 | + { |
|
61 | + return $this->value; |
|
62 | + } |
|
63 | 63 | |
64 | - /** |
|
65 | - * The xmlSerialize method is called during xml writing. |
|
66 | - * |
|
67 | - * Use the $writer argument to write its own xml serialization. |
|
68 | - * |
|
69 | - * An important note: do _not_ create a parent element. Any element |
|
70 | - * implementing XmlSerializable should only ever write what's considered |
|
71 | - * its 'inner xml'. |
|
72 | - * |
|
73 | - * The parent of the current element is responsible for writing a |
|
74 | - * containing element. |
|
75 | - * |
|
76 | - * This allows serializers to be re-used for different element names. |
|
77 | - * |
|
78 | - * If you are opening new elements, you must also close them again. |
|
79 | - */ |
|
80 | - public function xmlSerialize(Writer $writer) |
|
81 | - { |
|
82 | - switch ($this->value) { |
|
83 | - case self::TRANSPARENT: |
|
84 | - $writer->writeElement('{'.Plugin::NS_CALDAV.'}transparent'); |
|
85 | - break; |
|
86 | - case self::OPAQUE: |
|
87 | - $writer->writeElement('{'.Plugin::NS_CALDAV.'}opaque'); |
|
88 | - break; |
|
89 | - } |
|
90 | - } |
|
64 | + /** |
|
65 | + * The xmlSerialize method is called during xml writing. |
|
66 | + * |
|
67 | + * Use the $writer argument to write its own xml serialization. |
|
68 | + * |
|
69 | + * An important note: do _not_ create a parent element. Any element |
|
70 | + * implementing XmlSerializable should only ever write what's considered |
|
71 | + * its 'inner xml'. |
|
72 | + * |
|
73 | + * The parent of the current element is responsible for writing a |
|
74 | + * containing element. |
|
75 | + * |
|
76 | + * This allows serializers to be re-used for different element names. |
|
77 | + * |
|
78 | + * If you are opening new elements, you must also close them again. |
|
79 | + */ |
|
80 | + public function xmlSerialize(Writer $writer) |
|
81 | + { |
|
82 | + switch ($this->value) { |
|
83 | + case self::TRANSPARENT: |
|
84 | + $writer->writeElement('{'.Plugin::NS_CALDAV.'}transparent'); |
|
85 | + break; |
|
86 | + case self::OPAQUE: |
|
87 | + $writer->writeElement('{'.Plugin::NS_CALDAV.'}opaque'); |
|
88 | + break; |
|
89 | + } |
|
90 | + } |
|
91 | 91 | |
92 | - /** |
|
93 | - * The deserialize method is called during xml parsing. |
|
94 | - * |
|
95 | - * This method is called statically, this is because in theory this method |
|
96 | - * may be used as a type of constructor, or factory method. |
|
97 | - * |
|
98 | - * Often you want to return an instance of the current class, but you are |
|
99 | - * free to return other data as well. |
|
100 | - * |
|
101 | - * You are responsible for advancing the reader to the next element. Not |
|
102 | - * doing anything will result in a never-ending loop. |
|
103 | - * |
|
104 | - * If you just want to skip parsing for this element altogether, you can |
|
105 | - * just call $reader->next(); |
|
106 | - * |
|
107 | - * $reader->parseInnerTree() will parse the entire sub-tree, and advance to |
|
108 | - * the next element. |
|
109 | - * |
|
110 | - * @return mixed |
|
111 | - */ |
|
112 | - public static function xmlDeserialize(Reader $reader) |
|
113 | - { |
|
114 | - $elems = Deserializer\enum($reader, Plugin::NS_CALDAV); |
|
92 | + /** |
|
93 | + * The deserialize method is called during xml parsing. |
|
94 | + * |
|
95 | + * This method is called statically, this is because in theory this method |
|
96 | + * may be used as a type of constructor, or factory method. |
|
97 | + * |
|
98 | + * Often you want to return an instance of the current class, but you are |
|
99 | + * free to return other data as well. |
|
100 | + * |
|
101 | + * You are responsible for advancing the reader to the next element. Not |
|
102 | + * doing anything will result in a never-ending loop. |
|
103 | + * |
|
104 | + * If you just want to skip parsing for this element altogether, you can |
|
105 | + * just call $reader->next(); |
|
106 | + * |
|
107 | + * $reader->parseInnerTree() will parse the entire sub-tree, and advance to |
|
108 | + * the next element. |
|
109 | + * |
|
110 | + * @return mixed |
|
111 | + */ |
|
112 | + public static function xmlDeserialize(Reader $reader) |
|
113 | + { |
|
114 | + $elems = Deserializer\enum($reader, Plugin::NS_CALDAV); |
|
115 | 115 | |
116 | - if (in_array('transparent', $elems)) { |
|
117 | - $value = self::TRANSPARENT; |
|
118 | - } else { |
|
119 | - $value = self::OPAQUE; |
|
120 | - } |
|
116 | + if (in_array('transparent', $elems)) { |
|
117 | + $value = self::TRANSPARENT; |
|
118 | + } else { |
|
119 | + $value = self::OPAQUE; |
|
120 | + } |
|
121 | 121 | |
122 | - return new self($value); |
|
123 | - } |
|
122 | + return new self($value); |
|
123 | + } |
|
124 | 124 | } |
@@ -23,32 +23,32 @@ |
||
23 | 23 | */ |
24 | 24 | class SupportedCollationSet implements XmlSerializable |
25 | 25 | { |
26 | - /** |
|
27 | - * The xmlSerialize method is called during xml writing. |
|
28 | - * |
|
29 | - * Use the $writer argument to write its own xml serialization. |
|
30 | - * |
|
31 | - * An important note: do _not_ create a parent element. Any element |
|
32 | - * implementing XmlSerializable should only ever write what's considered |
|
33 | - * its 'inner xml'. |
|
34 | - * |
|
35 | - * The parent of the current element is responsible for writing a |
|
36 | - * containing element. |
|
37 | - * |
|
38 | - * This allows serializers to be re-used for different element names. |
|
39 | - * |
|
40 | - * If you are opening new elements, you must also close them again. |
|
41 | - */ |
|
42 | - public function xmlSerialize(Writer $writer) |
|
43 | - { |
|
44 | - $collations = [ |
|
45 | - 'i;ascii-casemap', |
|
46 | - 'i;octet', |
|
47 | - 'i;unicode-casemap', |
|
48 | - ]; |
|
26 | + /** |
|
27 | + * The xmlSerialize method is called during xml writing. |
|
28 | + * |
|
29 | + * Use the $writer argument to write its own xml serialization. |
|
30 | + * |
|
31 | + * An important note: do _not_ create a parent element. Any element |
|
32 | + * implementing XmlSerializable should only ever write what's considered |
|
33 | + * its 'inner xml'. |
|
34 | + * |
|
35 | + * The parent of the current element is responsible for writing a |
|
36 | + * containing element. |
|
37 | + * |
|
38 | + * This allows serializers to be re-used for different element names. |
|
39 | + * |
|
40 | + * If you are opening new elements, you must also close them again. |
|
41 | + */ |
|
42 | + public function xmlSerialize(Writer $writer) |
|
43 | + { |
|
44 | + $collations = [ |
|
45 | + 'i;ascii-casemap', |
|
46 | + 'i;octet', |
|
47 | + 'i;unicode-casemap', |
|
48 | + ]; |
|
49 | 49 | |
50 | - foreach ($collations as $collation) { |
|
51 | - $writer->writeElement('{'.Plugin::NS_CALDAV.'}supported-collation', $collation); |
|
52 | - } |
|
53 | - } |
|
50 | + foreach ($collations as $collation) { |
|
51 | + $writer->writeElement('{'.Plugin::NS_CALDAV.'}supported-collation', $collation); |
|
52 | + } |
|
53 | + } |
|
54 | 54 | } |
@@ -24,34 +24,34 @@ |
||
24 | 24 | */ |
25 | 25 | class SupportedCalendarData implements XmlSerializable |
26 | 26 | { |
27 | - /** |
|
28 | - * The xmlSerialize method is called during xml writing. |
|
29 | - * |
|
30 | - * Use the $writer argument to write its own xml serialization. |
|
31 | - * |
|
32 | - * An important note: do _not_ create a parent element. Any element |
|
33 | - * implementing XmlSerializable should only ever write what's considered |
|
34 | - * its 'inner xml'. |
|
35 | - * |
|
36 | - * The parent of the current element is responsible for writing a |
|
37 | - * containing element. |
|
38 | - * |
|
39 | - * This allows serializers to be re-used for different element names. |
|
40 | - * |
|
41 | - * If you are opening new elements, you must also close them again. |
|
42 | - */ |
|
43 | - public function xmlSerialize(Writer $writer) |
|
44 | - { |
|
45 | - $writer->startElement('{'.Plugin::NS_CALDAV.'}calendar-data'); |
|
46 | - $writer->writeAttributes([ |
|
47 | - 'content-type' => 'text/calendar', |
|
48 | - 'version' => '2.0', |
|
49 | - ]); |
|
50 | - $writer->endElement(); // calendar-data |
|
51 | - $writer->startElement('{'.Plugin::NS_CALDAV.'}calendar-data'); |
|
52 | - $writer->writeAttributes([ |
|
53 | - 'content-type' => 'application/calendar+json', |
|
54 | - ]); |
|
55 | - $writer->endElement(); // calendar-data |
|
56 | - } |
|
27 | + /** |
|
28 | + * The xmlSerialize method is called during xml writing. |
|
29 | + * |
|
30 | + * Use the $writer argument to write its own xml serialization. |
|
31 | + * |
|
32 | + * An important note: do _not_ create a parent element. Any element |
|
33 | + * implementing XmlSerializable should only ever write what's considered |
|
34 | + * its 'inner xml'. |
|
35 | + * |
|
36 | + * The parent of the current element is responsible for writing a |
|
37 | + * containing element. |
|
38 | + * |
|
39 | + * This allows serializers to be re-used for different element names. |
|
40 | + * |
|
41 | + * If you are opening new elements, you must also close them again. |
|
42 | + */ |
|
43 | + public function xmlSerialize(Writer $writer) |
|
44 | + { |
|
45 | + $writer->startElement('{'.Plugin::NS_CALDAV.'}calendar-data'); |
|
46 | + $writer->writeAttributes([ |
|
47 | + 'content-type' => 'text/calendar', |
|
48 | + 'version' => '2.0', |
|
49 | + ]); |
|
50 | + $writer->endElement(); // calendar-data |
|
51 | + $writer->startElement('{'.Plugin::NS_CALDAV.'}calendar-data'); |
|
52 | + $writer->writeAttributes([ |
|
53 | + 'content-type' => 'application/calendar+json', |
|
54 | + ]); |
|
55 | + $writer->endElement(); // calendar-data |
|
56 | + } |
|
57 | 57 | } |
@@ -25,94 +25,94 @@ |
||
25 | 25 | */ |
26 | 26 | class SupportedCalendarComponentSet implements Element |
27 | 27 | { |
28 | - /** |
|
29 | - * List of supported components. |
|
30 | - * |
|
31 | - * This array will contain values such as VEVENT, VTODO and VJOURNAL. |
|
32 | - * |
|
33 | - * @var array |
|
34 | - */ |
|
35 | - protected $components = []; |
|
28 | + /** |
|
29 | + * List of supported components. |
|
30 | + * |
|
31 | + * This array will contain values such as VEVENT, VTODO and VJOURNAL. |
|
32 | + * |
|
33 | + * @var array |
|
34 | + */ |
|
35 | + protected $components = []; |
|
36 | 36 | |
37 | - /** |
|
38 | - * Creates the property. |
|
39 | - */ |
|
40 | - public function __construct(array $components) |
|
41 | - { |
|
42 | - $this->components = $components; |
|
43 | - } |
|
37 | + /** |
|
38 | + * Creates the property. |
|
39 | + */ |
|
40 | + public function __construct(array $components) |
|
41 | + { |
|
42 | + $this->components = $components; |
|
43 | + } |
|
44 | 44 | |
45 | - /** |
|
46 | - * Returns the list of supported components. |
|
47 | - * |
|
48 | - * @return array |
|
49 | - */ |
|
50 | - public function getValue() |
|
51 | - { |
|
52 | - return $this->components; |
|
53 | - } |
|
45 | + /** |
|
46 | + * Returns the list of supported components. |
|
47 | + * |
|
48 | + * @return array |
|
49 | + */ |
|
50 | + public function getValue() |
|
51 | + { |
|
52 | + return $this->components; |
|
53 | + } |
|
54 | 54 | |
55 | - /** |
|
56 | - * The xmlSerialize method is called during xml writing. |
|
57 | - * |
|
58 | - * Use the $writer argument to write its own xml serialization. |
|
59 | - * |
|
60 | - * An important note: do _not_ create a parent element. Any element |
|
61 | - * implementing XmlSerializable should only ever write what's considered |
|
62 | - * its 'inner xml'. |
|
63 | - * |
|
64 | - * The parent of the current element is responsible for writing a |
|
65 | - * containing element. |
|
66 | - * |
|
67 | - * This allows serializers to be re-used for different element names. |
|
68 | - * |
|
69 | - * If you are opening new elements, you must also close them again. |
|
70 | - */ |
|
71 | - public function xmlSerialize(Writer $writer) |
|
72 | - { |
|
73 | - foreach ($this->components as $component) { |
|
74 | - $writer->startElement('{'.Plugin::NS_CALDAV.'}comp'); |
|
75 | - $writer->writeAttributes(['name' => $component]); |
|
76 | - $writer->endElement(); |
|
77 | - } |
|
78 | - } |
|
55 | + /** |
|
56 | + * The xmlSerialize method is called during xml writing. |
|
57 | + * |
|
58 | + * Use the $writer argument to write its own xml serialization. |
|
59 | + * |
|
60 | + * An important note: do _not_ create a parent element. Any element |
|
61 | + * implementing XmlSerializable should only ever write what's considered |
|
62 | + * its 'inner xml'. |
|
63 | + * |
|
64 | + * The parent of the current element is responsible for writing a |
|
65 | + * containing element. |
|
66 | + * |
|
67 | + * This allows serializers to be re-used for different element names. |
|
68 | + * |
|
69 | + * If you are opening new elements, you must also close them again. |
|
70 | + */ |
|
71 | + public function xmlSerialize(Writer $writer) |
|
72 | + { |
|
73 | + foreach ($this->components as $component) { |
|
74 | + $writer->startElement('{'.Plugin::NS_CALDAV.'}comp'); |
|
75 | + $writer->writeAttributes(['name' => $component]); |
|
76 | + $writer->endElement(); |
|
77 | + } |
|
78 | + } |
|
79 | 79 | |
80 | - /** |
|
81 | - * The deserialize method is called during xml parsing. |
|
82 | - * |
|
83 | - * This method is called statically, this is because in theory this method |
|
84 | - * may be used as a type of constructor, or factory method. |
|
85 | - * |
|
86 | - * Often you want to return an instance of the current class, but you are |
|
87 | - * free to return other data as well. |
|
88 | - * |
|
89 | - * You are responsible for advancing the reader to the next element. Not |
|
90 | - * doing anything will result in a never-ending loop. |
|
91 | - * |
|
92 | - * If you just want to skip parsing for this element altogether, you can |
|
93 | - * just call $reader->next(); |
|
94 | - * |
|
95 | - * $reader->parseInnerTree() will parse the entire sub-tree, and advance to |
|
96 | - * the next element. |
|
97 | - * |
|
98 | - * @return mixed |
|
99 | - */ |
|
100 | - public static function xmlDeserialize(Reader $reader) |
|
101 | - { |
|
102 | - $elems = $reader->parseInnerTree(); |
|
80 | + /** |
|
81 | + * The deserialize method is called during xml parsing. |
|
82 | + * |
|
83 | + * This method is called statically, this is because in theory this method |
|
84 | + * may be used as a type of constructor, or factory method. |
|
85 | + * |
|
86 | + * Often you want to return an instance of the current class, but you are |
|
87 | + * free to return other data as well. |
|
88 | + * |
|
89 | + * You are responsible for advancing the reader to the next element. Not |
|
90 | + * doing anything will result in a never-ending loop. |
|
91 | + * |
|
92 | + * If you just want to skip parsing for this element altogether, you can |
|
93 | + * just call $reader->next(); |
|
94 | + * |
|
95 | + * $reader->parseInnerTree() will parse the entire sub-tree, and advance to |
|
96 | + * the next element. |
|
97 | + * |
|
98 | + * @return mixed |
|
99 | + */ |
|
100 | + public static function xmlDeserialize(Reader $reader) |
|
101 | + { |
|
102 | + $elems = $reader->parseInnerTree(); |
|
103 | 103 | |
104 | - $components = []; |
|
104 | + $components = []; |
|
105 | 105 | |
106 | - foreach ((array) $elems as $elem) { |
|
107 | - if ($elem['name'] === '{'.Plugin::NS_CALDAV.'}comp') { |
|
108 | - $components[] = $elem['attributes']['name']; |
|
109 | - } |
|
110 | - } |
|
106 | + foreach ((array) $elems as $elem) { |
|
107 | + if ($elem['name'] === '{'.Plugin::NS_CALDAV.'}comp') { |
|
108 | + $components[] = $elem['attributes']['name']; |
|
109 | + } |
|
110 | + } |
|
111 | 111 | |
112 | - if (!$components) { |
|
113 | - throw new ParseException('supported-calendar-component-set must have at least one CALDAV:comp element'); |
|
114 | - } |
|
112 | + if (!$components) { |
|
113 | + throw new ParseException('supported-calendar-component-set must have at least one CALDAV:comp element'); |
|
114 | + } |
|
115 | 115 | |
116 | - return new self($components); |
|
117 | - } |
|
116 | + return new self($components); |
|
117 | + } |
|
118 | 118 | } |