Completed
Push — developer ( e65ba3...d7bfd9 )
by Błażej
478:46 queued 446:35
created
libraries/SabreDAV/CalDAV/Xml/Notification/SystemStatus.php 2 patches
Unused Use Statements   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,8 +2,8 @@
 block discarded – undo
2 2
 
3 3
 namespace Sabre\CalDAV\Xml\Notification;
4 4
 
5
-use Sabre\Xml\Writer;
6 5
 use Sabre\CalDAV\Plugin;
6
+use Sabre\Xml\Writer;
7 7
 
8 8
 /**
9 9
  * SystemStatus notification
Please login to merge, or discard this patch.
Indentation   +153 added lines, -153 removed lines patch added patch discarded remove patch
@@ -17,166 +17,166 @@
 block discarded – undo
17 17
  */
18 18
 class SystemStatus implements NotificationInterface {
19 19
 
20
-    const TYPE_LOW = 1;
21
-    const TYPE_MEDIUM = 2;
22
-    const TYPE_HIGH = 3;
23
-
24
-    /**
25
-     * A unique id
26
-     *
27
-     * @var string
28
-     */
29
-    protected $id;
30
-
31
-    /**
32
-     * The type of alert. This should be one of the TYPE_ constants.
33
-     *
34
-     * @var int
35
-     */
36
-    protected $type;
37
-
38
-    /**
39
-     * A human-readable description of the problem.
40
-     *
41
-     * @var string
42
-     */
43
-    protected $description;
44
-
45
-    /**
46
-     * A url to a website with more information for the user.
47
-     *
48
-     * @var string
49
-     */
50
-    protected $href;
51
-
52
-    /**
53
-     * Notification Etag
54
-     *
55
-     * @var string
56
-     */
57
-    protected $etag;
58
-
59
-    /**
60
-     * Creates the notification.
61
-     *
62
-     * Some kind of unique id should be provided. This is used to generate a
63
-     * url.
64
-     *
65
-     * @param string $id
66
-     * @param string $etag
67
-     * @param int $type
68
-     * @param string $description
69
-     * @param string $href
70
-     */
71
-    public function __construct($id, $etag, $type = self::TYPE_HIGH, $description = null, $href = null) {
72
-
73
-        $this->id = $id;
74
-        $this->type = $type;
75
-        $this->description = $description;
76
-        $this->href = $href;
77
-        $this->etag = $etag;
78
-
79
-    }
80
-
81
-    /**
82
-     * The serialize method is called during xml writing.
83
-     *
84
-     * It should use the $writer argument to encode this object into XML.
85
-     *
86
-     * Important note: it is not needed to create the parent element. The
87
-     * parent element is already created, and we only have to worry about
88
-     * attributes, child elements and text (if any).
89
-     *
90
-     * Important note 2: If you are writing any new elements, you are also
91
-     * responsible for closing them.
92
-     *
93
-     * @param Writer $writer
94
-     * @return void
95
-     */
96
-    public function xmlSerialize(Writer $writer) {
97
-
98
-        switch ($this->type) {
99
-            case self::TYPE_LOW :
100
-                $type = 'low';
101
-                break;
102
-            case self::TYPE_MEDIUM :
103
-                $type = 'medium';
104
-                break;
105
-            default :
106
-            case self::TYPE_HIGH :
107
-                $type = 'high';
108
-                break;
109
-        }
110
-
111
-        $writer->startElement('{' . Plugin::NS_CALENDARSERVER . '}systemstatus');
112
-        $writer->writeAttribute('type', $type);
113
-        $writer->endElement();
114
-
115
-    }
116
-
117
-    /**
118
-     * This method serializes the entire notification, as it is used in the
119
-     * response body.
120
-     *
121
-     * @param Writer $writer
122
-     * @return void
123
-     */
124
-    public function xmlSerializeFull(Writer $writer) {
125
-
126
-        $cs = '{' . Plugin::NS_CALENDARSERVER . '}';
127
-        switch ($this->type) {
128
-            case self::TYPE_LOW :
129
-                $type = 'low';
130
-                break;
131
-            case self::TYPE_MEDIUM :
132
-                $type = 'medium';
133
-                break;
134
-            default :
135
-            case self::TYPE_HIGH :
136
-                $type = 'high';
137
-                break;
138
-        }
139
-
140
-        $writer->startElement($cs . 'systemstatus');
141
-        $writer->writeAttribute('type', $type);
142
-
143
-
144
-        if ($this->description) {
145
-            $writer->writeElement($cs . 'description', $this->description);
146
-        }
147
-        if ($this->href) {
148
-            $writer->writeElement('{DAV:}href', $this->href);
149
-        }
150
-
151
-        $writer->endElement(); // systemstatus
152
-
153
-    }
154
-
155
-    /**
156
-     * Returns a unique id for this notification
157
-     *
158
-     * This is just the base url. This should generally be some kind of unique
159
-     * id.
160
-     *
161
-     * @return string
162
-     */
163
-    public function getId() {
164
-
165
-        return $this->id;
166
-
167
-    }
168
-
169
-    /*
20
+	const TYPE_LOW = 1;
21
+	const TYPE_MEDIUM = 2;
22
+	const TYPE_HIGH = 3;
23
+
24
+	/**
25
+	 * A unique id
26
+	 *
27
+	 * @var string
28
+	 */
29
+	protected $id;
30
+
31
+	/**
32
+	 * The type of alert. This should be one of the TYPE_ constants.
33
+	 *
34
+	 * @var int
35
+	 */
36
+	protected $type;
37
+
38
+	/**
39
+	 * A human-readable description of the problem.
40
+	 *
41
+	 * @var string
42
+	 */
43
+	protected $description;
44
+
45
+	/**
46
+	 * A url to a website with more information for the user.
47
+	 *
48
+	 * @var string
49
+	 */
50
+	protected $href;
51
+
52
+	/**
53
+	 * Notification Etag
54
+	 *
55
+	 * @var string
56
+	 */
57
+	protected $etag;
58
+
59
+	/**
60
+	 * Creates the notification.
61
+	 *
62
+	 * Some kind of unique id should be provided. This is used to generate a
63
+	 * url.
64
+	 *
65
+	 * @param string $id
66
+	 * @param string $etag
67
+	 * @param int $type
68
+	 * @param string $description
69
+	 * @param string $href
70
+	 */
71
+	public function __construct($id, $etag, $type = self::TYPE_HIGH, $description = null, $href = null) {
72
+
73
+		$this->id = $id;
74
+		$this->type = $type;
75
+		$this->description = $description;
76
+		$this->href = $href;
77
+		$this->etag = $etag;
78
+
79
+	}
80
+
81
+	/**
82
+	 * The serialize method is called during xml writing.
83
+	 *
84
+	 * It should use the $writer argument to encode this object into XML.
85
+	 *
86
+	 * Important note: it is not needed to create the parent element. The
87
+	 * parent element is already created, and we only have to worry about
88
+	 * attributes, child elements and text (if any).
89
+	 *
90
+	 * Important note 2: If you are writing any new elements, you are also
91
+	 * responsible for closing them.
92
+	 *
93
+	 * @param Writer $writer
94
+	 * @return void
95
+	 */
96
+	public function xmlSerialize(Writer $writer) {
97
+
98
+		switch ($this->type) {
99
+			case self::TYPE_LOW :
100
+				$type = 'low';
101
+				break;
102
+			case self::TYPE_MEDIUM :
103
+				$type = 'medium';
104
+				break;
105
+			default :
106
+			case self::TYPE_HIGH :
107
+				$type = 'high';
108
+				break;
109
+		}
110
+
111
+		$writer->startElement('{' . Plugin::NS_CALENDARSERVER . '}systemstatus');
112
+		$writer->writeAttribute('type', $type);
113
+		$writer->endElement();
114
+
115
+	}
116
+
117
+	/**
118
+	 * This method serializes the entire notification, as it is used in the
119
+	 * response body.
120
+	 *
121
+	 * @param Writer $writer
122
+	 * @return void
123
+	 */
124
+	public function xmlSerializeFull(Writer $writer) {
125
+
126
+		$cs = '{' . Plugin::NS_CALENDARSERVER . '}';
127
+		switch ($this->type) {
128
+			case self::TYPE_LOW :
129
+				$type = 'low';
130
+				break;
131
+			case self::TYPE_MEDIUM :
132
+				$type = 'medium';
133
+				break;
134
+			default :
135
+			case self::TYPE_HIGH :
136
+				$type = 'high';
137
+				break;
138
+		}
139
+
140
+		$writer->startElement($cs . 'systemstatus');
141
+		$writer->writeAttribute('type', $type);
142
+
143
+
144
+		if ($this->description) {
145
+			$writer->writeElement($cs . 'description', $this->description);
146
+		}
147
+		if ($this->href) {
148
+			$writer->writeElement('{DAV:}href', $this->href);
149
+		}
150
+
151
+		$writer->endElement(); // systemstatus
152
+
153
+	}
154
+
155
+	/**
156
+	 * Returns a unique id for this notification
157
+	 *
158
+	 * This is just the base url. This should generally be some kind of unique
159
+	 * id.
160
+	 *
161
+	 * @return string
162
+	 */
163
+	public function getId() {
164
+
165
+		return $this->id;
166
+
167
+	}
168
+
169
+	/*
170 170
      * Returns the ETag for this notification.
171 171
      *
172 172
      * The ETag must be surrounded by literal double-quotes.
173 173
      *
174 174
      * @return string
175 175
      */
176
-    public function getETag() {
176
+	public function getETag() {
177 177
 
178
-        return $this->etag;
178
+		return $this->etag;
179 179
 
180
-    }
180
+	}
181 181
 
182 182
 }
Please login to merge, or discard this patch.
libraries/SabreDAV/CalDAV/Xml/Property/AllowedSharingModes.php 2 patches
Unused Use Statements   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -2,9 +2,9 @@
 block discarded – undo
2 2
 
3 3
 namespace Sabre\CalDAV\Xml\Property;
4 4
 
5
-use Sabre\Xml\XmlSerializable;
6
-use Sabre\Xml\Writer;
7 5
 use Sabre\CalDAV\Plugin;
6
+use Sabre\Xml\Writer;
7
+use Sabre\Xml\XmlSerializable;
8 8
 
9 9
 /**
10 10
  * AllowedSharingModes
Please login to merge, or discard this patch.
Indentation   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -24,63 +24,63 @@
 block discarded – undo
24 24
  */
25 25
 class AllowedSharingModes implements XmlSerializable {
26 26
 
27
-    /**
28
-     * Whether or not a calendar can be shared with another user
29
-     *
30
-     * @var bool
31
-     */
32
-    protected $canBeShared;
27
+	/**
28
+	 * Whether or not a calendar can be shared with another user
29
+	 *
30
+	 * @var bool
31
+	 */
32
+	protected $canBeShared;
33 33
 
34
-    /**
35
-     * Whether or not the calendar can be placed on a public url.
36
-     *
37
-     * @var bool
38
-     */
39
-    protected $canBePublished;
34
+	/**
35
+	 * Whether or not the calendar can be placed on a public url.
36
+	 *
37
+	 * @var bool
38
+	 */
39
+	protected $canBePublished;
40 40
 
41
-    /**
42
-     * Constructor
43
-     *
44
-     * @param bool $canBeShared
45
-     * @param bool $canBePublished
46
-     * @return void
47
-     */
48
-    public function __construct($canBeShared, $canBePublished) {
41
+	/**
42
+	 * Constructor
43
+	 *
44
+	 * @param bool $canBeShared
45
+	 * @param bool $canBePublished
46
+	 * @return void
47
+	 */
48
+	public function __construct($canBeShared, $canBePublished) {
49 49
 
50
-        $this->canBeShared = $canBeShared;
51
-        $this->canBePublished = $canBePublished;
50
+		$this->canBeShared = $canBeShared;
51
+		$this->canBePublished = $canBePublished;
52 52
 
53
-    }
53
+	}
54 54
 
55
-    /**
56
-     * The xmlSerialize metod 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 XmlSerializble 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
-     * @param Writer $writer
72
-     * @return void
73
-     */
74
-    public function xmlSerialize(Writer $writer) {
55
+	/**
56
+	 * The xmlSerialize metod 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 XmlSerializble 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
+	 * @param Writer $writer
72
+	 * @return void
73
+	 */
74
+	public function xmlSerialize(Writer $writer) {
75 75
 
76
-        if ($this->canBeShared) {
77
-            $writer->writeElement('{' . Plugin::NS_CALENDARSERVER . '}can-be-shared');
78
-        }
79
-        if ($this->canBePublished) {
80
-            $writer->writeElement('{' . Plugin::NS_CALENDARSERVER . '}can-be-published');
81
-        }
76
+		if ($this->canBeShared) {
77
+			$writer->writeElement('{' . Plugin::NS_CALENDARSERVER . '}can-be-shared');
78
+		}
79
+		if ($this->canBePublished) {
80
+			$writer->writeElement('{' . Plugin::NS_CALENDARSERVER . '}can-be-published');
81
+		}
82 82
 
83
-    }
83
+	}
84 84
 
85 85
 
86 86
 
Please login to merge, or discard this patch.
libraries/SabreDAV/CalDAV/Xml/Property/Invite.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -182,7 +182,7 @@
 block discarded – undo
182 182
      * the next element.
183 183
      *
184 184
      * @param Reader $reader
185
-     * @return mixed
185
+     * @return Invite
186 186
      */
187 187
     static function xmlDeserialize(Reader $reader) {
188 188
 
Please login to merge, or discard this patch.
Unused Use Statements   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -2,11 +2,11 @@
 block discarded – undo
2 2
 
3 3
 namespace Sabre\CalDAV\Xml\Property;
4 4
 
5
+use Sabre\CalDAV\Plugin;
6
+use Sabre\CalDAV\SharingPlugin;
5 7
 use Sabre\Xml\Element;
6 8
 use Sabre\Xml\Reader;
7 9
 use Sabre\Xml\Writer;
8
-use Sabre\CalDAV\Plugin;
9
-use Sabre\CalDAV\SharingPlugin;
10 10
 
11 11
 /**
12 12
  * Invite property
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -192,8 +192,9 @@
 block discarded – undo
192 192
 
193 193
         foreach ($reader->parseInnerTree() as $elem) {
194 194
 
195
-            if ($elem['name'] !== $cs . 'user')
196
-                continue;
195
+            if ($elem['name'] !== $cs . 'user') {
196
+                            continue;
197
+            }
197 198
 
198 199
             $user = [
199 200
                 'href'       => null,
Please login to merge, or discard this patch.
Indentation   +227 added lines, -227 removed lines patch added patch discarded remove patch
@@ -22,231 +22,231 @@
 block discarded – undo
22 22
  */
23 23
 class Invite implements Element {
24 24
 
25
-    /**
26
-     * The list of users a calendar has been shared to.
27
-     *
28
-     * @var array
29
-     */
30
-    protected $users;
31
-
32
-    /**
33
-     * The organizer contains information about the person who shared the
34
-     * object.
35
-     *
36
-     * @var array
37
-     */
38
-    protected $organizer;
39
-
40
-    /**
41
-     * Creates the property.
42
-     *
43
-     * Users is an array. Each element of the array has the following
44
-     * properties:
45
-     *
46
-     *   * href - Often a mailto: address
47
-     *   * commonName - Optional, for example a first and lastname for a user.
48
-     *   * status - One of the SharingPlugin::STATUS_* constants.
49
-     *   * readOnly - true or false
50
-     *   * summary - Optional, description of the share
51
-     *
52
-     * The organizer key is optional to specify. It's only useful when a
53
-     * 'sharee' requests the sharing information.
54
-     *
55
-     * The organizer may have the following properties:
56
-     *   * href - Often a mailto: address.
57
-     *   * commonName - Optional human-readable name.
58
-     *   * firstName - Optional first name.
59
-     *   * lastName - Optional last name.
60
-     *
61
-     * If you wonder why these two structures are so different, I guess a
62
-     * valid answer is that the current spec is still a draft.
63
-     *
64
-     * @param array $users
65
-     */
66
-    public function __construct(array $users, array $organizer = null) {
67
-
68
-        $this->users = $users;
69
-        $this->organizer = $organizer;
70
-
71
-    }
72
-
73
-    /**
74
-     * Returns the list of users, as it was passed to the constructor.
75
-     *
76
-     * @return array
77
-     */
78
-    public function getValue() {
79
-
80
-        return $this->users;
81
-
82
-    }
83
-
84
-    /**
85
-     * The xmlSerialize metod is called during xml writing.
86
-     *
87
-     * Use the $writer argument to write its own xml serialization.
88
-     *
89
-     * An important note: do _not_ create a parent element. Any element
90
-     * implementing XmlSerializble should only ever write what's considered
91
-     * its 'inner xml'.
92
-     *
93
-     * The parent of the current element is responsible for writing a
94
-     * containing element.
95
-     *
96
-     * This allows serializers to be re-used for different element names.
97
-     *
98
-     * If you are opening new elements, you must also close them again.
99
-     *
100
-     * @param Writer $writer
101
-     * @return void
102
-     */
103
-    public function xmlSerialize(Writer $writer) {
104
-
105
-        $cs = '{' . Plugin::NS_CALENDARSERVER . '}';
106
-
107
-        if (!is_null($this->organizer)) {
108
-
109
-            $writer->startElement($cs . 'organizer');
110
-            $writer->writeElement('{DAV:}href', $this->organizer['href']);
111
-
112
-            if (isset($this->organizer['commonName']) && $this->organizer['commonName']) {
113
-                $writer->writeElement($cs . 'common-name', $this->organizer['commonName']);
114
-            }
115
-            if (isset($this->organizer['firstName']) && $this->organizer['firstName']) {
116
-                $writer->writeElement($cs . 'first-name', $this->organizer['firstName']);
117
-            }
118
-            if (isset($this->organizer['lastName']) && $this->organizer['lastName']) {
119
-                $writer->writeElement($cs . 'last-name', $this->organizer['lastName']);
120
-            }
121
-            $writer->endElement(); // organizer
122
-
123
-        }
124
-
125
-        foreach ($this->users as $user) {
126
-
127
-            $writer->startElement($cs . 'user');
128
-            $writer->writeElement('{DAV:}href', $user['href']);
129
-            if (isset($user['commonName']) && $user['commonName']) {
130
-                $writer->writeElement($cs . 'common-name', $user['commonName']);
131
-            }
132
-            switch ($user['status']) {
133
-
134
-                case SharingPlugin::STATUS_ACCEPTED :
135
-                    $writer->writeElement($cs . 'invite-accepted');
136
-                    break;
137
-                case SharingPlugin::STATUS_DECLINED :
138
-                    $writer->writeElement($cs . 'invite-declined');
139
-                    break;
140
-                case SharingPlugin::STATUS_NORESPONSE :
141
-                    $writer->writeElement($cs . 'invite-noresponse');
142
-                    break;
143
-                case SharingPlugin::STATUS_INVALID :
144
-                    $writer->writeElement($cs . 'invite-invalid');
145
-                    break;
146
-            }
147
-
148
-            $writer->startElement($cs . 'access');
149
-            if ($user['readOnly']) {
150
-                $writer->writeElement($cs . 'read');
151
-            } else {
152
-                $writer->writeElement($cs . 'read-write');
153
-            }
154
-            $writer->endElement(); // access
155
-
156
-            if (isset($user['summary']) && $user['summary']) {
157
-                $writer->writeElement($cs . 'summary', $user['summary']);
158
-            }
159
-
160
-            $writer->endElement(); //user
161
-
162
-        }
163
-
164
-    }
165
-
166
-    /**
167
-     * The deserialize method is called during xml parsing.
168
-     *
169
-     * This method is called statictly, this is because in theory this method
170
-     * may be used as a type of constructor, or factory method.
171
-     *
172
-     * Often you want to return an instance of the current class, but you are
173
-     * free to return other data as well.
174
-     *
175
-     * You are responsible for advancing the reader to the next element. Not
176
-     * doing anything will result in a never-ending loop.
177
-     *
178
-     * If you just want to skip parsing for this element altogether, you can
179
-     * just call $reader->next();
180
-     *
181
-     * $reader->parseInnerTree() will parse the entire sub-tree, and advance to
182
-     * the next element.
183
-     *
184
-     * @param Reader $reader
185
-     * @return mixed
186
-     */
187
-    static function xmlDeserialize(Reader $reader) {
188
-
189
-        $cs = '{' . Plugin::NS_CALENDARSERVER . '}';
190
-
191
-        $users = [];
192
-
193
-        foreach ($reader->parseInnerTree() as $elem) {
194
-
195
-            if ($elem['name'] !== $cs . 'user')
196
-                continue;
197
-
198
-            $user = [
199
-                'href'       => null,
200
-                'commonName' => null,
201
-                'readOnly'   => null,
202
-                'summary'    => null,
203
-                'status'     => null,
204
-            ];
205
-
206
-            foreach ($elem['value'] as $userElem) {
207
-
208
-                switch ($userElem['name']) {
209
-                    case $cs . 'invite-accepted' :
210
-                        $user['status'] = SharingPlugin::STATUS_ACCEPTED;
211
-                        break;
212
-                    case $cs . 'invite-declined' :
213
-                        $user['status'] = SharingPlugin::STATUS_DECLINED;
214
-                        break;
215
-                    case $cs . 'invite-noresponse' :
216
-                        $user['status'] = SharingPlugin::STATUS_NORESPONSE;
217
-                        break;
218
-                    case $cs . 'invite-invalid' :
219
-                        $user['status'] = SharingPlugin::STATUS_INVALID;
220
-                        break;
221
-                    case '{DAV:}href' :
222
-                        $user['href'] = $userElem['value'];
223
-                        break;
224
-                    case $cs . 'common-name' :
225
-                        $user['commonName'] = $userElem['value'];
226
-                        break;
227
-                    case $cs . 'access' :
228
-                        foreach ($userElem['value'] as $accessHref) {
229
-                            if ($accessHref['name'] === $cs . 'read') {
230
-                                $user['readOnly'] = true;
231
-                            }
232
-                        }
233
-                        break;
234
-                    case $cs . 'summary' :
235
-                        $user['summary'] = $userElem['value'];
236
-                        break;
237
-
238
-                }
239
-
240
-            }
241
-            if (!$user['status']) {
242
-                throw new \InvalidArgumentException('Every user must have one of cs:invite-accepted, cs:invite-declined, cs:invite-noresponse or cs:invite-invalid');
243
-            }
244
-
245
-            $users[] = $user;
246
-
247
-        }
248
-
249
-        return new self($users);
250
-
251
-    }
25
+	/**
26
+	 * The list of users a calendar has been shared to.
27
+	 *
28
+	 * @var array
29
+	 */
30
+	protected $users;
31
+
32
+	/**
33
+	 * The organizer contains information about the person who shared the
34
+	 * object.
35
+	 *
36
+	 * @var array
37
+	 */
38
+	protected $organizer;
39
+
40
+	/**
41
+	 * Creates the property.
42
+	 *
43
+	 * Users is an array. Each element of the array has the following
44
+	 * properties:
45
+	 *
46
+	 *   * href - Often a mailto: address
47
+	 *   * commonName - Optional, for example a first and lastname for a user.
48
+	 *   * status - One of the SharingPlugin::STATUS_* constants.
49
+	 *   * readOnly - true or false
50
+	 *   * summary - Optional, description of the share
51
+	 *
52
+	 * The organizer key is optional to specify. It's only useful when a
53
+	 * 'sharee' requests the sharing information.
54
+	 *
55
+	 * The organizer may have the following properties:
56
+	 *   * href - Often a mailto: address.
57
+	 *   * commonName - Optional human-readable name.
58
+	 *   * firstName - Optional first name.
59
+	 *   * lastName - Optional last name.
60
+	 *
61
+	 * If you wonder why these two structures are so different, I guess a
62
+	 * valid answer is that the current spec is still a draft.
63
+	 *
64
+	 * @param array $users
65
+	 */
66
+	public function __construct(array $users, array $organizer = null) {
67
+
68
+		$this->users = $users;
69
+		$this->organizer = $organizer;
70
+
71
+	}
72
+
73
+	/**
74
+	 * Returns the list of users, as it was passed to the constructor.
75
+	 *
76
+	 * @return array
77
+	 */
78
+	public function getValue() {
79
+
80
+		return $this->users;
81
+
82
+	}
83
+
84
+	/**
85
+	 * The xmlSerialize metod is called during xml writing.
86
+	 *
87
+	 * Use the $writer argument to write its own xml serialization.
88
+	 *
89
+	 * An important note: do _not_ create a parent element. Any element
90
+	 * implementing XmlSerializble should only ever write what's considered
91
+	 * its 'inner xml'.
92
+	 *
93
+	 * The parent of the current element is responsible for writing a
94
+	 * containing element.
95
+	 *
96
+	 * This allows serializers to be re-used for different element names.
97
+	 *
98
+	 * If you are opening new elements, you must also close them again.
99
+	 *
100
+	 * @param Writer $writer
101
+	 * @return void
102
+	 */
103
+	public function xmlSerialize(Writer $writer) {
104
+
105
+		$cs = '{' . Plugin::NS_CALENDARSERVER . '}';
106
+
107
+		if (!is_null($this->organizer)) {
108
+
109
+			$writer->startElement($cs . 'organizer');
110
+			$writer->writeElement('{DAV:}href', $this->organizer['href']);
111
+
112
+			if (isset($this->organizer['commonName']) && $this->organizer['commonName']) {
113
+				$writer->writeElement($cs . 'common-name', $this->organizer['commonName']);
114
+			}
115
+			if (isset($this->organizer['firstName']) && $this->organizer['firstName']) {
116
+				$writer->writeElement($cs . 'first-name', $this->organizer['firstName']);
117
+			}
118
+			if (isset($this->organizer['lastName']) && $this->organizer['lastName']) {
119
+				$writer->writeElement($cs . 'last-name', $this->organizer['lastName']);
120
+			}
121
+			$writer->endElement(); // organizer
122
+
123
+		}
124
+
125
+		foreach ($this->users as $user) {
126
+
127
+			$writer->startElement($cs . 'user');
128
+			$writer->writeElement('{DAV:}href', $user['href']);
129
+			if (isset($user['commonName']) && $user['commonName']) {
130
+				$writer->writeElement($cs . 'common-name', $user['commonName']);
131
+			}
132
+			switch ($user['status']) {
133
+
134
+				case SharingPlugin::STATUS_ACCEPTED :
135
+					$writer->writeElement($cs . 'invite-accepted');
136
+					break;
137
+				case SharingPlugin::STATUS_DECLINED :
138
+					$writer->writeElement($cs . 'invite-declined');
139
+					break;
140
+				case SharingPlugin::STATUS_NORESPONSE :
141
+					$writer->writeElement($cs . 'invite-noresponse');
142
+					break;
143
+				case SharingPlugin::STATUS_INVALID :
144
+					$writer->writeElement($cs . 'invite-invalid');
145
+					break;
146
+			}
147
+
148
+			$writer->startElement($cs . 'access');
149
+			if ($user['readOnly']) {
150
+				$writer->writeElement($cs . 'read');
151
+			} else {
152
+				$writer->writeElement($cs . 'read-write');
153
+			}
154
+			$writer->endElement(); // access
155
+
156
+			if (isset($user['summary']) && $user['summary']) {
157
+				$writer->writeElement($cs . 'summary', $user['summary']);
158
+			}
159
+
160
+			$writer->endElement(); //user
161
+
162
+		}
163
+
164
+	}
165
+
166
+	/**
167
+	 * The deserialize method is called during xml parsing.
168
+	 *
169
+	 * This method is called statictly, this is because in theory this method
170
+	 * may be used as a type of constructor, or factory method.
171
+	 *
172
+	 * Often you want to return an instance of the current class, but you are
173
+	 * free to return other data as well.
174
+	 *
175
+	 * You are responsible for advancing the reader to the next element. Not
176
+	 * doing anything will result in a never-ending loop.
177
+	 *
178
+	 * If you just want to skip parsing for this element altogether, you can
179
+	 * just call $reader->next();
180
+	 *
181
+	 * $reader->parseInnerTree() will parse the entire sub-tree, and advance to
182
+	 * the next element.
183
+	 *
184
+	 * @param Reader $reader
185
+	 * @return mixed
186
+	 */
187
+	static function xmlDeserialize(Reader $reader) {
188
+
189
+		$cs = '{' . Plugin::NS_CALENDARSERVER . '}';
190
+
191
+		$users = [];
192
+
193
+		foreach ($reader->parseInnerTree() as $elem) {
194
+
195
+			if ($elem['name'] !== $cs . 'user')
196
+				continue;
197
+
198
+			$user = [
199
+				'href'       => null,
200
+				'commonName' => null,
201
+				'readOnly'   => null,
202
+				'summary'    => null,
203
+				'status'     => null,
204
+			];
205
+
206
+			foreach ($elem['value'] as $userElem) {
207
+
208
+				switch ($userElem['name']) {
209
+					case $cs . 'invite-accepted' :
210
+						$user['status'] = SharingPlugin::STATUS_ACCEPTED;
211
+						break;
212
+					case $cs . 'invite-declined' :
213
+						$user['status'] = SharingPlugin::STATUS_DECLINED;
214
+						break;
215
+					case $cs . 'invite-noresponse' :
216
+						$user['status'] = SharingPlugin::STATUS_NORESPONSE;
217
+						break;
218
+					case $cs . 'invite-invalid' :
219
+						$user['status'] = SharingPlugin::STATUS_INVALID;
220
+						break;
221
+					case '{DAV:}href' :
222
+						$user['href'] = $userElem['value'];
223
+						break;
224
+					case $cs . 'common-name' :
225
+						$user['commonName'] = $userElem['value'];
226
+						break;
227
+					case $cs . 'access' :
228
+						foreach ($userElem['value'] as $accessHref) {
229
+							if ($accessHref['name'] === $cs . 'read') {
230
+								$user['readOnly'] = true;
231
+							}
232
+						}
233
+						break;
234
+					case $cs . 'summary' :
235
+						$user['summary'] = $userElem['value'];
236
+						break;
237
+
238
+				}
239
+
240
+			}
241
+			if (!$user['status']) {
242
+				throw new \InvalidArgumentException('Every user must have one of cs:invite-accepted, cs:invite-declined, cs:invite-noresponse or cs:invite-invalid');
243
+			}
244
+
245
+			$users[] = $user;
246
+
247
+		}
248
+
249
+		return new self($users);
250
+
251
+	}
252 252
 }
Please login to merge, or discard this patch.
libraries/SabreDAV/CalDAV/Xml/Property/ScheduleCalendarTransp.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -112,7 +112,7 @@
 block discarded – undo
112 112
      * the next element.
113 113
      *
114 114
      * @param Reader $reader
115
-     * @return mixed
115
+     * @return null|ScheduleCalendarTransp
116 116
      */
117 117
     static function xmlDeserialize(Reader $reader) {
118 118
 
Please login to merge, or discard this patch.
Unused Use Statements   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -2,11 +2,11 @@
 block discarded – undo
2 2
 
3 3
 namespace Sabre\CalDAV\Xml\Property;
4 4
 
5
+use Sabre\CalDAV\Plugin;
5 6
 use Sabre\Xml\Element;
7
+use Sabre\Xml\Element\Elements;
6 8
 use Sabre\Xml\Reader;
7 9
 use Sabre\Xml\Writer;
8
-use Sabre\Xml\Element\Elements;
9
-use Sabre\CalDAV\Plugin;
10 10
 
11 11
 /**
12 12
  * schedule-calendar-transp property.
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -130,8 +130,9 @@
 block discarded – undo
130 130
                     break;
131 131
             }
132 132
         }
133
-        if (is_null($value))
134
-           return null;
133
+        if (is_null($value)) {
134
+                   return null;
135
+        }
135 136
 
136 137
         return new self($value);
137 138
 
Please login to merge, or discard this patch.
Indentation   +110 added lines, -110 removed lines patch added patch discarded remove patch
@@ -26,115 +26,115 @@
 block discarded – undo
26 26
  */
27 27
 class ScheduleCalendarTransp implements Element {
28 28
 
29
-    const TRANSPARENT = 'transparent';
30
-    const OPAQUE = 'opaque';
31
-
32
-    /**
33
-     * value
34
-     *
35
-     * @var string
36
-     */
37
-    protected $value;
38
-
39
-    /**
40
-     * Creates the property
41
-     *
42
-     * @param string $value
43
-     */
44
-    public function __construct($value) {
45
-
46
-        if ($value !== self::TRANSPARENT && $value !== self::OPAQUE) {
47
-            throw new \InvalidArgumentException('The value must either be specified as "transparent" or "opaque"');
48
-        }
49
-        $this->value = $value;
50
-
51
-    }
52
-
53
-    /**
54
-     * Returns the current value
55
-     *
56
-     * @return string
57
-     */
58
-    public function getValue() {
59
-
60
-        return $this->value;
61
-
62
-    }
63
-
64
-    /**
65
-     * The xmlSerialize metod 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 XmlSerializble 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
-     * @param Writer $writer
81
-     * @return void
82
-     */
83
-    public function xmlSerialize(Writer $writer) {
84
-
85
-        switch ($this->value) {
86
-            case self::TRANSPARENT :
87
-                $writer->writeElement('{' . Plugin::NS_CALDAV . '}transparent');
88
-                break;
89
-            case self::OPAQUE :
90
-                $writer->writeElement('{' . Plugin::NS_CALDAV . '}opaque');
91
-                break;
92
-        }
93
-
94
-    }
95
-
96
-    /**
97
-     * The deserialize method is called during xml parsing.
98
-     *
99
-     * This method is called statictly, this is because in theory this method
100
-     * may be used as a type of constructor, or factory method.
101
-     *
102
-     * Often you want to return an instance of the current class, but you are
103
-     * free to return other data as well.
104
-     *
105
-     * You are responsible for advancing the reader to the next element. Not
106
-     * doing anything will result in a never-ending loop.
107
-     *
108
-     * If you just want to skip parsing for this element altogether, you can
109
-     * just call $reader->next();
110
-     *
111
-     * $reader->parseInnerTree() will parse the entire sub-tree, and advance to
112
-     * the next element.
113
-     *
114
-     * @param Reader $reader
115
-     * @return mixed
116
-     */
117
-    static function xmlDeserialize(Reader $reader) {
118
-
119
-        $elems = Elements::xmlDeserialize($reader);
120
-
121
-        $value = null;
122
-
123
-        foreach ($elems as $elem) {
124
-            switch ($elem) {
125
-                case '{' . Plugin::NS_CALDAV . '}opaque' :
126
-                    $value = self::OPAQUE;
127
-                    break;
128
-                case '{' . Plugin::NS_CALDAV . '}transparent' :
129
-                    $value = self::TRANSPARENT;
130
-                    break;
131
-            }
132
-        }
133
-        if (is_null($value))
134
-           return null;
135
-
136
-        return new self($value);
137
-
138
-    }
29
+	const TRANSPARENT = 'transparent';
30
+	const OPAQUE = 'opaque';
31
+
32
+	/**
33
+	 * value
34
+	 *
35
+	 * @var string
36
+	 */
37
+	protected $value;
38
+
39
+	/**
40
+	 * Creates the property
41
+	 *
42
+	 * @param string $value
43
+	 */
44
+	public function __construct($value) {
45
+
46
+		if ($value !== self::TRANSPARENT && $value !== self::OPAQUE) {
47
+			throw new \InvalidArgumentException('The value must either be specified as "transparent" or "opaque"');
48
+		}
49
+		$this->value = $value;
50
+
51
+	}
52
+
53
+	/**
54
+	 * Returns the current value
55
+	 *
56
+	 * @return string
57
+	 */
58
+	public function getValue() {
59
+
60
+		return $this->value;
61
+
62
+	}
63
+
64
+	/**
65
+	 * The xmlSerialize metod 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 XmlSerializble 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
+	 * @param Writer $writer
81
+	 * @return void
82
+	 */
83
+	public function xmlSerialize(Writer $writer) {
84
+
85
+		switch ($this->value) {
86
+			case self::TRANSPARENT :
87
+				$writer->writeElement('{' . Plugin::NS_CALDAV . '}transparent');
88
+				break;
89
+			case self::OPAQUE :
90
+				$writer->writeElement('{' . Plugin::NS_CALDAV . '}opaque');
91
+				break;
92
+		}
93
+
94
+	}
95
+
96
+	/**
97
+	 * The deserialize method is called during xml parsing.
98
+	 *
99
+	 * This method is called statictly, this is because in theory this method
100
+	 * may be used as a type of constructor, or factory method.
101
+	 *
102
+	 * Often you want to return an instance of the current class, but you are
103
+	 * free to return other data as well.
104
+	 *
105
+	 * You are responsible for advancing the reader to the next element. Not
106
+	 * doing anything will result in a never-ending loop.
107
+	 *
108
+	 * If you just want to skip parsing for this element altogether, you can
109
+	 * just call $reader->next();
110
+	 *
111
+	 * $reader->parseInnerTree() will parse the entire sub-tree, and advance to
112
+	 * the next element.
113
+	 *
114
+	 * @param Reader $reader
115
+	 * @return mixed
116
+	 */
117
+	static function xmlDeserialize(Reader $reader) {
118
+
119
+		$elems = Elements::xmlDeserialize($reader);
120
+
121
+		$value = null;
122
+
123
+		foreach ($elems as $elem) {
124
+			switch ($elem) {
125
+				case '{' . Plugin::NS_CALDAV . '}opaque' :
126
+					$value = self::OPAQUE;
127
+					break;
128
+				case '{' . Plugin::NS_CALDAV . '}transparent' :
129
+					$value = self::TRANSPARENT;
130
+					break;
131
+			}
132
+		}
133
+		if (is_null($value))
134
+		   return null;
135
+
136
+		return new self($value);
137
+
138
+	}
139 139
 
140 140
 }
Please login to merge, or discard this patch.
libraries/SabreDAV/CalDAV/Xml/Property/SupportedCalendarComponentSet.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -104,7 +104,7 @@
 block discarded – undo
104 104
      * the next element.
105 105
      *
106 106
      * @param Reader $reader
107
-     * @return mixed
107
+     * @return SupportedCalendarComponentSet
108 108
      */
109 109
     static function xmlDeserialize(Reader $reader) {
110 110
 
Please login to merge, or discard this patch.
Unused Use Statements   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,11 +2,11 @@
 block discarded – undo
2 2
 
3 3
 namespace Sabre\CalDAV\Xml\Property;
4 4
 
5
+use Sabre\CalDAV\Plugin;
5 6
 use Sabre\Xml\Element;
6 7
 use Sabre\Xml\ParseException;
7 8
 use Sabre\Xml\Reader;
8 9
 use Sabre\Xml\Writer;
9
-use Sabre\CalDAV\Plugin;
10 10
 
11 11
 /**
12 12
  * SupportedCalendarComponentSet property.
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -112,7 +112,7 @@
 block discarded – undo
112 112
 
113 113
         $components = [];
114 114
 
115
-        foreach ((array)$elems as $elem) {
115
+        foreach ((array) $elems as $elem) {
116 116
             if ($elem['name'] === '{' . Plugin::NS_CALDAV . '}comp') {
117 117
                 $components[] = $elem['attributes']['name'];
118 118
             }
Please login to merge, or discard this patch.
Indentation   +102 added lines, -102 removed lines patch added patch discarded remove patch
@@ -23,107 +23,107 @@
 block discarded – undo
23 23
  */
24 24
 class SupportedCalendarComponentSet implements Element {
25 25
 
26
-    /**
27
-     * List of supported components.
28
-     *
29
-     * This array will contain values such as VEVENT, VTODO and VJOURNAL.
30
-     *
31
-     * @var array
32
-     */
33
-    protected $components = [];
34
-
35
-    /**
36
-     * Creates the property.
37
-     *
38
-     * @param array $components
39
-     */
40
-    public function __construct(array $components) {
41
-
42
-        $this->components = $components;
43
-
44
-    }
45
-
46
-    /**
47
-     * Returns the list of supported components
48
-     *
49
-     * @return array
50
-     */
51
-    public function getValue() {
52
-
53
-        return $this->components;
54
-
55
-    }
56
-
57
-    /**
58
-     * The xmlSerialize metod is called during xml writing.
59
-     *
60
-     * Use the $writer argument to write its own xml serialization.
61
-     *
62
-     * An important note: do _not_ create a parent element. Any element
63
-     * implementing XmlSerializble should only ever write what's considered
64
-     * its 'inner xml'.
65
-     *
66
-     * The parent of the current element is responsible for writing a
67
-     * containing element.
68
-     *
69
-     * This allows serializers to be re-used for different element names.
70
-     *
71
-     * If you are opening new elements, you must also close them again.
72
-     *
73
-     * @param Writer $writer
74
-     * @return void
75
-     */
76
-    public function xmlSerialize(Writer $writer) {
77
-
78
-        foreach ($this->components as $component) {
79
-
80
-            $writer->startElement('{' . Plugin::NS_CALDAV . '}comp');
81
-            $writer->writeAttributes(['name' => $component]);
82
-            $writer->endElement();
83
-
84
-        }
85
-
86
-    }
87
-
88
-    /**
89
-     * The deserialize method is called during xml parsing.
90
-     *
91
-     * This method is called statictly, this is because in theory this method
92
-     * may be used as a type of constructor, or factory method.
93
-     *
94
-     * Often you want to return an instance of the current class, but you are
95
-     * free to return other data as well.
96
-     *
97
-     * You are responsible for advancing the reader to the next element. Not
98
-     * doing anything will result in a never-ending loop.
99
-     *
100
-     * If you just want to skip parsing for this element altogether, you can
101
-     * just call $reader->next();
102
-     *
103
-     * $reader->parseInnerTree() will parse the entire sub-tree, and advance to
104
-     * the next element.
105
-     *
106
-     * @param Reader $reader
107
-     * @return mixed
108
-     */
109
-    static function xmlDeserialize(Reader $reader) {
110
-
111
-        $elems = $reader->parseInnerTree();
112
-
113
-        $components = [];
114
-
115
-        foreach ((array)$elems as $elem) {
116
-            if ($elem['name'] === '{' . Plugin::NS_CALDAV . '}comp') {
117
-                $components[] = $elem['attributes']['name'];
118
-            }
119
-        }
120
-
121
-        if (!$components) {
122
-            throw new ParseException('supported-calendar-component-set must have at least one CALDAV:comp element');
123
-        }
124
-
125
-        return new self($components);
126
-
127
-    }
26
+	/**
27
+	 * List of supported components.
28
+	 *
29
+	 * This array will contain values such as VEVENT, VTODO and VJOURNAL.
30
+	 *
31
+	 * @var array
32
+	 */
33
+	protected $components = [];
34
+
35
+	/**
36
+	 * Creates the property.
37
+	 *
38
+	 * @param array $components
39
+	 */
40
+	public function __construct(array $components) {
41
+
42
+		$this->components = $components;
43
+
44
+	}
45
+
46
+	/**
47
+	 * Returns the list of supported components
48
+	 *
49
+	 * @return array
50
+	 */
51
+	public function getValue() {
52
+
53
+		return $this->components;
54
+
55
+	}
56
+
57
+	/**
58
+	 * The xmlSerialize metod is called during xml writing.
59
+	 *
60
+	 * Use the $writer argument to write its own xml serialization.
61
+	 *
62
+	 * An important note: do _not_ create a parent element. Any element
63
+	 * implementing XmlSerializble should only ever write what's considered
64
+	 * its 'inner xml'.
65
+	 *
66
+	 * The parent of the current element is responsible for writing a
67
+	 * containing element.
68
+	 *
69
+	 * This allows serializers to be re-used for different element names.
70
+	 *
71
+	 * If you are opening new elements, you must also close them again.
72
+	 *
73
+	 * @param Writer $writer
74
+	 * @return void
75
+	 */
76
+	public function xmlSerialize(Writer $writer) {
77
+
78
+		foreach ($this->components as $component) {
79
+
80
+			$writer->startElement('{' . Plugin::NS_CALDAV . '}comp');
81
+			$writer->writeAttributes(['name' => $component]);
82
+			$writer->endElement();
83
+
84
+		}
85
+
86
+	}
87
+
88
+	/**
89
+	 * The deserialize method is called during xml parsing.
90
+	 *
91
+	 * This method is called statictly, this is because in theory this method
92
+	 * may be used as a type of constructor, or factory method.
93
+	 *
94
+	 * Often you want to return an instance of the current class, but you are
95
+	 * free to return other data as well.
96
+	 *
97
+	 * You are responsible for advancing the reader to the next element. Not
98
+	 * doing anything will result in a never-ending loop.
99
+	 *
100
+	 * If you just want to skip parsing for this element altogether, you can
101
+	 * just call $reader->next();
102
+	 *
103
+	 * $reader->parseInnerTree() will parse the entire sub-tree, and advance to
104
+	 * the next element.
105
+	 *
106
+	 * @param Reader $reader
107
+	 * @return mixed
108
+	 */
109
+	static function xmlDeserialize(Reader $reader) {
110
+
111
+		$elems = $reader->parseInnerTree();
112
+
113
+		$components = [];
114
+
115
+		foreach ((array)$elems as $elem) {
116
+			if ($elem['name'] === '{' . Plugin::NS_CALDAV . '}comp') {
117
+				$components[] = $elem['attributes']['name'];
118
+			}
119
+		}
120
+
121
+		if (!$components) {
122
+			throw new ParseException('supported-calendar-component-set must have at least one CALDAV:comp element');
123
+		}
124
+
125
+		return new self($components);
126
+
127
+	}
128 128
 
129 129
 }
Please login to merge, or discard this patch.
libraries/SabreDAV/CalDAV/Xml/Request/CalendarMultiGetReport.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -80,7 +80,7 @@
 block discarded – undo
80 80
      * the next element.
81 81
      *
82 82
      * @param Reader $reader
83
-     * @return mixed
83
+     * @return CalendarMultiGetReport
84 84
      */
85 85
     static function xmlDeserialize(Reader $reader) {
86 86
 
Please login to merge, or discard this patch.
Unused Use Statements   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -2,10 +2,10 @@
 block discarded – undo
2 2
 
3 3
 namespace Sabre\CalDAV\Xml\Request;
4 4
 
5
-use Sabre\Xml\XmlDeserializable;
6
-use Sabre\Xml\Reader;
7 5
 use Sabre\CalDAV\Plugin;
8 6
 use Sabre\Uri;
7
+use Sabre\Xml\Reader;
8
+use Sabre\Xml\XmlDeserializable;
9 9
 
10 10
 /**
11 11
  * CalendarMultiGetReport request parser.
Please login to merge, or discard this patch.
Indentation   +99 added lines, -99 removed lines patch added patch discarded remove patch
@@ -21,104 +21,104 @@
 block discarded – undo
21 21
  */
22 22
 class CalendarMultiGetReport implements XmlDeserializable {
23 23
 
24
-    /**
25
-     * An array with requested properties.
26
-     *
27
-     * @var array
28
-     */
29
-    public $properties;
30
-
31
-    /**
32
-     * This is an array with the urls that are being requested.
33
-     *
34
-     * @var array
35
-     */
36
-    public $hrefs;
37
-
38
-    /**
39
-     * If the calendar data must be expanded, this will contain an array with 2
40
-     * elements: start and end.
41
-     *
42
-     * Each may be a DateTime or null.
43
-     *
44
-     * @var array|null
45
-     */
46
-    public $expand = null;
47
-
48
-    /**
49
-     * The mimetype of the content that should be returend. Usually
50
-     * text/calendar.
51
-     *
52
-     * @var string
53
-     */
54
-    public $contentType = null;
55
-
56
-    /**
57
-     * The version of calendar-data that should be returned. Usually '2.0',
58
-     * referring to iCalendar 2.0.
59
-     *
60
-     * @var string
61
-     */
62
-    public $version = null;
63
-
64
-    /**
65
-     * The deserialize method is called during xml parsing.
66
-     *
67
-     * This method is called statictly, 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
-     * @param Reader $reader
83
-     * @return mixed
84
-     */
85
-    static function xmlDeserialize(Reader $reader) {
86
-
87
-        $elems = $reader->parseInnerTree([
88
-            '{urn:ietf:params:xml:ns:caldav}calendar-data' => 'Sabre\\CalDAV\\Xml\\Filter\\CalendarData',
89
-            '{DAV:}prop'                                   => 'Sabre\\Xml\\Element\\KeyValue',
90
-        ]);
91
-
92
-        $newProps = [
93
-            'hrefs'      => [],
94
-            'properties' => [],
95
-        ];
96
-
97
-        foreach ($elems as $elem) {
98
-
99
-            switch ($elem['name']) {
100
-
101
-                case '{DAV:}prop' :
102
-                    $newProps['properties'] = array_keys($elem['value']);
103
-                    if (isset($elem['value']['{' . Plugin::NS_CALDAV . '}calendar-data'])) {
104
-                        $newProps += $elem['value']['{' . Plugin::NS_CALDAV . '}calendar-data'];
105
-                    }
106
-                    break;
107
-                case '{DAV:}href' :
108
-                    $newProps['hrefs'][] = Uri\resolve($reader->contextUri, $elem['value']);
109
-                    break;
110
-
111
-            }
112
-
113
-        }
114
-
115
-        $obj = new self();
116
-        foreach ($newProps as $key => $value) {
117
-            $obj->$key = $value;
118
-        }
119
-
120
-        return $obj;
121
-
122
-    }
24
+	/**
25
+	 * An array with requested properties.
26
+	 *
27
+	 * @var array
28
+	 */
29
+	public $properties;
30
+
31
+	/**
32
+	 * This is an array with the urls that are being requested.
33
+	 *
34
+	 * @var array
35
+	 */
36
+	public $hrefs;
37
+
38
+	/**
39
+	 * If the calendar data must be expanded, this will contain an array with 2
40
+	 * elements: start and end.
41
+	 *
42
+	 * Each may be a DateTime or null.
43
+	 *
44
+	 * @var array|null
45
+	 */
46
+	public $expand = null;
47
+
48
+	/**
49
+	 * The mimetype of the content that should be returend. Usually
50
+	 * text/calendar.
51
+	 *
52
+	 * @var string
53
+	 */
54
+	public $contentType = null;
55
+
56
+	/**
57
+	 * The version of calendar-data that should be returned. Usually '2.0',
58
+	 * referring to iCalendar 2.0.
59
+	 *
60
+	 * @var string
61
+	 */
62
+	public $version = null;
63
+
64
+	/**
65
+	 * The deserialize method is called during xml parsing.
66
+	 *
67
+	 * This method is called statictly, 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
+	 * @param Reader $reader
83
+	 * @return mixed
84
+	 */
85
+	static function xmlDeserialize(Reader $reader) {
86
+
87
+		$elems = $reader->parseInnerTree([
88
+			'{urn:ietf:params:xml:ns:caldav}calendar-data' => 'Sabre\\CalDAV\\Xml\\Filter\\CalendarData',
89
+			'{DAV:}prop'                                   => 'Sabre\\Xml\\Element\\KeyValue',
90
+		]);
91
+
92
+		$newProps = [
93
+			'hrefs'      => [],
94
+			'properties' => [],
95
+		];
96
+
97
+		foreach ($elems as $elem) {
98
+
99
+			switch ($elem['name']) {
100
+
101
+				case '{DAV:}prop' :
102
+					$newProps['properties'] = array_keys($elem['value']);
103
+					if (isset($elem['value']['{' . Plugin::NS_CALDAV . '}calendar-data'])) {
104
+						$newProps += $elem['value']['{' . Plugin::NS_CALDAV . '}calendar-data'];
105
+					}
106
+					break;
107
+				case '{DAV:}href' :
108
+					$newProps['hrefs'][] = Uri\resolve($reader->contextUri, $elem['value']);
109
+					break;
110
+
111
+			}
112
+
113
+		}
114
+
115
+		$obj = new self();
116
+		foreach ($newProps as $key => $value) {
117
+			$obj->$key = $value;
118
+		}
119
+
120
+		return $obj;
121
+
122
+	}
123 123
 
124 124
 }
Please login to merge, or discard this patch.
libraries/SabreDAV/CalDAV/Xml/Request/CalendarQueryReport.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -80,7 +80,7 @@
 block discarded – undo
80 80
      * the next element.
81 81
      *
82 82
      * @param Reader $reader
83
-     * @return mixed
83
+     * @return CalendarQueryReport
84 84
      */
85 85
     static function xmlDeserialize(Reader $reader) {
86 86
 
Please login to merge, or discard this patch.
Unused Use Statements   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -2,10 +2,10 @@
 block discarded – undo
2 2
 
3 3
 namespace Sabre\CalDAV\Xml\Request;
4 4
 
5
-use Sabre\Xml\XmlDeserializable;
6
-use Sabre\Xml\Reader;
7
-use Sabre\DAV\Exception\BadRequest;
8 5
 use Sabre\CalDAV\Plugin;
6
+use Sabre\DAV\Exception\BadRequest;
7
+use Sabre\Xml\Reader;
8
+use Sabre\Xml\XmlDeserializable;
9 9
 
10 10
 /**
11 11
  * CalendarQueryReport request parser.
Please login to merge, or discard this patch.
Indentation   +114 added lines, -114 removed lines patch added patch discarded remove patch
@@ -21,119 +21,119 @@
 block discarded – undo
21 21
  */
22 22
 class CalendarQueryReport implements XmlDeserializable {
23 23
 
24
-    /**
25
-     * An array with requested properties.
26
-     *
27
-     * @var array
28
-     */
29
-    public $properties;
30
-
31
-    /**
32
-     * List of property/component filters.
33
-     *
34
-     * @var array
35
-     */
36
-    public $filters;
37
-
38
-    /**
39
-     * If the calendar data must be expanded, this will contain an array with 2
40
-     * elements: start and end.
41
-     *
42
-     * Each may be a DateTime or null.
43
-     *
44
-     * @var array|null
45
-     */
46
-    public $expand = null;
47
-
48
-    /**
49
-     * The mimetype of the content that should be returend. Usually
50
-     * text/calendar.
51
-     *
52
-     * @var string
53
-     */
54
-    public $contentType = null;
55
-
56
-    /**
57
-     * The version of calendar-data that should be returned. Usually '2.0',
58
-     * referring to iCalendar 2.0.
59
-     *
60
-     * @var string
61
-     */
62
-    public $version = null;
63
-
64
-    /**
65
-     * The deserialize method is called during xml parsing.
66
-     *
67
-     * This method is called statictly, 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
-     * @param Reader $reader
83
-     * @return mixed
84
-     */
85
-    static function xmlDeserialize(Reader $reader) {
86
-
87
-        $elems = $reader->parseInnerTree([
88
-            '{urn:ietf:params:xml:ns:caldav}comp-filter'   => 'Sabre\\CalDAV\\Xml\\Filter\\CompFilter',
89
-            '{urn:ietf:params:xml:ns:caldav}prop-filter'   => 'Sabre\\CalDAV\\Xml\\Filter\\PropFilter',
90
-            '{urn:ietf:params:xml:ns:caldav}param-filter'  => 'Sabre\\CalDAV\\Xml\\Filter\\ParamFilter',
91
-            '{urn:ietf:params:xml:ns:caldav}calendar-data' => 'Sabre\\CalDAV\\Xml\\Filter\\CalendarData',
92
-            '{DAV:}prop'                                   => 'Sabre\\Xml\\Element\\KeyValue',
93
-        ]);
94
-
95
-        $newProps = [
96
-            'filters'    => null,
97
-            'properties' => [],
98
-        ];
99
-
100
-        if (!is_array($elems)) $elems = [];
101
-
102
-        foreach ($elems as $elem) {
103
-
104
-            switch ($elem['name']) {
105
-
106
-                case '{DAV:}prop' :
107
-                    $newProps['properties'] = array_keys($elem['value']);
108
-                    if (isset($elem['value']['{' . Plugin::NS_CALDAV . '}calendar-data'])) {
109
-                        $newProps += $elem['value']['{' . Plugin::NS_CALDAV . '}calendar-data'];
110
-                    }
111
-                    break;
112
-                case '{' . Plugin::NS_CALDAV . '}filter' :
113
-                    foreach ($elem['value'] as $subElem) {
114
-                        if ($subElem['name'] === '{' . Plugin::NS_CALDAV . '}comp-filter') {
115
-                            if (!is_null($newProps['filters'])) {
116
-                                throw new BadRequest('Only one top-level comp-filter may be defined');
117
-                            }
118
-                            $newProps['filters'] = $subElem['value'];
119
-                        }
120
-                    }
121
-                    break;
122
-
123
-            }
124
-
125
-        }
126
-
127
-        if (is_null($newProps['filters'])) {
128
-            throw new BadRequest('The {' . Plugin::NS_CALDAV . '}filter element is required for this request');
129
-        }
130
-
131
-        $obj = new self();
132
-        foreach ($newProps as $key => $value) {
133
-            $obj->$key = $value;
134
-        }
135
-        return $obj;
136
-
137
-    }
24
+	/**
25
+	 * An array with requested properties.
26
+	 *
27
+	 * @var array
28
+	 */
29
+	public $properties;
30
+
31
+	/**
32
+	 * List of property/component filters.
33
+	 *
34
+	 * @var array
35
+	 */
36
+	public $filters;
37
+
38
+	/**
39
+	 * If the calendar data must be expanded, this will contain an array with 2
40
+	 * elements: start and end.
41
+	 *
42
+	 * Each may be a DateTime or null.
43
+	 *
44
+	 * @var array|null
45
+	 */
46
+	public $expand = null;
47
+
48
+	/**
49
+	 * The mimetype of the content that should be returend. Usually
50
+	 * text/calendar.
51
+	 *
52
+	 * @var string
53
+	 */
54
+	public $contentType = null;
55
+
56
+	/**
57
+	 * The version of calendar-data that should be returned. Usually '2.0',
58
+	 * referring to iCalendar 2.0.
59
+	 *
60
+	 * @var string
61
+	 */
62
+	public $version = null;
63
+
64
+	/**
65
+	 * The deserialize method is called during xml parsing.
66
+	 *
67
+	 * This method is called statictly, 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
+	 * @param Reader $reader
83
+	 * @return mixed
84
+	 */
85
+	static function xmlDeserialize(Reader $reader) {
86
+
87
+		$elems = $reader->parseInnerTree([
88
+			'{urn:ietf:params:xml:ns:caldav}comp-filter'   => 'Sabre\\CalDAV\\Xml\\Filter\\CompFilter',
89
+			'{urn:ietf:params:xml:ns:caldav}prop-filter'   => 'Sabre\\CalDAV\\Xml\\Filter\\PropFilter',
90
+			'{urn:ietf:params:xml:ns:caldav}param-filter'  => 'Sabre\\CalDAV\\Xml\\Filter\\ParamFilter',
91
+			'{urn:ietf:params:xml:ns:caldav}calendar-data' => 'Sabre\\CalDAV\\Xml\\Filter\\CalendarData',
92
+			'{DAV:}prop'                                   => 'Sabre\\Xml\\Element\\KeyValue',
93
+		]);
94
+
95
+		$newProps = [
96
+			'filters'    => null,
97
+			'properties' => [],
98
+		];
99
+
100
+		if (!is_array($elems)) $elems = [];
101
+
102
+		foreach ($elems as $elem) {
103
+
104
+			switch ($elem['name']) {
105
+
106
+				case '{DAV:}prop' :
107
+					$newProps['properties'] = array_keys($elem['value']);
108
+					if (isset($elem['value']['{' . Plugin::NS_CALDAV . '}calendar-data'])) {
109
+						$newProps += $elem['value']['{' . Plugin::NS_CALDAV . '}calendar-data'];
110
+					}
111
+					break;
112
+				case '{' . Plugin::NS_CALDAV . '}filter' :
113
+					foreach ($elem['value'] as $subElem) {
114
+						if ($subElem['name'] === '{' . Plugin::NS_CALDAV . '}comp-filter') {
115
+							if (!is_null($newProps['filters'])) {
116
+								throw new BadRequest('Only one top-level comp-filter may be defined');
117
+							}
118
+							$newProps['filters'] = $subElem['value'];
119
+						}
120
+					}
121
+					break;
122
+
123
+			}
124
+
125
+		}
126
+
127
+		if (is_null($newProps['filters'])) {
128
+			throw new BadRequest('The {' . Plugin::NS_CALDAV . '}filter element is required for this request');
129
+		}
130
+
131
+		$obj = new self();
132
+		foreach ($newProps as $key => $value) {
133
+			$obj->$key = $value;
134
+		}
135
+		return $obj;
136
+
137
+	}
138 138
 
139 139
 }
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -97,7 +97,9 @@
 block discarded – undo
97 97
             'properties' => [],
98 98
         ];
99 99
 
100
-        if (!is_array($elems)) $elems = [];
100
+        if (!is_array($elems)) {
101
+        	$elems = [];
102
+        }
101 103
 
102 104
         foreach ($elems as $elem) {
103 105
 
Please login to merge, or discard this patch.
libraries/SabreDAV/CalDAV/Xml/Request/FreeBusyQueryReport.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@
 block discarded – undo
54 54
      * the next element.
55 55
      *
56 56
      * @param Reader $reader
57
-     * @return mixed
57
+     * @return FreeBusyQueryReport
58 58
      */
59 59
     static function xmlDeserialize(Reader $reader) {
60 60
 
Please login to merge, or discard this patch.
Indentation   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -21,71 +21,71 @@
 block discarded – undo
21 21
  */
22 22
 class FreeBusyQueryReport implements XmlDeserializable {
23 23
 
24
-    /**
25
-     * Starttime of report
26
-     *
27
-     * @var DateTime|null
28
-     */
29
-    public $start;
24
+	/**
25
+	 * Starttime of report
26
+	 *
27
+	 * @var DateTime|null
28
+	 */
29
+	public $start;
30 30
 
31
-    /**
32
-     * End time of report
33
-     *
34
-     * @var DateTime|null
35
-     */
36
-    public $end;
31
+	/**
32
+	 * End time of report
33
+	 *
34
+	 * @var DateTime|null
35
+	 */
36
+	public $end;
37 37
 
38
-    /**
39
-     * The deserialize method is called during xml parsing.
40
-     *
41
-     * This method is called statictly, 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
-     * @param Reader $reader
57
-     * @return mixed
58
-     */
59
-    static function xmlDeserialize(Reader $reader) {
38
+	/**
39
+	 * The deserialize method is called during xml parsing.
40
+	 *
41
+	 * This method is called statictly, 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
+	 * @param Reader $reader
57
+	 * @return mixed
58
+	 */
59
+	static function xmlDeserialize(Reader $reader) {
60 60
 
61
-        $timeRange = '{' . Plugin::NS_CALDAV . '}time-range';
61
+		$timeRange = '{' . Plugin::NS_CALDAV . '}time-range';
62 62
 
63
-        $start = null;
64
-        $end = null;
63
+		$start = null;
64
+		$end = null;
65 65
 
66
-        foreach ((array)$reader->parseInnerTree([]) as $elem) {
66
+		foreach ((array)$reader->parseInnerTree([]) as $elem) {
67 67
 
68
-            if ($elem['name'] !== $timeRange) continue;
68
+			if ($elem['name'] !== $timeRange) continue;
69 69
 
70
-            $start = empty($elem['attributes']['start']) ?: $elem['attributes']['start'];
71
-            $end = empty($elem['attributes']['end']) ?: $elem['attributes']['end'];
70
+			$start = empty($elem['attributes']['start']) ?: $elem['attributes']['start'];
71
+			$end = empty($elem['attributes']['end']) ?: $elem['attributes']['end'];
72 72
 
73
-        }
74
-        if (!$start && !$end) {
75
-            throw new BadRequest('The freebusy report must have a time-range element');
76
-        }
77
-        if ($start) {
78
-            $start = DateTimeParser::parseDateTime($start);
79
-        }
80
-        if ($end) {
81
-            $end = DateTimeParser::parseDateTime($end);
82
-        }
83
-        $result = new self();
84
-        $result->start = $start;
85
-        $result->end = $end;
73
+		}
74
+		if (!$start && !$end) {
75
+			throw new BadRequest('The freebusy report must have a time-range element');
76
+		}
77
+		if ($start) {
78
+			$start = DateTimeParser::parseDateTime($start);
79
+		}
80
+		if ($end) {
81
+			$end = DateTimeParser::parseDateTime($end);
82
+		}
83
+		$result = new self();
84
+		$result->start = $start;
85
+		$result->end = $end;
86 86
 
87
-        return $result;
87
+		return $result;
88 88
 
89
-    }
89
+	}
90 90
 
91 91
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@
 block discarded – undo
63 63
         $start = null;
64 64
         $end = null;
65 65
 
66
-        foreach ((array)$reader->parseInnerTree([]) as $elem) {
66
+        foreach ((array) $reader->parseInnerTree([]) as $elem) {
67 67
 
68 68
             if ($elem['name'] !== $timeRange) continue;
69 69
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -65,7 +65,9 @@
 block discarded – undo
65 65
 
66 66
         foreach ((array)$reader->parseInnerTree([]) as $elem) {
67 67
 
68
-            if ($elem['name'] !== $timeRange) continue;
68
+            if ($elem['name'] !== $timeRange) {
69
+            	continue;
70
+            }
69 71
 
70 72
             $start = empty($elem['attributes']['start']) ?: $elem['attributes']['start'];
71 73
             $end = empty($elem['attributes']['end']) ?: $elem['attributes']['end'];
Please login to merge, or discard this patch.
libraries/SabreDAV/CalDAV/Xml/Request/InviteReply.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -97,7 +97,7 @@
 block discarded – undo
97 97
      * the next element.
98 98
      *
99 99
      * @param Reader $reader
100
-     * @return mixed
100
+     * @return InviteReply
101 101
      */
102 102
     static function xmlDeserialize(Reader $reader) {
103 103
 
Please login to merge, or discard this patch.
Unused Use Statements   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -2,12 +2,12 @@
 block discarded – undo
2 2
 
3 3
 namespace Sabre\CalDAV\Xml\Request;
4 4
 
5
-use Sabre\Xml\Reader;
6
-use Sabre\Xml\XmlDeserializable;
7
-use Sabre\Xml\Element\KeyValue;
8
-use Sabre\DAV\Exception\BadRequest;
9 5
 use Sabre\CalDAV\Plugin;
10 6
 use Sabre\CalDAV\SharingPlugin;
7
+use Sabre\DAV\Exception\BadRequest;
8
+use Sabre\Xml\Element\KeyValue;
9
+use Sabre\Xml\Reader;
10
+use Sabre\Xml\XmlDeserializable;
11 11
 
12 12
 /**
13 13
  * Invite-reply POST request parser
Please login to merge, or discard this patch.
Indentation   +123 added lines, -123 removed lines patch added patch discarded remove patch
@@ -22,128 +22,128 @@
 block discarded – undo
22 22
  */
23 23
 class InviteReply implements XmlDeserializable {
24 24
 
25
-    /**
26
-     * The sharee calendar user address.
27
-     *
28
-     * This is the address that the original invite was set to
29
-     *
30
-     * @var string
31
-     */
32
-    public $href;
33
-
34
-    /**
35
-     * The uri to the calendar that was being shared.
36
-     *
37
-     * @var string
38
-     */
39
-    public $calendarUri;
40
-
41
-    /**
42
-     * The id of the invite message that's being responded to
43
-     *
44
-     * @var string
45
-     */
46
-    public $inReplyTo;
47
-
48
-    /**
49
-     * An optional message
50
-     *
51
-     * @var string
52
-     */
53
-    public $summary;
54
-
55
-    /**
56
-     * Either SharingPlugin::STATUS_ACCEPTED or SharingPlugin::STATUS_DECLINED.
57
-     *
58
-     * @var int
59
-     */
60
-    public $status;
61
-
62
-    /**
63
-     * Constructor
64
-     *
65
-     * @param string $href
66
-     * @param string $calendarUri
67
-     * @param string $inReplyTo
68
-     * @param string $summary
69
-     * @param int $status
70
-     */
71
-    public function __construct($href, $calendarUri, $inReplyTo, $summary, $status) {
72
-
73
-        $this->href = $href;
74
-        $this->calendarUri = $calendarUri;
75
-        $this->inReplyTo = $inReplyTo;
76
-        $this->summary = $summary;
77
-        $this->status = $status;
78
-
79
-    }
80
-
81
-    /**
82
-     * The deserialize method is called during xml parsing.
83
-     *
84
-     * This method is called statictly, this is because in theory this method
85
-     * may be used as a type of constructor, or factory method.
86
-     *
87
-     * Often you want to return an instance of the current class, but you are
88
-     * free to return other data as well.
89
-     *
90
-     * You are responsible for advancing the reader to the next element. Not
91
-     * doing anything will result in a never-ending loop.
92
-     *
93
-     * If you just want to skip parsing for this element altogether, you can
94
-     * just call $reader->next();
95
-     *
96
-     * $reader->parseInnerTree() will parse the entire sub-tree, and advance to
97
-     * the next element.
98
-     *
99
-     * @param Reader $reader
100
-     * @return mixed
101
-     */
102
-    static function xmlDeserialize(Reader $reader) {
103
-
104
-        $elems = KeyValue::xmlDeserialize($reader);
105
-
106
-        $href = null;
107
-        $calendarUri = null;
108
-        $inReplyTo = null;
109
-        $summary = null;
110
-        $status = null;
111
-
112
-        foreach ($elems as $name => $value) {
113
-
114
-            switch ($name) {
115
-
116
-                case '{' . Plugin::NS_CALENDARSERVER . '}hosturl' :
117
-                    foreach ($value as $bla) {
118
-                        if ($bla['name'] === '{DAV:}href') {
119
-                            $calendarUri = $bla['value'];
120
-                        }
121
-                    }
122
-                    break;
123
-                case '{' . Plugin::NS_CALENDARSERVER . '}invite-accepted' :
124
-                    $status = SharingPlugin::STATUS_ACCEPTED;
125
-                    break;
126
-                case '{' . Plugin::NS_CALENDARSERVER . '}invite-declined' :
127
-                    $status = SharingPlugin::STATUS_DECLINED;
128
-                    break;
129
-                case '{' . Plugin::NS_CALENDARSERVER . '}in-reply-to' :
130
-                    $inReplyTo = $value;
131
-                    break;
132
-                case '{' . Plugin::NS_CALENDARSERVER . '}summary' :
133
-                    $summary = $value;
134
-                    break;
135
-                case '{DAV:}href' :
136
-                    $href = $value;
137
-                    break;
138
-            }
139
-
140
-        }
141
-        if (is_null($calendarUri)) {
142
-            throw new BadRequest('The {http://calendarserver.org/ns/}hosturl/{DAV:}href element must exist');
143
-        }
144
-
145
-        return new self($href, $calendarUri, $inReplyTo, $summary, $status);
146
-
147
-    }
25
+	/**
26
+	 * The sharee calendar user address.
27
+	 *
28
+	 * This is the address that the original invite was set to
29
+	 *
30
+	 * @var string
31
+	 */
32
+	public $href;
33
+
34
+	/**
35
+	 * The uri to the calendar that was being shared.
36
+	 *
37
+	 * @var string
38
+	 */
39
+	public $calendarUri;
40
+
41
+	/**
42
+	 * The id of the invite message that's being responded to
43
+	 *
44
+	 * @var string
45
+	 */
46
+	public $inReplyTo;
47
+
48
+	/**
49
+	 * An optional message
50
+	 *
51
+	 * @var string
52
+	 */
53
+	public $summary;
54
+
55
+	/**
56
+	 * Either SharingPlugin::STATUS_ACCEPTED or SharingPlugin::STATUS_DECLINED.
57
+	 *
58
+	 * @var int
59
+	 */
60
+	public $status;
61
+
62
+	/**
63
+	 * Constructor
64
+	 *
65
+	 * @param string $href
66
+	 * @param string $calendarUri
67
+	 * @param string $inReplyTo
68
+	 * @param string $summary
69
+	 * @param int $status
70
+	 */
71
+	public function __construct($href, $calendarUri, $inReplyTo, $summary, $status) {
72
+
73
+		$this->href = $href;
74
+		$this->calendarUri = $calendarUri;
75
+		$this->inReplyTo = $inReplyTo;
76
+		$this->summary = $summary;
77
+		$this->status = $status;
78
+
79
+	}
80
+
81
+	/**
82
+	 * The deserialize method is called during xml parsing.
83
+	 *
84
+	 * This method is called statictly, this is because in theory this method
85
+	 * may be used as a type of constructor, or factory method.
86
+	 *
87
+	 * Often you want to return an instance of the current class, but you are
88
+	 * free to return other data as well.
89
+	 *
90
+	 * You are responsible for advancing the reader to the next element. Not
91
+	 * doing anything will result in a never-ending loop.
92
+	 *
93
+	 * If you just want to skip parsing for this element altogether, you can
94
+	 * just call $reader->next();
95
+	 *
96
+	 * $reader->parseInnerTree() will parse the entire sub-tree, and advance to
97
+	 * the next element.
98
+	 *
99
+	 * @param Reader $reader
100
+	 * @return mixed
101
+	 */
102
+	static function xmlDeserialize(Reader $reader) {
103
+
104
+		$elems = KeyValue::xmlDeserialize($reader);
105
+
106
+		$href = null;
107
+		$calendarUri = null;
108
+		$inReplyTo = null;
109
+		$summary = null;
110
+		$status = null;
111
+
112
+		foreach ($elems as $name => $value) {
113
+
114
+			switch ($name) {
115
+
116
+				case '{' . Plugin::NS_CALENDARSERVER . '}hosturl' :
117
+					foreach ($value as $bla) {
118
+						if ($bla['name'] === '{DAV:}href') {
119
+							$calendarUri = $bla['value'];
120
+						}
121
+					}
122
+					break;
123
+				case '{' . Plugin::NS_CALENDARSERVER . '}invite-accepted' :
124
+					$status = SharingPlugin::STATUS_ACCEPTED;
125
+					break;
126
+				case '{' . Plugin::NS_CALENDARSERVER . '}invite-declined' :
127
+					$status = SharingPlugin::STATUS_DECLINED;
128
+					break;
129
+				case '{' . Plugin::NS_CALENDARSERVER . '}in-reply-to' :
130
+					$inReplyTo = $value;
131
+					break;
132
+				case '{' . Plugin::NS_CALENDARSERVER . '}summary' :
133
+					$summary = $value;
134
+					break;
135
+				case '{DAV:}href' :
136
+					$href = $value;
137
+					break;
138
+			}
139
+
140
+		}
141
+		if (is_null($calendarUri)) {
142
+			throw new BadRequest('The {http://calendarserver.org/ns/}hosturl/{DAV:}href element must exist');
143
+		}
144
+
145
+		return new self($href, $calendarUri, $inReplyTo, $summary, $status);
146
+
147
+	}
148 148
 
149 149
 }
Please login to merge, or discard this patch.