Completed
Branch develop (37f7b7)
by
unknown
24:41
created
htdocs/includes/sabre/sabre/vobject/lib/Parameter.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -275,7 +275,7 @@
 block discarded – undo
275 275
 
276 276
         return $this->name.'='.array_reduce(
277 277
             $value,
278
-            function ($out, $item) {
278
+            function($out, $item) {
279 279
                 if (!is_null($out)) {
280 280
                     $out .= ',';
281 281
                 }
Please login to merge, or discard this patch.
Indentation   +320 added lines, -320 removed lines patch added patch discarded remove patch
@@ -19,350 +19,350 @@
 block discarded – undo
19 19
  */
20 20
 class Parameter extends Node
21 21
 {
22
-    /**
23
-     * Parameter name.
24
-     *
25
-     * @var string
26
-     */
27
-    public $name;
22
+	/**
23
+	 * Parameter name.
24
+	 *
25
+	 * @var string
26
+	 */
27
+	public $name;
28 28
 
29
-    /**
30
-     * vCard 2.1 allows parameters to be encoded without a name.
31
-     *
32
-     * We can deduce the parameter name based on its value.
33
-     *
34
-     * @var bool
35
-     */
36
-    public $noName = false;
29
+	/**
30
+	 * vCard 2.1 allows parameters to be encoded without a name.
31
+	 *
32
+	 * We can deduce the parameter name based on its value.
33
+	 *
34
+	 * @var bool
35
+	 */
36
+	public $noName = false;
37 37
 
38
-    /**
39
-     * Parameter value.
40
-     *
41
-     * @var string
42
-     */
43
-    protected $value;
38
+	/**
39
+	 * Parameter value.
40
+	 *
41
+	 * @var string
42
+	 */
43
+	protected $value;
44 44
 
45
-    /**
46
-     * Sets up the object.
47
-     *
48
-     * It's recommended to use the create:: factory method instead.
49
-     *
50
-     * @param string $name
51
-     * @param string $value
52
-     */
53
-    public function __construct(Document $root, $name, $value = null)
54
-    {
55
-        $this->root = $root;
56
-        if (is_null($name)) {
57
-            $this->noName = true;
58
-            $this->name = static::guessParameterNameByValue($value);
59
-        } else {
60
-            $this->name = strtoupper($name);
61
-        }
45
+	/**
46
+	 * Sets up the object.
47
+	 *
48
+	 * It's recommended to use the create:: factory method instead.
49
+	 *
50
+	 * @param string $name
51
+	 * @param string $value
52
+	 */
53
+	public function __construct(Document $root, $name, $value = null)
54
+	{
55
+		$this->root = $root;
56
+		if (is_null($name)) {
57
+			$this->noName = true;
58
+			$this->name = static::guessParameterNameByValue($value);
59
+		} else {
60
+			$this->name = strtoupper($name);
61
+		}
62 62
 
63
-        // If guessParameterNameByValue() returns an empty string
64
-        // above, we're actually dealing with a parameter that has no value.
65
-        // In that case we have to move the value to the name.
66
-        if ('' === $this->name) {
67
-            $this->noName = false;
68
-            $this->name = strtoupper($value);
69
-        } else {
70
-            $this->setValue($value);
71
-        }
72
-    }
63
+		// If guessParameterNameByValue() returns an empty string
64
+		// above, we're actually dealing with a parameter that has no value.
65
+		// In that case we have to move the value to the name.
66
+		if ('' === $this->name) {
67
+			$this->noName = false;
68
+			$this->name = strtoupper($value);
69
+		} else {
70
+			$this->setValue($value);
71
+		}
72
+	}
73 73
 
74
-    /**
75
-     * Try to guess property name by value, can be used for vCard 2.1 nameless parameters.
76
-     *
77
-     * Figuring out what the name should have been. Note that a ton of
78
-     * these are rather silly in 2014 and would probably rarely be
79
-     * used, but we like to be complete.
80
-     *
81
-     * @param string $value
82
-     *
83
-     * @return string
84
-     */
85
-    public static function guessParameterNameByValue($value)
86
-    {
87
-        switch (strtoupper($value)) {
88
-            // Encodings
89
-            case '7-BIT':
90
-            case 'QUOTED-PRINTABLE':
91
-            case 'BASE64':
92
-                $name = 'ENCODING';
93
-                break;
74
+	/**
75
+	 * Try to guess property name by value, can be used for vCard 2.1 nameless parameters.
76
+	 *
77
+	 * Figuring out what the name should have been. Note that a ton of
78
+	 * these are rather silly in 2014 and would probably rarely be
79
+	 * used, but we like to be complete.
80
+	 *
81
+	 * @param string $value
82
+	 *
83
+	 * @return string
84
+	 */
85
+	public static function guessParameterNameByValue($value)
86
+	{
87
+		switch (strtoupper($value)) {
88
+			// Encodings
89
+			case '7-BIT':
90
+			case 'QUOTED-PRINTABLE':
91
+			case 'BASE64':
92
+				$name = 'ENCODING';
93
+				break;
94 94
 
95
-            // Common types
96
-            case 'WORK':
97
-            case 'HOME':
98
-            case 'PREF':
99
-            // Delivery Label Type
100
-            case 'DOM':
101
-            case 'INTL':
102
-            case 'POSTAL':
103
-            case 'PARCEL':
104
-            // Telephone types
105
-            case 'VOICE':
106
-            case 'FAX':
107
-            case 'MSG':
108
-            case 'CELL':
109
-            case 'PAGER':
110
-            case 'BBS':
111
-            case 'MODEM':
112
-            case 'CAR':
113
-            case 'ISDN':
114
-            case 'VIDEO':
115
-            // EMAIL types (lol)
116
-            case 'AOL':
117
-            case 'APPLELINK':
118
-            case 'ATTMAIL':
119
-            case 'CIS':
120
-            case 'EWORLD':
121
-            case 'INTERNET':
122
-            case 'IBMMAIL':
123
-            case 'MCIMAIL':
124
-            case 'POWERSHARE':
125
-            case 'PRODIGY':
126
-            case 'TLX':
127
-            case 'X400':
128
-            // Photo / Logo format types
129
-            case 'GIF':
130
-            case 'CGM':
131
-            case 'WMF':
132
-            case 'BMP':
133
-            case 'DIB':
134
-            case 'PICT':
135
-            case 'TIFF':
136
-            case 'PDF':
137
-            case 'PS':
138
-            case 'JPEG':
139
-            case 'MPEG':
140
-            case 'MPEG2':
141
-            case 'AVI':
142
-            case 'QTIME':
143
-            // Sound Digital Audio Type
144
-            case 'WAVE':
145
-            case 'PCM':
146
-            case 'AIFF':
147
-            // Key types
148
-            case 'X509':
149
-            case 'PGP':
150
-                $name = 'TYPE';
151
-                break;
95
+			// Common types
96
+			case 'WORK':
97
+			case 'HOME':
98
+			case 'PREF':
99
+			// Delivery Label Type
100
+			case 'DOM':
101
+			case 'INTL':
102
+			case 'POSTAL':
103
+			case 'PARCEL':
104
+			// Telephone types
105
+			case 'VOICE':
106
+			case 'FAX':
107
+			case 'MSG':
108
+			case 'CELL':
109
+			case 'PAGER':
110
+			case 'BBS':
111
+			case 'MODEM':
112
+			case 'CAR':
113
+			case 'ISDN':
114
+			case 'VIDEO':
115
+			// EMAIL types (lol)
116
+			case 'AOL':
117
+			case 'APPLELINK':
118
+			case 'ATTMAIL':
119
+			case 'CIS':
120
+			case 'EWORLD':
121
+			case 'INTERNET':
122
+			case 'IBMMAIL':
123
+			case 'MCIMAIL':
124
+			case 'POWERSHARE':
125
+			case 'PRODIGY':
126
+			case 'TLX':
127
+			case 'X400':
128
+			// Photo / Logo format types
129
+			case 'GIF':
130
+			case 'CGM':
131
+			case 'WMF':
132
+			case 'BMP':
133
+			case 'DIB':
134
+			case 'PICT':
135
+			case 'TIFF':
136
+			case 'PDF':
137
+			case 'PS':
138
+			case 'JPEG':
139
+			case 'MPEG':
140
+			case 'MPEG2':
141
+			case 'AVI':
142
+			case 'QTIME':
143
+			// Sound Digital Audio Type
144
+			case 'WAVE':
145
+			case 'PCM':
146
+			case 'AIFF':
147
+			// Key types
148
+			case 'X509':
149
+			case 'PGP':
150
+				$name = 'TYPE';
151
+				break;
152 152
 
153
-            // Value types
154
-            case 'INLINE':
155
-            case 'URL':
156
-            case 'CONTENT-ID':
157
-            case 'CID':
158
-                $name = 'VALUE';
159
-                break;
153
+			// Value types
154
+			case 'INLINE':
155
+			case 'URL':
156
+			case 'CONTENT-ID':
157
+			case 'CID':
158
+				$name = 'VALUE';
159
+				break;
160 160
 
161
-            default:
162
-                $name = '';
163
-        }
161
+			default:
162
+				$name = '';
163
+		}
164 164
 
165
-        return $name;
166
-    }
165
+		return $name;
166
+	}
167 167
 
168
-    /**
169
-     * Updates the current value.
170
-     *
171
-     * This may be either a single, or multiple strings in an array.
172
-     *
173
-     * @param string|array $value
174
-     */
175
-    public function setValue($value)
176
-    {
177
-        $this->value = $value;
178
-    }
168
+	/**
169
+	 * Updates the current value.
170
+	 *
171
+	 * This may be either a single, or multiple strings in an array.
172
+	 *
173
+	 * @param string|array $value
174
+	 */
175
+	public function setValue($value)
176
+	{
177
+		$this->value = $value;
178
+	}
179 179
 
180
-    /**
181
-     * Returns the current value.
182
-     *
183
-     * This method will always return a string, or null. If there were multiple
184
-     * values, it will automatically concatenate them (separated by comma).
185
-     *
186
-     * @return string|null
187
-     */
188
-    public function getValue()
189
-    {
190
-        if (is_array($this->value)) {
191
-            return implode(',', $this->value);
192
-        } else {
193
-            return $this->value;
194
-        }
195
-    }
180
+	/**
181
+	 * Returns the current value.
182
+	 *
183
+	 * This method will always return a string, or null. If there were multiple
184
+	 * values, it will automatically concatenate them (separated by comma).
185
+	 *
186
+	 * @return string|null
187
+	 */
188
+	public function getValue()
189
+	{
190
+		if (is_array($this->value)) {
191
+			return implode(',', $this->value);
192
+		} else {
193
+			return $this->value;
194
+		}
195
+	}
196 196
 
197
-    /**
198
-     * Sets multiple values for this parameter.
199
-     */
200
-    public function setParts(array $value)
201
-    {
202
-        $this->value = $value;
203
-    }
197
+	/**
198
+	 * Sets multiple values for this parameter.
199
+	 */
200
+	public function setParts(array $value)
201
+	{
202
+		$this->value = $value;
203
+	}
204 204
 
205
-    /**
206
-     * Returns all values for this parameter.
207
-     *
208
-     * If there were no values, an empty array will be returned.
209
-     *
210
-     * @return array
211
-     */
212
-    public function getParts()
213
-    {
214
-        if (is_array($this->value)) {
215
-            return $this->value;
216
-        } elseif (is_null($this->value)) {
217
-            return [];
218
-        } else {
219
-            return [$this->value];
220
-        }
221
-    }
205
+	/**
206
+	 * Returns all values for this parameter.
207
+	 *
208
+	 * If there were no values, an empty array will be returned.
209
+	 *
210
+	 * @return array
211
+	 */
212
+	public function getParts()
213
+	{
214
+		if (is_array($this->value)) {
215
+			return $this->value;
216
+		} elseif (is_null($this->value)) {
217
+			return [];
218
+		} else {
219
+			return [$this->value];
220
+		}
221
+	}
222 222
 
223
-    /**
224
-     * Adds a value to this parameter.
225
-     *
226
-     * If the argument is specified as an array, all items will be added to the
227
-     * parameter value list.
228
-     *
229
-     * @param string|array $part
230
-     */
231
-    public function addValue($part)
232
-    {
233
-        if (is_null($this->value)) {
234
-            $this->value = $part;
235
-        } else {
236
-            $this->value = array_merge((array) $this->value, (array) $part);
237
-        }
238
-    }
223
+	/**
224
+	 * Adds a value to this parameter.
225
+	 *
226
+	 * If the argument is specified as an array, all items will be added to the
227
+	 * parameter value list.
228
+	 *
229
+	 * @param string|array $part
230
+	 */
231
+	public function addValue($part)
232
+	{
233
+		if (is_null($this->value)) {
234
+			$this->value = $part;
235
+		} else {
236
+			$this->value = array_merge((array) $this->value, (array) $part);
237
+		}
238
+	}
239 239
 
240
-    /**
241
-     * Checks if this parameter contains the specified value.
242
-     *
243
-     * This is a case-insensitive match. It makes sense to call this for for
244
-     * instance the TYPE parameter, to see if it contains a keyword such as
245
-     * 'WORK' or 'FAX'.
246
-     *
247
-     * @param string $value
248
-     *
249
-     * @return bool
250
-     */
251
-    public function has($value)
252
-    {
253
-        return in_array(
254
-            strtolower($value),
255
-            array_map('strtolower', (array) $this->value)
256
-        );
257
-    }
240
+	/**
241
+	 * Checks if this parameter contains the specified value.
242
+	 *
243
+	 * This is a case-insensitive match. It makes sense to call this for for
244
+	 * instance the TYPE parameter, to see if it contains a keyword such as
245
+	 * 'WORK' or 'FAX'.
246
+	 *
247
+	 * @param string $value
248
+	 *
249
+	 * @return bool
250
+	 */
251
+	public function has($value)
252
+	{
253
+		return in_array(
254
+			strtolower($value),
255
+			array_map('strtolower', (array) $this->value)
256
+		);
257
+	}
258 258
 
259
-    /**
260
-     * Turns the object back into a serialized blob.
261
-     *
262
-     * @return string
263
-     */
264
-    public function serialize()
265
-    {
266
-        $value = $this->getParts();
259
+	/**
260
+	 * Turns the object back into a serialized blob.
261
+	 *
262
+	 * @return string
263
+	 */
264
+	public function serialize()
265
+	{
266
+		$value = $this->getParts();
267 267
 
268
-        if (0 === count($value)) {
269
-            return $this->name.'=';
270
-        }
268
+		if (0 === count($value)) {
269
+			return $this->name.'=';
270
+		}
271 271
 
272
-        if (Document::VCARD21 === $this->root->getDocumentType() && $this->noName) {
273
-            return implode(';', $value);
274
-        }
272
+		if (Document::VCARD21 === $this->root->getDocumentType() && $this->noName) {
273
+			return implode(';', $value);
274
+		}
275 275
 
276
-        return $this->name.'='.array_reduce(
277
-            $value,
278
-            function ($out, $item) {
279
-                if (!is_null($out)) {
280
-                    $out .= ',';
281
-                }
276
+		return $this->name.'='.array_reduce(
277
+			$value,
278
+			function ($out, $item) {
279
+				if (!is_null($out)) {
280
+					$out .= ',';
281
+				}
282 282
 
283
-                // If there's no special characters in the string, we'll use the simple
284
-                // format.
285
-                //
286
-                // The list of special characters is defined as:
287
-                //
288
-                // Any character except CONTROL, DQUOTE, ";", ":", ","
289
-                //
290
-                // by the iCalendar spec:
291
-                // https://tools.ietf.org/html/rfc5545#section-3.1
292
-                //
293
-                // And we add ^ to that because of:
294
-                // https://tools.ietf.org/html/rfc6868
295
-                //
296
-                // But we've found that iCal (7.0, shipped with OSX 10.9)
297
-                // severely trips on + characters not being quoted, so we
298
-                // added + as well.
299
-                if (!preg_match('#(?: [\n":;\^,\+] )#x', $item)) {
300
-                    return $out.$item;
301
-                } else {
302
-                    // Enclosing in double-quotes, and using RFC6868 for encoding any
303
-                    // special characters
304
-                    $out .= '"'.strtr(
305
-                        $item,
306
-                        [
307
-                            '^' => '^^',
308
-                            "\n" => '^n',
309
-                            '"' => '^\'',
310
-                        ]
311
-                    ).'"';
283
+				// If there's no special characters in the string, we'll use the simple
284
+				// format.
285
+				//
286
+				// The list of special characters is defined as:
287
+				//
288
+				// Any character except CONTROL, DQUOTE, ";", ":", ","
289
+				//
290
+				// by the iCalendar spec:
291
+				// https://tools.ietf.org/html/rfc5545#section-3.1
292
+				//
293
+				// And we add ^ to that because of:
294
+				// https://tools.ietf.org/html/rfc6868
295
+				//
296
+				// But we've found that iCal (7.0, shipped with OSX 10.9)
297
+				// severely trips on + characters not being quoted, so we
298
+				// added + as well.
299
+				if (!preg_match('#(?: [\n":;\^,\+] )#x', $item)) {
300
+					return $out.$item;
301
+				} else {
302
+					// Enclosing in double-quotes, and using RFC6868 for encoding any
303
+					// special characters
304
+					$out .= '"'.strtr(
305
+						$item,
306
+						[
307
+							'^' => '^^',
308
+							"\n" => '^n',
309
+							'"' => '^\'',
310
+						]
311
+					).'"';
312 312
 
313
-                    return $out;
314
-                }
315
-            }
316
-        );
317
-    }
313
+					return $out;
314
+				}
315
+			}
316
+		);
317
+	}
318 318
 
319
-    /**
320
-     * This method returns an array, with the representation as it should be
321
-     * encoded in JSON. This is used to create jCard or jCal documents.
322
-     *
323
-     * @return array
324
-     */
325
-    #[\ReturnTypeWillChange]
326
-    public function jsonSerialize()
327
-    {
328
-        return $this->value;
329
-    }
319
+	/**
320
+	 * This method returns an array, with the representation as it should be
321
+	 * encoded in JSON. This is used to create jCard or jCal documents.
322
+	 *
323
+	 * @return array
324
+	 */
325
+	#[\ReturnTypeWillChange]
326
+	public function jsonSerialize()
327
+	{
328
+		return $this->value;
329
+	}
330 330
 
331
-    /**
332
-     * This method serializes the data into XML. This is used to create xCard or
333
-     * xCal documents.
334
-     *
335
-     * @param Xml\Writer $writer XML writer
336
-     */
337
-    public function xmlSerialize(Xml\Writer $writer): void
338
-    {
339
-        foreach (explode(',', $this->value) as $value) {
340
-            $writer->writeElement('text', $value);
341
-        }
342
-    }
331
+	/**
332
+	 * This method serializes the data into XML. This is used to create xCard or
333
+	 * xCal documents.
334
+	 *
335
+	 * @param Xml\Writer $writer XML writer
336
+	 */
337
+	public function xmlSerialize(Xml\Writer $writer): void
338
+	{
339
+		foreach (explode(',', $this->value) as $value) {
340
+			$writer->writeElement('text', $value);
341
+		}
342
+	}
343 343
 
344
-    /**
345
-     * Called when this object is being cast to a string.
346
-     *
347
-     * @return string
348
-     */
349
-    public function __toString()
350
-    {
351
-        return (string) $this->getValue();
352
-    }
344
+	/**
345
+	 * Called when this object is being cast to a string.
346
+	 *
347
+	 * @return string
348
+	 */
349
+	public function __toString()
350
+	{
351
+		return (string) $this->getValue();
352
+	}
353 353
 
354
-    /**
355
-     * Returns the iterator for this object.
356
-     *
357
-     * @return ElementList
358
-     */
359
-    #[\ReturnTypeWillChange]
360
-    public function getIterator()
361
-    {
362
-        if (!is_null($this->iterator)) {
363
-            return $this->iterator;
364
-        }
354
+	/**
355
+	 * Returns the iterator for this object.
356
+	 *
357
+	 * @return ElementList
358
+	 */
359
+	#[\ReturnTypeWillChange]
360
+	public function getIterator()
361
+	{
362
+		if (!is_null($this->iterator)) {
363
+			return $this->iterator;
364
+		}
365 365
 
366
-        return $this->iterator = new ArrayIterator((array) $this->value);
367
-    }
366
+		return $this->iterator = new ArrayIterator((array) $this->value);
367
+	}
368 368
 }
Please login to merge, or discard this patch.
htdocs/includes/sabre/sabre/vobject/lib/FreeBusyGenerator.php 2 patches
Indentation   +521 added lines, -521 removed lines patch added patch discarded remove patch
@@ -25,525 +25,525 @@
 block discarded – undo
25 25
  */
26 26
 class FreeBusyGenerator
27 27
 {
28
-    /**
29
-     * Input objects.
30
-     *
31
-     * @var array
32
-     */
33
-    protected $objects = [];
34
-
35
-    /**
36
-     * Start of range.
37
-     *
38
-     * @var DateTimeInterface|null
39
-     */
40
-    protected $start;
41
-
42
-    /**
43
-     * End of range.
44
-     *
45
-     * @var DateTimeInterface|null
46
-     */
47
-    protected $end;
48
-
49
-    /**
50
-     * VCALENDAR object.
51
-     *
52
-     * @var Document
53
-     */
54
-    protected $baseObject;
55
-
56
-    /**
57
-     * Reference timezone.
58
-     *
59
-     * When we are calculating busy times, and we come across so-called
60
-     * floating times (times without a timezone), we use the reference timezone
61
-     * instead.
62
-     *
63
-     * This is also used for all-day events.
64
-     *
65
-     * This defaults to UTC.
66
-     *
67
-     * @var DateTimeZone
68
-     */
69
-    protected $timeZone;
70
-
71
-    /**
72
-     * A VAVAILABILITY document.
73
-     *
74
-     * If this is set, its information will be included when calculating
75
-     * freebusy time.
76
-     *
77
-     * @var Document
78
-     */
79
-    protected $vavailability;
80
-
81
-    /**
82
-     * Creates the generator.
83
-     *
84
-     * Check the setTimeRange and setObjects methods for details about the
85
-     * arguments.
86
-     *
87
-     * @param DateTimeInterface $start
88
-     * @param DateTimeInterface $end
89
-     * @param mixed             $objects
90
-     * @param DateTimeZone      $timeZone
91
-     */
92
-    public function __construct(DateTimeInterface $start = null, DateTimeInterface $end = null, $objects = null, DateTimeZone $timeZone = null)
93
-    {
94
-        $this->setTimeRange($start, $end);
95
-
96
-        if ($objects) {
97
-            $this->setObjects($objects);
98
-        }
99
-        if (is_null($timeZone)) {
100
-            $timeZone = new DateTimeZone('UTC');
101
-        }
102
-        $this->setTimeZone($timeZone);
103
-    }
104
-
105
-    /**
106
-     * Sets the VCALENDAR object.
107
-     *
108
-     * If this is set, it will not be generated for you. You are responsible
109
-     * for setting things like the METHOD, CALSCALE, VERSION, etc..
110
-     *
111
-     * The VFREEBUSY object will be automatically added though.
112
-     */
113
-    public function setBaseObject(Document $vcalendar)
114
-    {
115
-        $this->baseObject = $vcalendar;
116
-    }
117
-
118
-    /**
119
-     * Sets a VAVAILABILITY document.
120
-     */
121
-    public function setVAvailability(Document $vcalendar)
122
-    {
123
-        $this->vavailability = $vcalendar;
124
-    }
125
-
126
-    /**
127
-     * Sets the input objects.
128
-     *
129
-     * You must either specify a vcalendar object as a string, or as the parse
130
-     * Component.
131
-     * It's also possible to specify multiple objects as an array.
132
-     *
133
-     * @param mixed $objects
134
-     */
135
-    public function setObjects($objects)
136
-    {
137
-        if (!is_array($objects)) {
138
-            $objects = [$objects];
139
-        }
140
-
141
-        $this->objects = [];
142
-        foreach ($objects as $object) {
143
-            if (is_string($object) || is_resource($object)) {
144
-                $this->objects[] = Reader::read($object);
145
-            } elseif ($object instanceof Component) {
146
-                $this->objects[] = $object;
147
-            } else {
148
-                throw new \InvalidArgumentException('You can only pass strings or \\Sabre\\VObject\\Component arguments to setObjects');
149
-            }
150
-        }
151
-    }
152
-
153
-    /**
154
-     * Sets the time range.
155
-     *
156
-     * Any freebusy object falling outside of this time range will be ignored.
157
-     *
158
-     * @param DateTimeInterface $start
159
-     * @param DateTimeInterface $end
160
-     */
161
-    public function setTimeRange(DateTimeInterface $start = null, DateTimeInterface $end = null)
162
-    {
163
-        if (!$start) {
164
-            $start = new DateTimeImmutable(Settings::$minDate);
165
-        }
166
-        if (!$end) {
167
-            $end = new DateTimeImmutable(Settings::$maxDate);
168
-        }
169
-        $this->start = $start;
170
-        $this->end = $end;
171
-    }
172
-
173
-    /**
174
-     * Sets the reference timezone for floating times.
175
-     */
176
-    public function setTimeZone(DateTimeZone $timeZone)
177
-    {
178
-        $this->timeZone = $timeZone;
179
-    }
180
-
181
-    /**
182
-     * Parses the input data and returns a correct VFREEBUSY object, wrapped in
183
-     * a VCALENDAR.
184
-     *
185
-     * @return Component
186
-     */
187
-    public function getResult()
188
-    {
189
-        $fbData = new FreeBusyData(
190
-            $this->start->getTimeStamp(),
191
-            $this->end->getTimeStamp()
192
-        );
193
-        if ($this->vavailability) {
194
-            $this->calculateAvailability($fbData, $this->vavailability);
195
-        }
196
-
197
-        $this->calculateBusy($fbData, $this->objects);
198
-
199
-        return $this->generateFreeBusyCalendar($fbData);
200
-    }
201
-
202
-    /**
203
-     * This method takes a VAVAILABILITY component and figures out all the
204
-     * available times.
205
-     */
206
-    protected function calculateAvailability(FreeBusyData $fbData, VCalendar $vavailability)
207
-    {
208
-        $vavailComps = iterator_to_array($vavailability->VAVAILABILITY);
209
-        usort(
210
-            $vavailComps,
211
-            function ($a, $b) {
212
-                // We need to order the components by priority. Priority 1
213
-                // comes first, up until priority 9. Priority 0 comes after
214
-                // priority 9. No priority implies priority 0.
215
-                //
216
-                // Yes, I'm serious.
217
-                $priorityA = isset($a->PRIORITY) ? (int) $a->PRIORITY->getValue() : 0;
218
-                $priorityB = isset($b->PRIORITY) ? (int) $b->PRIORITY->getValue() : 0;
219
-
220
-                if (0 === $priorityA) {
221
-                    $priorityA = 10;
222
-                }
223
-                if (0 === $priorityB) {
224
-                    $priorityB = 10;
225
-                }
226
-
227
-                return $priorityA - $priorityB;
228
-            }
229
-        );
230
-
231
-        // Now we go over all the VAVAILABILITY components and figure if
232
-        // there's any we don't need to consider.
233
-        //
234
-        // This is can be because of one of two reasons: either the
235
-        // VAVAILABILITY component falls outside the time we are interested in,
236
-        // or a different VAVAILABILITY component with a higher priority has
237
-        // already completely covered the time-range.
238
-        $old = $vavailComps;
239
-        $new = [];
240
-
241
-        foreach ($old as $vavail) {
242
-            list($compStart, $compEnd) = $vavail->getEffectiveStartEnd();
243
-
244
-            // We don't care about datetimes that are earlier or later than the
245
-            // start and end of the freebusy report, so this gets normalized
246
-            // first.
247
-            if (is_null($compStart) || $compStart < $this->start) {
248
-                $compStart = $this->start;
249
-            }
250
-            if (is_null($compEnd) || $compEnd > $this->end) {
251
-                $compEnd = $this->end;
252
-            }
253
-
254
-            // If the item fell out of the timerange, we can just skip it.
255
-            if ($compStart > $this->end || $compEnd < $this->start) {
256
-                continue;
257
-            }
258
-
259
-            // Going through our existing list of components to see if there's
260
-            // a higher priority component that already fully covers this one.
261
-            foreach ($new as $higherVavail) {
262
-                list($higherStart, $higherEnd) = $higherVavail->getEffectiveStartEnd();
263
-                if (
264
-                    (is_null($higherStart) || $higherStart < $compStart) &&
265
-                    (is_null($higherEnd) || $higherEnd > $compEnd)
266
-                ) {
267
-                    // Component is fully covered by a higher priority
268
-                    // component. We can skip this component.
269
-                    continue 2;
270
-                }
271
-            }
272
-
273
-            // We're keeping it!
274
-            $new[] = $vavail;
275
-        }
276
-
277
-        // Lastly, we need to traverse the remaining components and fill in the
278
-        // freebusydata slots.
279
-        //
280
-        // We traverse the components in reverse, because we want the higher
281
-        // priority components to override the lower ones.
282
-        foreach (array_reverse($new) as $vavail) {
283
-            $busyType = isset($vavail->BUSYTYPE) ? strtoupper($vavail->BUSYTYPE) : 'BUSY-UNAVAILABLE';
284
-            list($vavailStart, $vavailEnd) = $vavail->getEffectiveStartEnd();
285
-
286
-            // Making the component size no larger than the requested free-busy
287
-            // report range.
288
-            if (!$vavailStart || $vavailStart < $this->start) {
289
-                $vavailStart = $this->start;
290
-            }
291
-            if (!$vavailEnd || $vavailEnd > $this->end) {
292
-                $vavailEnd = $this->end;
293
-            }
294
-
295
-            // Marking the entire time range of the VAVAILABILITY component as
296
-            // busy.
297
-            $fbData->add(
298
-                $vavailStart->getTimeStamp(),
299
-                $vavailEnd->getTimeStamp(),
300
-                $busyType
301
-            );
302
-
303
-            // Looping over the AVAILABLE components.
304
-            if (isset($vavail->AVAILABLE)) {
305
-                foreach ($vavail->AVAILABLE as $available) {
306
-                    list($availStart, $availEnd) = $available->getEffectiveStartEnd();
307
-                    $fbData->add(
308
-                    $availStart->getTimeStamp(),
309
-                    $availEnd->getTimeStamp(),
310
-                    'FREE'
311
-                );
312
-
313
-                    if ($available->RRULE) {
314
-                        // Our favourite thing: recurrence!!
315
-
316
-                        $rruleIterator = new Recur\RRuleIterator(
317
-                        $available->RRULE->getValue(),
318
-                        $availStart
319
-                    );
320
-                        $rruleIterator->fastForward($vavailStart);
321
-
322
-                        $startEndDiff = $availStart->diff($availEnd);
323
-
324
-                        while ($rruleIterator->valid()) {
325
-                            $recurStart = $rruleIterator->current();
326
-                            $recurEnd = $recurStart->add($startEndDiff);
327
-
328
-                            if ($recurStart > $vavailEnd) {
329
-                                // We're beyond the legal timerange.
330
-                                break;
331
-                            }
332
-
333
-                            if ($recurEnd > $vavailEnd) {
334
-                                // Truncating the end if it exceeds the
335
-                                // VAVAILABILITY end.
336
-                                $recurEnd = $vavailEnd;
337
-                            }
338
-
339
-                            $fbData->add(
340
-                            $recurStart->getTimeStamp(),
341
-                            $recurEnd->getTimeStamp(),
342
-                            'FREE'
343
-                        );
344
-
345
-                            $rruleIterator->next();
346
-                        }
347
-                    }
348
-                }
349
-            }
350
-        }
351
-    }
352
-
353
-    /**
354
-     * This method takes an array of iCalendar objects and applies its busy
355
-     * times on fbData.
356
-     *
357
-     * @param VCalendar[] $objects
358
-     */
359
-    protected function calculateBusy(FreeBusyData $fbData, array $objects)
360
-    {
361
-        foreach ($objects as $key => $object) {
362
-            foreach ($object->getBaseComponents() as $component) {
363
-                switch ($component->name) {
364
-                    case 'VEVENT':
365
-                        $FBTYPE = 'BUSY';
366
-                        if (isset($component->TRANSP) && ('TRANSPARENT' === strtoupper($component->TRANSP))) {
367
-                            break;
368
-                        }
369
-                        if (isset($component->STATUS)) {
370
-                            $status = strtoupper($component->STATUS);
371
-                            if ('CANCELLED' === $status) {
372
-                                break;
373
-                            }
374
-                            if ('TENTATIVE' === $status) {
375
-                                $FBTYPE = 'BUSY-TENTATIVE';
376
-                            }
377
-                        }
378
-
379
-                        $times = [];
380
-
381
-                        if ($component->RRULE) {
382
-                            try {
383
-                                $iterator = new EventIterator($object, (string) $component->UID, $this->timeZone);
384
-                            } catch (NoInstancesException $e) {
385
-                                // This event is recurring, but it doesn't have a single
386
-                                // instance. We are skipping this event from the output
387
-                                // entirely.
388
-                                unset($this->objects[$key]);
389
-                                break;
390
-                            }
391
-
392
-                            if ($this->start) {
393
-                                $iterator->fastForward($this->start);
394
-                            }
395
-
396
-                            $maxRecurrences = Settings::$maxRecurrences;
397
-
398
-                            while ($iterator->valid() && --$maxRecurrences) {
399
-                                $startTime = $iterator->getDTStart();
400
-                                if ($this->end && $startTime > $this->end) {
401
-                                    break;
402
-                                }
403
-                                $times[] = [
404
-                                    $iterator->getDTStart(),
405
-                                    $iterator->getDTEnd(),
406
-                                ];
407
-
408
-                                $iterator->next();
409
-                            }
410
-                        } else {
411
-                            $startTime = $component->DTSTART->getDateTime($this->timeZone);
412
-                            if ($this->end && $startTime > $this->end) {
413
-                                break;
414
-                            }
415
-                            $endTime = null;
416
-                            if (isset($component->DTEND)) {
417
-                                $endTime = $component->DTEND->getDateTime($this->timeZone);
418
-                            } elseif (isset($component->DURATION)) {
419
-                                $duration = DateTimeParser::parseDuration((string) $component->DURATION);
420
-                                $endTime = clone $startTime;
421
-                                $endTime = $endTime->add($duration);
422
-                            } elseif (!$component->DTSTART->hasTime()) {
423
-                                $endTime = clone $startTime;
424
-                                $endTime = $endTime->modify('+1 day');
425
-                            } else {
426
-                                // The event had no duration (0 seconds)
427
-                                break;
428
-                            }
429
-
430
-                            $times[] = [$startTime, $endTime];
431
-                        }
432
-
433
-                        foreach ($times as $time) {
434
-                            if ($this->end && $time[0] > $this->end) {
435
-                                break;
436
-                            }
437
-                            if ($this->start && $time[1] < $this->start) {
438
-                                break;
439
-                            }
440
-
441
-                            $fbData->add(
442
-                                $time[0]->getTimeStamp(),
443
-                                $time[1]->getTimeStamp(),
444
-                                $FBTYPE
445
-                            );
446
-                        }
447
-                        break;
448
-
449
-                    case 'VFREEBUSY':
450
-                        foreach ($component->FREEBUSY as $freebusy) {
451
-                            $fbType = isset($freebusy['FBTYPE']) ? strtoupper($freebusy['FBTYPE']) : 'BUSY';
452
-
453
-                            // Skipping intervals marked as 'free'
454
-                            if ('FREE' === $fbType) {
455
-                                continue;
456
-                            }
457
-
458
-                            $values = explode(',', $freebusy);
459
-                            foreach ($values as $value) {
460
-                                list($startTime, $endTime) = explode('/', $value);
461
-                                $startTime = DateTimeParser::parseDateTime($startTime);
462
-
463
-                                if ('P' === substr($endTime, 0, 1) || '-P' === substr($endTime, 0, 2)) {
464
-                                    $duration = DateTimeParser::parseDuration($endTime);
465
-                                    $endTime = clone $startTime;
466
-                                    $endTime = $endTime->add($duration);
467
-                                } else {
468
-                                    $endTime = DateTimeParser::parseDateTime($endTime);
469
-                                }
470
-
471
-                                if ($this->start && $this->start > $endTime) {
472
-                                    continue;
473
-                                }
474
-                                if ($this->end && $this->end < $startTime) {
475
-                                    continue;
476
-                                }
477
-                                $fbData->add(
478
-                                    $startTime->getTimeStamp(),
479
-                                    $endTime->getTimeStamp(),
480
-                                    $fbType
481
-                                );
482
-                            }
483
-                        }
484
-                        break;
485
-                }
486
-            }
487
-        }
488
-    }
489
-
490
-    /**
491
-     * This method takes a FreeBusyData object and generates the VCALENDAR
492
-     * object associated with it.
493
-     *
494
-     * @return VCalendar
495
-     */
496
-    protected function generateFreeBusyCalendar(FreeBusyData $fbData)
497
-    {
498
-        if ($this->baseObject) {
499
-            $calendar = $this->baseObject;
500
-        } else {
501
-            $calendar = new VCalendar();
502
-        }
503
-
504
-        $vfreebusy = $calendar->createComponent('VFREEBUSY');
505
-        $calendar->add($vfreebusy);
506
-
507
-        if ($this->start) {
508
-            $dtstart = $calendar->createProperty('DTSTART');
509
-            $dtstart->setDateTime($this->start);
510
-            $vfreebusy->add($dtstart);
511
-        }
512
-        if ($this->end) {
513
-            $dtend = $calendar->createProperty('DTEND');
514
-            $dtend->setDateTime($this->end);
515
-            $vfreebusy->add($dtend);
516
-        }
517
-
518
-        $tz = new \DateTimeZone('UTC');
519
-        $dtstamp = $calendar->createProperty('DTSTAMP');
520
-        $dtstamp->setDateTime(new DateTimeImmutable('now', $tz));
521
-        $vfreebusy->add($dtstamp);
522
-
523
-        foreach ($fbData->getData() as $busyTime) {
524
-            $busyType = strtoupper($busyTime['type']);
525
-
526
-            // Ignoring all the FREE parts, because those are already assumed.
527
-            if ('FREE' === $busyType) {
528
-                continue;
529
-            }
530
-
531
-            $busyTime[0] = new \DateTimeImmutable('@'.$busyTime['start'], $tz);
532
-            $busyTime[1] = new \DateTimeImmutable('@'.$busyTime['end'], $tz);
533
-
534
-            $prop = $calendar->createProperty(
535
-                'FREEBUSY',
536
-                $busyTime[0]->format('Ymd\\THis\\Z').'/'.$busyTime[1]->format('Ymd\\THis\\Z')
537
-            );
538
-
539
-            // Only setting FBTYPE if it's not BUSY, because BUSY is the
540
-            // default anyway.
541
-            if ('BUSY' !== $busyType) {
542
-                $prop['FBTYPE'] = $busyType;
543
-            }
544
-            $vfreebusy->add($prop);
545
-        }
546
-
547
-        return $calendar;
548
-    }
28
+	/**
29
+	 * Input objects.
30
+	 *
31
+	 * @var array
32
+	 */
33
+	protected $objects = [];
34
+
35
+	/**
36
+	 * Start of range.
37
+	 *
38
+	 * @var DateTimeInterface|null
39
+	 */
40
+	protected $start;
41
+
42
+	/**
43
+	 * End of range.
44
+	 *
45
+	 * @var DateTimeInterface|null
46
+	 */
47
+	protected $end;
48
+
49
+	/**
50
+	 * VCALENDAR object.
51
+	 *
52
+	 * @var Document
53
+	 */
54
+	protected $baseObject;
55
+
56
+	/**
57
+	 * Reference timezone.
58
+	 *
59
+	 * When we are calculating busy times, and we come across so-called
60
+	 * floating times (times without a timezone), we use the reference timezone
61
+	 * instead.
62
+	 *
63
+	 * This is also used for all-day events.
64
+	 *
65
+	 * This defaults to UTC.
66
+	 *
67
+	 * @var DateTimeZone
68
+	 */
69
+	protected $timeZone;
70
+
71
+	/**
72
+	 * A VAVAILABILITY document.
73
+	 *
74
+	 * If this is set, its information will be included when calculating
75
+	 * freebusy time.
76
+	 *
77
+	 * @var Document
78
+	 */
79
+	protected $vavailability;
80
+
81
+	/**
82
+	 * Creates the generator.
83
+	 *
84
+	 * Check the setTimeRange and setObjects methods for details about the
85
+	 * arguments.
86
+	 *
87
+	 * @param DateTimeInterface $start
88
+	 * @param DateTimeInterface $end
89
+	 * @param mixed             $objects
90
+	 * @param DateTimeZone      $timeZone
91
+	 */
92
+	public function __construct(DateTimeInterface $start = null, DateTimeInterface $end = null, $objects = null, DateTimeZone $timeZone = null)
93
+	{
94
+		$this->setTimeRange($start, $end);
95
+
96
+		if ($objects) {
97
+			$this->setObjects($objects);
98
+		}
99
+		if (is_null($timeZone)) {
100
+			$timeZone = new DateTimeZone('UTC');
101
+		}
102
+		$this->setTimeZone($timeZone);
103
+	}
104
+
105
+	/**
106
+	 * Sets the VCALENDAR object.
107
+	 *
108
+	 * If this is set, it will not be generated for you. You are responsible
109
+	 * for setting things like the METHOD, CALSCALE, VERSION, etc..
110
+	 *
111
+	 * The VFREEBUSY object will be automatically added though.
112
+	 */
113
+	public function setBaseObject(Document $vcalendar)
114
+	{
115
+		$this->baseObject = $vcalendar;
116
+	}
117
+
118
+	/**
119
+	 * Sets a VAVAILABILITY document.
120
+	 */
121
+	public function setVAvailability(Document $vcalendar)
122
+	{
123
+		$this->vavailability = $vcalendar;
124
+	}
125
+
126
+	/**
127
+	 * Sets the input objects.
128
+	 *
129
+	 * You must either specify a vcalendar object as a string, or as the parse
130
+	 * Component.
131
+	 * It's also possible to specify multiple objects as an array.
132
+	 *
133
+	 * @param mixed $objects
134
+	 */
135
+	public function setObjects($objects)
136
+	{
137
+		if (!is_array($objects)) {
138
+			$objects = [$objects];
139
+		}
140
+
141
+		$this->objects = [];
142
+		foreach ($objects as $object) {
143
+			if (is_string($object) || is_resource($object)) {
144
+				$this->objects[] = Reader::read($object);
145
+			} elseif ($object instanceof Component) {
146
+				$this->objects[] = $object;
147
+			} else {
148
+				throw new \InvalidArgumentException('You can only pass strings or \\Sabre\\VObject\\Component arguments to setObjects');
149
+			}
150
+		}
151
+	}
152
+
153
+	/**
154
+	 * Sets the time range.
155
+	 *
156
+	 * Any freebusy object falling outside of this time range will be ignored.
157
+	 *
158
+	 * @param DateTimeInterface $start
159
+	 * @param DateTimeInterface $end
160
+	 */
161
+	public function setTimeRange(DateTimeInterface $start = null, DateTimeInterface $end = null)
162
+	{
163
+		if (!$start) {
164
+			$start = new DateTimeImmutable(Settings::$minDate);
165
+		}
166
+		if (!$end) {
167
+			$end = new DateTimeImmutable(Settings::$maxDate);
168
+		}
169
+		$this->start = $start;
170
+		$this->end = $end;
171
+	}
172
+
173
+	/**
174
+	 * Sets the reference timezone for floating times.
175
+	 */
176
+	public function setTimeZone(DateTimeZone $timeZone)
177
+	{
178
+		$this->timeZone = $timeZone;
179
+	}
180
+
181
+	/**
182
+	 * Parses the input data and returns a correct VFREEBUSY object, wrapped in
183
+	 * a VCALENDAR.
184
+	 *
185
+	 * @return Component
186
+	 */
187
+	public function getResult()
188
+	{
189
+		$fbData = new FreeBusyData(
190
+			$this->start->getTimeStamp(),
191
+			$this->end->getTimeStamp()
192
+		);
193
+		if ($this->vavailability) {
194
+			$this->calculateAvailability($fbData, $this->vavailability);
195
+		}
196
+
197
+		$this->calculateBusy($fbData, $this->objects);
198
+
199
+		return $this->generateFreeBusyCalendar($fbData);
200
+	}
201
+
202
+	/**
203
+	 * This method takes a VAVAILABILITY component and figures out all the
204
+	 * available times.
205
+	 */
206
+	protected function calculateAvailability(FreeBusyData $fbData, VCalendar $vavailability)
207
+	{
208
+		$vavailComps = iterator_to_array($vavailability->VAVAILABILITY);
209
+		usort(
210
+			$vavailComps,
211
+			function ($a, $b) {
212
+				// We need to order the components by priority. Priority 1
213
+				// comes first, up until priority 9. Priority 0 comes after
214
+				// priority 9. No priority implies priority 0.
215
+				//
216
+				// Yes, I'm serious.
217
+				$priorityA = isset($a->PRIORITY) ? (int) $a->PRIORITY->getValue() : 0;
218
+				$priorityB = isset($b->PRIORITY) ? (int) $b->PRIORITY->getValue() : 0;
219
+
220
+				if (0 === $priorityA) {
221
+					$priorityA = 10;
222
+				}
223
+				if (0 === $priorityB) {
224
+					$priorityB = 10;
225
+				}
226
+
227
+				return $priorityA - $priorityB;
228
+			}
229
+		);
230
+
231
+		// Now we go over all the VAVAILABILITY components and figure if
232
+		// there's any we don't need to consider.
233
+		//
234
+		// This is can be because of one of two reasons: either the
235
+		// VAVAILABILITY component falls outside the time we are interested in,
236
+		// or a different VAVAILABILITY component with a higher priority has
237
+		// already completely covered the time-range.
238
+		$old = $vavailComps;
239
+		$new = [];
240
+
241
+		foreach ($old as $vavail) {
242
+			list($compStart, $compEnd) = $vavail->getEffectiveStartEnd();
243
+
244
+			// We don't care about datetimes that are earlier or later than the
245
+			// start and end of the freebusy report, so this gets normalized
246
+			// first.
247
+			if (is_null($compStart) || $compStart < $this->start) {
248
+				$compStart = $this->start;
249
+			}
250
+			if (is_null($compEnd) || $compEnd > $this->end) {
251
+				$compEnd = $this->end;
252
+			}
253
+
254
+			// If the item fell out of the timerange, we can just skip it.
255
+			if ($compStart > $this->end || $compEnd < $this->start) {
256
+				continue;
257
+			}
258
+
259
+			// Going through our existing list of components to see if there's
260
+			// a higher priority component that already fully covers this one.
261
+			foreach ($new as $higherVavail) {
262
+				list($higherStart, $higherEnd) = $higherVavail->getEffectiveStartEnd();
263
+				if (
264
+					(is_null($higherStart) || $higherStart < $compStart) &&
265
+					(is_null($higherEnd) || $higherEnd > $compEnd)
266
+				) {
267
+					// Component is fully covered by a higher priority
268
+					// component. We can skip this component.
269
+					continue 2;
270
+				}
271
+			}
272
+
273
+			// We're keeping it!
274
+			$new[] = $vavail;
275
+		}
276
+
277
+		// Lastly, we need to traverse the remaining components and fill in the
278
+		// freebusydata slots.
279
+		//
280
+		// We traverse the components in reverse, because we want the higher
281
+		// priority components to override the lower ones.
282
+		foreach (array_reverse($new) as $vavail) {
283
+			$busyType = isset($vavail->BUSYTYPE) ? strtoupper($vavail->BUSYTYPE) : 'BUSY-UNAVAILABLE';
284
+			list($vavailStart, $vavailEnd) = $vavail->getEffectiveStartEnd();
285
+
286
+			// Making the component size no larger than the requested free-busy
287
+			// report range.
288
+			if (!$vavailStart || $vavailStart < $this->start) {
289
+				$vavailStart = $this->start;
290
+			}
291
+			if (!$vavailEnd || $vavailEnd > $this->end) {
292
+				$vavailEnd = $this->end;
293
+			}
294
+
295
+			// Marking the entire time range of the VAVAILABILITY component as
296
+			// busy.
297
+			$fbData->add(
298
+				$vavailStart->getTimeStamp(),
299
+				$vavailEnd->getTimeStamp(),
300
+				$busyType
301
+			);
302
+
303
+			// Looping over the AVAILABLE components.
304
+			if (isset($vavail->AVAILABLE)) {
305
+				foreach ($vavail->AVAILABLE as $available) {
306
+					list($availStart, $availEnd) = $available->getEffectiveStartEnd();
307
+					$fbData->add(
308
+					$availStart->getTimeStamp(),
309
+					$availEnd->getTimeStamp(),
310
+					'FREE'
311
+				);
312
+
313
+					if ($available->RRULE) {
314
+						// Our favourite thing: recurrence!!
315
+
316
+						$rruleIterator = new Recur\RRuleIterator(
317
+						$available->RRULE->getValue(),
318
+						$availStart
319
+					);
320
+						$rruleIterator->fastForward($vavailStart);
321
+
322
+						$startEndDiff = $availStart->diff($availEnd);
323
+
324
+						while ($rruleIterator->valid()) {
325
+							$recurStart = $rruleIterator->current();
326
+							$recurEnd = $recurStart->add($startEndDiff);
327
+
328
+							if ($recurStart > $vavailEnd) {
329
+								// We're beyond the legal timerange.
330
+								break;
331
+							}
332
+
333
+							if ($recurEnd > $vavailEnd) {
334
+								// Truncating the end if it exceeds the
335
+								// VAVAILABILITY end.
336
+								$recurEnd = $vavailEnd;
337
+							}
338
+
339
+							$fbData->add(
340
+							$recurStart->getTimeStamp(),
341
+							$recurEnd->getTimeStamp(),
342
+							'FREE'
343
+						);
344
+
345
+							$rruleIterator->next();
346
+						}
347
+					}
348
+				}
349
+			}
350
+		}
351
+	}
352
+
353
+	/**
354
+	 * This method takes an array of iCalendar objects and applies its busy
355
+	 * times on fbData.
356
+	 *
357
+	 * @param VCalendar[] $objects
358
+	 */
359
+	protected function calculateBusy(FreeBusyData $fbData, array $objects)
360
+	{
361
+		foreach ($objects as $key => $object) {
362
+			foreach ($object->getBaseComponents() as $component) {
363
+				switch ($component->name) {
364
+					case 'VEVENT':
365
+						$FBTYPE = 'BUSY';
366
+						if (isset($component->TRANSP) && ('TRANSPARENT' === strtoupper($component->TRANSP))) {
367
+							break;
368
+						}
369
+						if (isset($component->STATUS)) {
370
+							$status = strtoupper($component->STATUS);
371
+							if ('CANCELLED' === $status) {
372
+								break;
373
+							}
374
+							if ('TENTATIVE' === $status) {
375
+								$FBTYPE = 'BUSY-TENTATIVE';
376
+							}
377
+						}
378
+
379
+						$times = [];
380
+
381
+						if ($component->RRULE) {
382
+							try {
383
+								$iterator = new EventIterator($object, (string) $component->UID, $this->timeZone);
384
+							} catch (NoInstancesException $e) {
385
+								// This event is recurring, but it doesn't have a single
386
+								// instance. We are skipping this event from the output
387
+								// entirely.
388
+								unset($this->objects[$key]);
389
+								break;
390
+							}
391
+
392
+							if ($this->start) {
393
+								$iterator->fastForward($this->start);
394
+							}
395
+
396
+							$maxRecurrences = Settings::$maxRecurrences;
397
+
398
+							while ($iterator->valid() && --$maxRecurrences) {
399
+								$startTime = $iterator->getDTStart();
400
+								if ($this->end && $startTime > $this->end) {
401
+									break;
402
+								}
403
+								$times[] = [
404
+									$iterator->getDTStart(),
405
+									$iterator->getDTEnd(),
406
+								];
407
+
408
+								$iterator->next();
409
+							}
410
+						} else {
411
+							$startTime = $component->DTSTART->getDateTime($this->timeZone);
412
+							if ($this->end && $startTime > $this->end) {
413
+								break;
414
+							}
415
+							$endTime = null;
416
+							if (isset($component->DTEND)) {
417
+								$endTime = $component->DTEND->getDateTime($this->timeZone);
418
+							} elseif (isset($component->DURATION)) {
419
+								$duration = DateTimeParser::parseDuration((string) $component->DURATION);
420
+								$endTime = clone $startTime;
421
+								$endTime = $endTime->add($duration);
422
+							} elseif (!$component->DTSTART->hasTime()) {
423
+								$endTime = clone $startTime;
424
+								$endTime = $endTime->modify('+1 day');
425
+							} else {
426
+								// The event had no duration (0 seconds)
427
+								break;
428
+							}
429
+
430
+							$times[] = [$startTime, $endTime];
431
+						}
432
+
433
+						foreach ($times as $time) {
434
+							if ($this->end && $time[0] > $this->end) {
435
+								break;
436
+							}
437
+							if ($this->start && $time[1] < $this->start) {
438
+								break;
439
+							}
440
+
441
+							$fbData->add(
442
+								$time[0]->getTimeStamp(),
443
+								$time[1]->getTimeStamp(),
444
+								$FBTYPE
445
+							);
446
+						}
447
+						break;
448
+
449
+					case 'VFREEBUSY':
450
+						foreach ($component->FREEBUSY as $freebusy) {
451
+							$fbType = isset($freebusy['FBTYPE']) ? strtoupper($freebusy['FBTYPE']) : 'BUSY';
452
+
453
+							// Skipping intervals marked as 'free'
454
+							if ('FREE' === $fbType) {
455
+								continue;
456
+							}
457
+
458
+							$values = explode(',', $freebusy);
459
+							foreach ($values as $value) {
460
+								list($startTime, $endTime) = explode('/', $value);
461
+								$startTime = DateTimeParser::parseDateTime($startTime);
462
+
463
+								if ('P' === substr($endTime, 0, 1) || '-P' === substr($endTime, 0, 2)) {
464
+									$duration = DateTimeParser::parseDuration($endTime);
465
+									$endTime = clone $startTime;
466
+									$endTime = $endTime->add($duration);
467
+								} else {
468
+									$endTime = DateTimeParser::parseDateTime($endTime);
469
+								}
470
+
471
+								if ($this->start && $this->start > $endTime) {
472
+									continue;
473
+								}
474
+								if ($this->end && $this->end < $startTime) {
475
+									continue;
476
+								}
477
+								$fbData->add(
478
+									$startTime->getTimeStamp(),
479
+									$endTime->getTimeStamp(),
480
+									$fbType
481
+								);
482
+							}
483
+						}
484
+						break;
485
+				}
486
+			}
487
+		}
488
+	}
489
+
490
+	/**
491
+	 * This method takes a FreeBusyData object and generates the VCALENDAR
492
+	 * object associated with it.
493
+	 *
494
+	 * @return VCalendar
495
+	 */
496
+	protected function generateFreeBusyCalendar(FreeBusyData $fbData)
497
+	{
498
+		if ($this->baseObject) {
499
+			$calendar = $this->baseObject;
500
+		} else {
501
+			$calendar = new VCalendar();
502
+		}
503
+
504
+		$vfreebusy = $calendar->createComponent('VFREEBUSY');
505
+		$calendar->add($vfreebusy);
506
+
507
+		if ($this->start) {
508
+			$dtstart = $calendar->createProperty('DTSTART');
509
+			$dtstart->setDateTime($this->start);
510
+			$vfreebusy->add($dtstart);
511
+		}
512
+		if ($this->end) {
513
+			$dtend = $calendar->createProperty('DTEND');
514
+			$dtend->setDateTime($this->end);
515
+			$vfreebusy->add($dtend);
516
+		}
517
+
518
+		$tz = new \DateTimeZone('UTC');
519
+		$dtstamp = $calendar->createProperty('DTSTAMP');
520
+		$dtstamp->setDateTime(new DateTimeImmutable('now', $tz));
521
+		$vfreebusy->add($dtstamp);
522
+
523
+		foreach ($fbData->getData() as $busyTime) {
524
+			$busyType = strtoupper($busyTime['type']);
525
+
526
+			// Ignoring all the FREE parts, because those are already assumed.
527
+			if ('FREE' === $busyType) {
528
+				continue;
529
+			}
530
+
531
+			$busyTime[0] = new \DateTimeImmutable('@'.$busyTime['start'], $tz);
532
+			$busyTime[1] = new \DateTimeImmutable('@'.$busyTime['end'], $tz);
533
+
534
+			$prop = $calendar->createProperty(
535
+				'FREEBUSY',
536
+				$busyTime[0]->format('Ymd\\THis\\Z').'/'.$busyTime[1]->format('Ymd\\THis\\Z')
537
+			);
538
+
539
+			// Only setting FBTYPE if it's not BUSY, because BUSY is the
540
+			// default anyway.
541
+			if ('BUSY' !== $busyType) {
542
+				$prop['FBTYPE'] = $busyType;
543
+			}
544
+			$vfreebusy->add($prop);
545
+		}
546
+
547
+		return $calendar;
548
+	}
549 549
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -208,7 +208,7 @@
 block discarded – undo
208 208
         $vavailComps = iterator_to_array($vavailability->VAVAILABILITY);
209 209
         usort(
210 210
             $vavailComps,
211
-            function ($a, $b) {
211
+            function($a, $b) {
212 212
                 // We need to order the components by priority. Priority 1
213 213
                 // comes first, up until priority 9. Priority 0 comes after
214 214
                 // priority 9. No priority implies priority 0.
Please login to merge, or discard this patch.
htdocs/includes/sabre/sabre/vobject/lib/timezonedata/lotuszones.php 1 patch
Indentation   +90 added lines, -90 removed lines patch added patch discarded remove patch
@@ -8,94 +8,94 @@
 block discarded – undo
8 8
  * @license http://sabre.io/license/ Modified BSD License
9 9
  */
10 10
 return [
11
-    'Dateline' => 'Etc/GMT-12',
12
-    'Samoa' => 'Pacific/Apia',
13
-    'Hawaiian' => 'Pacific/Honolulu',
14
-    'Alaskan' => 'America/Anchorage',
15
-    'Pacific' => 'America/Los_Angeles',
16
-    'Pacific Standard Time' => 'America/Los_Angeles',
17
-    'Mexico Standard Time 2' => 'America/Chihuahua',
18
-    'Mountain' => 'America/Denver',
19
-    // 'Mountain Standard Time' => 'America/Chihuahua', // conflict with windows timezones.
20
-    'US Mountain' => 'America/Phoenix',
21
-    'Canada Central' => 'America/Edmonton',
22
-    'Central America' => 'America/Guatemala',
23
-    'Central' => 'America/Chicago',
24
-    // 'Central Standard Time'  => 'America/Mexico_City', // conflict with windows timezones.
25
-    'Mexico' => 'America/Mexico_City',
26
-    'Eastern' => 'America/New_York',
27
-    'SA Pacific' => 'America/Bogota',
28
-    'US Eastern' => 'America/Indiana/Indianapolis',
29
-    'Venezuela' => 'America/Caracas',
30
-    'Atlantic' => 'America/Halifax',
31
-    'Central Brazilian' => 'America/Manaus',
32
-    'Pacific SA' => 'America/Santiago',
33
-    'SA Western' => 'America/La_Paz',
34
-    'Newfoundland' => 'America/St_Johns',
35
-    'Argentina' => 'America/Argentina/Buenos_Aires',
36
-    'E. South America' => 'America/Belem',
37
-    'Greenland' => 'America/Godthab',
38
-    'Montevideo' => 'America/Montevideo',
39
-    'SA Eastern' => 'America/Belem',
40
-    // 'Mid-Atlantic'           => 'Etc/GMT-2', // conflict with windows timezones.
41
-    'Azores' => 'Atlantic/Azores',
42
-    'Cape Verde' => 'Atlantic/Cape_Verde',
43
-    'Greenwich' => 'Atlantic/Reykjavik', // No I'm serious.. Greenwich is not GMT.
44
-    'Morocco' => 'Africa/Casablanca',
45
-    'Central Europe' => 'Europe/Prague',
46
-    'Central European' => 'Europe/Sarajevo',
47
-    'Romance' => 'Europe/Paris',
48
-    'W. Central Africa' => 'Africa/Lagos', // Best guess
49
-    'W. Europe' => 'Europe/Amsterdam',
50
-    'E. Europe' => 'Europe/Minsk',
51
-    'Egypt' => 'Africa/Cairo',
52
-    'FLE' => 'Europe/Helsinki',
53
-    'GTB' => 'Europe/Athens',
54
-    'Israel' => 'Asia/Jerusalem',
55
-    'Jordan' => 'Asia/Amman',
56
-    'Middle East' => 'Asia/Beirut',
57
-    'Namibia' => 'Africa/Windhoek',
58
-    'South Africa' => 'Africa/Harare',
59
-    'Arab' => 'Asia/Kuwait',
60
-    'Arabic' => 'Asia/Baghdad',
61
-    'E. Africa' => 'Africa/Nairobi',
62
-    'Georgian' => 'Asia/Tbilisi',
63
-    'Russian' => 'Europe/Moscow',
64
-    'Iran' => 'Asia/Tehran',
65
-    'Arabian' => 'Asia/Muscat',
66
-    'Armenian' => 'Asia/Yerevan',
67
-    'Azerbijan' => 'Asia/Baku',
68
-    'Caucasus' => 'Asia/Yerevan',
69
-    'Mauritius' => 'Indian/Mauritius',
70
-    'Afghanistan' => 'Asia/Kabul',
71
-    'Ekaterinburg' => 'Asia/Yekaterinburg',
72
-    'Pakistan' => 'Asia/Karachi',
73
-    'West Asia' => 'Asia/Tashkent',
74
-    'India' => 'Asia/Calcutta',
75
-    'Sri Lanka' => 'Asia/Colombo',
76
-    'Nepal' => 'Asia/Kathmandu',
77
-    'Central Asia' => 'Asia/Dhaka',
78
-    'N. Central Asia' => 'Asia/Almaty',
79
-    'Myanmar' => 'Asia/Rangoon',
80
-    'North Asia' => 'Asia/Krasnoyarsk',
81
-    'SE Asia' => 'Asia/Bangkok',
82
-    'China' => 'Asia/Shanghai',
83
-    'North Asia East' => 'Asia/Irkutsk',
84
-    'Singapore' => 'Asia/Singapore',
85
-    'Taipei' => 'Asia/Taipei',
86
-    'W. Australia' => 'Australia/Perth',
87
-    'Korea' => 'Asia/Seoul',
88
-    'Tokyo' => 'Asia/Tokyo',
89
-    'Yakutsk' => 'Asia/Yakutsk',
90
-    'AUS Central' => 'Australia/Darwin',
91
-    'Cen. Australia' => 'Australia/Adelaide',
92
-    'AUS Eastern' => 'Australia/Sydney',
93
-    'E. Australia' => 'Australia/Brisbane',
94
-    'Tasmania' => 'Australia/Hobart',
95
-    'Vladivostok' => 'Asia/Vladivostok',
96
-    'West Pacific' => 'Pacific/Guam',
97
-    'Central Pacific' => 'Asia/Magadan',
98
-    'Fiji' => 'Pacific/Fiji',
99
-    'New Zealand' => 'Pacific/Auckland',
100
-    'Tonga' => 'Pacific/Tongatapu',
11
+	'Dateline' => 'Etc/GMT-12',
12
+	'Samoa' => 'Pacific/Apia',
13
+	'Hawaiian' => 'Pacific/Honolulu',
14
+	'Alaskan' => 'America/Anchorage',
15
+	'Pacific' => 'America/Los_Angeles',
16
+	'Pacific Standard Time' => 'America/Los_Angeles',
17
+	'Mexico Standard Time 2' => 'America/Chihuahua',
18
+	'Mountain' => 'America/Denver',
19
+	// 'Mountain Standard Time' => 'America/Chihuahua', // conflict with windows timezones.
20
+	'US Mountain' => 'America/Phoenix',
21
+	'Canada Central' => 'America/Edmonton',
22
+	'Central America' => 'America/Guatemala',
23
+	'Central' => 'America/Chicago',
24
+	// 'Central Standard Time'  => 'America/Mexico_City', // conflict with windows timezones.
25
+	'Mexico' => 'America/Mexico_City',
26
+	'Eastern' => 'America/New_York',
27
+	'SA Pacific' => 'America/Bogota',
28
+	'US Eastern' => 'America/Indiana/Indianapolis',
29
+	'Venezuela' => 'America/Caracas',
30
+	'Atlantic' => 'America/Halifax',
31
+	'Central Brazilian' => 'America/Manaus',
32
+	'Pacific SA' => 'America/Santiago',
33
+	'SA Western' => 'America/La_Paz',
34
+	'Newfoundland' => 'America/St_Johns',
35
+	'Argentina' => 'America/Argentina/Buenos_Aires',
36
+	'E. South America' => 'America/Belem',
37
+	'Greenland' => 'America/Godthab',
38
+	'Montevideo' => 'America/Montevideo',
39
+	'SA Eastern' => 'America/Belem',
40
+	// 'Mid-Atlantic'           => 'Etc/GMT-2', // conflict with windows timezones.
41
+	'Azores' => 'Atlantic/Azores',
42
+	'Cape Verde' => 'Atlantic/Cape_Verde',
43
+	'Greenwich' => 'Atlantic/Reykjavik', // No I'm serious.. Greenwich is not GMT.
44
+	'Morocco' => 'Africa/Casablanca',
45
+	'Central Europe' => 'Europe/Prague',
46
+	'Central European' => 'Europe/Sarajevo',
47
+	'Romance' => 'Europe/Paris',
48
+	'W. Central Africa' => 'Africa/Lagos', // Best guess
49
+	'W. Europe' => 'Europe/Amsterdam',
50
+	'E. Europe' => 'Europe/Minsk',
51
+	'Egypt' => 'Africa/Cairo',
52
+	'FLE' => 'Europe/Helsinki',
53
+	'GTB' => 'Europe/Athens',
54
+	'Israel' => 'Asia/Jerusalem',
55
+	'Jordan' => 'Asia/Amman',
56
+	'Middle East' => 'Asia/Beirut',
57
+	'Namibia' => 'Africa/Windhoek',
58
+	'South Africa' => 'Africa/Harare',
59
+	'Arab' => 'Asia/Kuwait',
60
+	'Arabic' => 'Asia/Baghdad',
61
+	'E. Africa' => 'Africa/Nairobi',
62
+	'Georgian' => 'Asia/Tbilisi',
63
+	'Russian' => 'Europe/Moscow',
64
+	'Iran' => 'Asia/Tehran',
65
+	'Arabian' => 'Asia/Muscat',
66
+	'Armenian' => 'Asia/Yerevan',
67
+	'Azerbijan' => 'Asia/Baku',
68
+	'Caucasus' => 'Asia/Yerevan',
69
+	'Mauritius' => 'Indian/Mauritius',
70
+	'Afghanistan' => 'Asia/Kabul',
71
+	'Ekaterinburg' => 'Asia/Yekaterinburg',
72
+	'Pakistan' => 'Asia/Karachi',
73
+	'West Asia' => 'Asia/Tashkent',
74
+	'India' => 'Asia/Calcutta',
75
+	'Sri Lanka' => 'Asia/Colombo',
76
+	'Nepal' => 'Asia/Kathmandu',
77
+	'Central Asia' => 'Asia/Dhaka',
78
+	'N. Central Asia' => 'Asia/Almaty',
79
+	'Myanmar' => 'Asia/Rangoon',
80
+	'North Asia' => 'Asia/Krasnoyarsk',
81
+	'SE Asia' => 'Asia/Bangkok',
82
+	'China' => 'Asia/Shanghai',
83
+	'North Asia East' => 'Asia/Irkutsk',
84
+	'Singapore' => 'Asia/Singapore',
85
+	'Taipei' => 'Asia/Taipei',
86
+	'W. Australia' => 'Australia/Perth',
87
+	'Korea' => 'Asia/Seoul',
88
+	'Tokyo' => 'Asia/Tokyo',
89
+	'Yakutsk' => 'Asia/Yakutsk',
90
+	'AUS Central' => 'Australia/Darwin',
91
+	'Cen. Australia' => 'Australia/Adelaide',
92
+	'AUS Eastern' => 'Australia/Sydney',
93
+	'E. Australia' => 'Australia/Brisbane',
94
+	'Tasmania' => 'Australia/Hobart',
95
+	'Vladivostok' => 'Asia/Vladivostok',
96
+	'West Pacific' => 'Pacific/Guam',
97
+	'Central Pacific' => 'Asia/Magadan',
98
+	'Fiji' => 'Pacific/Fiji',
99
+	'New Zealand' => 'Pacific/Auckland',
100
+	'Tonga' => 'Pacific/Tongatapu',
101 101
 ];
Please login to merge, or discard this patch.
htdocs/includes/sabre/sabre/vobject/lib/timezonedata/exchangezones.php 1 patch
Indentation   +79 added lines, -79 removed lines patch added patch discarded remove patch
@@ -12,83 +12,83 @@
 block discarded – undo
12 12
  * @license http://sabre.io/license/ Modified BSD License
13 13
  */
14 14
 return [
15
-    'Universal Coordinated Time' => 'UTC',
16
-    'Casablanca, Monrovia' => 'Africa/Casablanca',
17
-    'Greenwich Mean Time: Dublin, Edinburgh, Lisbon, London' => 'Europe/Lisbon',
18
-    'Greenwich Mean Time; Dublin, Edinburgh, London' => 'Europe/London',
19
-    'Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna' => 'Europe/Berlin',
20
-    'Belgrade, Pozsony, Budapest, Ljubljana, Prague' => 'Europe/Prague',
21
-    'Brussels, Copenhagen, Madrid, Paris' => 'Europe/Paris',
22
-    'Paris, Madrid, Brussels, Copenhagen' => 'Europe/Paris',
23
-    'Prague, Central Europe' => 'Europe/Prague',
24
-    'Sarajevo, Skopje, Sofija, Vilnius, Warsaw, Zagreb' => 'Europe/Sarajevo',
25
-    'West Central Africa' => 'Africa/Luanda', // This was a best guess
26
-    'Athens, Istanbul, Minsk' => 'Europe/Athens',
27
-    'Bucharest' => 'Europe/Bucharest',
28
-    'Cairo' => 'Africa/Cairo',
29
-    'Harare, Pretoria' => 'Africa/Harare',
30
-    'Helsinki, Riga, Tallinn' => 'Europe/Helsinki',
31
-    'Israel, Jerusalem Standard Time' => 'Asia/Jerusalem',
32
-    'Baghdad' => 'Asia/Baghdad',
33
-    'Arab, Kuwait, Riyadh' => 'Asia/Kuwait',
34
-    'Moscow, St. Petersburg, Volgograd' => 'Europe/Moscow',
35
-    'East Africa, Nairobi' => 'Africa/Nairobi',
36
-    'Tehran' => 'Asia/Tehran',
37
-    'Abu Dhabi, Muscat' => 'Asia/Muscat', // Best guess
38
-    'Baku, Tbilisi, Yerevan' => 'Asia/Baku',
39
-    'Kabul' => 'Asia/Kabul',
40
-    'Ekaterinburg' => 'Asia/Yekaterinburg',
41
-    'Islamabad, Karachi, Tashkent' => 'Asia/Karachi',
42
-    'Kolkata, Chennai, Mumbai, New Delhi, India Standard Time' => 'Asia/Calcutta',
43
-    'Kathmandu, Nepal' => 'Asia/Kathmandu',
44
-    'Almaty, Novosibirsk, North Central Asia' => 'Asia/Almaty',
45
-    'Astana, Dhaka' => 'Asia/Dhaka',
46
-    'Sri Jayawardenepura, Sri Lanka' => 'Asia/Colombo',
47
-    'Rangoon' => 'Asia/Rangoon',
48
-    'Bangkok, Hanoi, Jakarta' => 'Asia/Bangkok',
49
-    'Krasnoyarsk' => 'Asia/Krasnoyarsk',
50
-    'Beijing, Chongqing, Hong Kong SAR, Urumqi' => 'Asia/Shanghai',
51
-    'Irkutsk, Ulaan Bataar' => 'Asia/Irkutsk',
52
-    'Kuala Lumpur, Singapore' => 'Asia/Singapore',
53
-    'Perth, Western Australia' => 'Australia/Perth',
54
-    'Taipei' => 'Asia/Taipei',
55
-    'Osaka, Sapporo, Tokyo' => 'Asia/Tokyo',
56
-    'Seoul, Korea Standard time' => 'Asia/Seoul',
57
-    'Yakutsk' => 'Asia/Yakutsk',
58
-    'Adelaide, Central Australia' => 'Australia/Adelaide',
59
-    'Darwin' => 'Australia/Darwin',
60
-    'Brisbane, East Australia' => 'Australia/Brisbane',
61
-    'Canberra, Melbourne, Sydney, Hobart (year 2000 only)' => 'Australia/Sydney',
62
-    'Guam, Port Moresby' => 'Pacific/Guam',
63
-    'Hobart, Tasmania' => 'Australia/Hobart',
64
-    'Vladivostok' => 'Asia/Vladivostok',
65
-    'Magadan, Solomon Is., New Caledonia' => 'Asia/Magadan',
66
-    'Auckland, Wellington' => 'Pacific/Auckland',
67
-    'Fiji Islands, Kamchatka, Marshall Is.' => 'Pacific/Fiji',
68
-    'Nuku\'alofa, Tonga' => 'Pacific/Tongatapu',
69
-    'Azores' => 'Atlantic/Azores',
70
-    'Cape Verde Is.' => 'Atlantic/Cape_Verde',
71
-    'Mid-Atlantic' => 'America/Noronha',
72
-    'Brasilia' => 'America/Sao_Paulo', // Best guess
73
-    'Buenos Aires' => 'America/Argentina/Buenos_Aires',
74
-    'Greenland' => 'America/Godthab',
75
-    'Newfoundland' => 'America/St_Johns',
76
-    'Atlantic Time (Canada)' => 'America/Halifax',
77
-    'Caracas, La Paz' => 'America/Caracas',
78
-    'Santiago' => 'America/Santiago',
79
-    'Bogota, Lima, Quito' => 'America/Bogota',
80
-    'Eastern Time (US & Canada)' => 'America/New_York',
81
-    'Indiana (East)' => 'America/Indiana/Indianapolis',
82
-    'Central America' => 'America/Guatemala',
83
-    'Central Time (US & Canada)' => 'America/Chicago',
84
-    'Mexico City, Tegucigalpa' => 'America/Mexico_City',
85
-    'Saskatchewan' => 'America/Edmonton',
86
-    'Arizona' => 'America/Phoenix',
87
-    'Mountain Time (US & Canada)' => 'America/Denver', // Best guess
88
-    'Pacific Time (US & Canada)' => 'America/Los_Angeles', // Best guess
89
-    'Pacific Time (US & Canada); Tijuana' => 'America/Los_Angeles', // Best guess
90
-    'Alaska' => 'America/Anchorage',
91
-    'Hawaii' => 'Pacific/Honolulu',
92
-    'Midway Island, Samoa' => 'Pacific/Midway',
93
-    'Eniwetok, Kwajalein, Dateline Time' => 'Pacific/Kwajalein',
15
+	'Universal Coordinated Time' => 'UTC',
16
+	'Casablanca, Monrovia' => 'Africa/Casablanca',
17
+	'Greenwich Mean Time: Dublin, Edinburgh, Lisbon, London' => 'Europe/Lisbon',
18
+	'Greenwich Mean Time; Dublin, Edinburgh, London' => 'Europe/London',
19
+	'Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna' => 'Europe/Berlin',
20
+	'Belgrade, Pozsony, Budapest, Ljubljana, Prague' => 'Europe/Prague',
21
+	'Brussels, Copenhagen, Madrid, Paris' => 'Europe/Paris',
22
+	'Paris, Madrid, Brussels, Copenhagen' => 'Europe/Paris',
23
+	'Prague, Central Europe' => 'Europe/Prague',
24
+	'Sarajevo, Skopje, Sofija, Vilnius, Warsaw, Zagreb' => 'Europe/Sarajevo',
25
+	'West Central Africa' => 'Africa/Luanda', // This was a best guess
26
+	'Athens, Istanbul, Minsk' => 'Europe/Athens',
27
+	'Bucharest' => 'Europe/Bucharest',
28
+	'Cairo' => 'Africa/Cairo',
29
+	'Harare, Pretoria' => 'Africa/Harare',
30
+	'Helsinki, Riga, Tallinn' => 'Europe/Helsinki',
31
+	'Israel, Jerusalem Standard Time' => 'Asia/Jerusalem',
32
+	'Baghdad' => 'Asia/Baghdad',
33
+	'Arab, Kuwait, Riyadh' => 'Asia/Kuwait',
34
+	'Moscow, St. Petersburg, Volgograd' => 'Europe/Moscow',
35
+	'East Africa, Nairobi' => 'Africa/Nairobi',
36
+	'Tehran' => 'Asia/Tehran',
37
+	'Abu Dhabi, Muscat' => 'Asia/Muscat', // Best guess
38
+	'Baku, Tbilisi, Yerevan' => 'Asia/Baku',
39
+	'Kabul' => 'Asia/Kabul',
40
+	'Ekaterinburg' => 'Asia/Yekaterinburg',
41
+	'Islamabad, Karachi, Tashkent' => 'Asia/Karachi',
42
+	'Kolkata, Chennai, Mumbai, New Delhi, India Standard Time' => 'Asia/Calcutta',
43
+	'Kathmandu, Nepal' => 'Asia/Kathmandu',
44
+	'Almaty, Novosibirsk, North Central Asia' => 'Asia/Almaty',
45
+	'Astana, Dhaka' => 'Asia/Dhaka',
46
+	'Sri Jayawardenepura, Sri Lanka' => 'Asia/Colombo',
47
+	'Rangoon' => 'Asia/Rangoon',
48
+	'Bangkok, Hanoi, Jakarta' => 'Asia/Bangkok',
49
+	'Krasnoyarsk' => 'Asia/Krasnoyarsk',
50
+	'Beijing, Chongqing, Hong Kong SAR, Urumqi' => 'Asia/Shanghai',
51
+	'Irkutsk, Ulaan Bataar' => 'Asia/Irkutsk',
52
+	'Kuala Lumpur, Singapore' => 'Asia/Singapore',
53
+	'Perth, Western Australia' => 'Australia/Perth',
54
+	'Taipei' => 'Asia/Taipei',
55
+	'Osaka, Sapporo, Tokyo' => 'Asia/Tokyo',
56
+	'Seoul, Korea Standard time' => 'Asia/Seoul',
57
+	'Yakutsk' => 'Asia/Yakutsk',
58
+	'Adelaide, Central Australia' => 'Australia/Adelaide',
59
+	'Darwin' => 'Australia/Darwin',
60
+	'Brisbane, East Australia' => 'Australia/Brisbane',
61
+	'Canberra, Melbourne, Sydney, Hobart (year 2000 only)' => 'Australia/Sydney',
62
+	'Guam, Port Moresby' => 'Pacific/Guam',
63
+	'Hobart, Tasmania' => 'Australia/Hobart',
64
+	'Vladivostok' => 'Asia/Vladivostok',
65
+	'Magadan, Solomon Is., New Caledonia' => 'Asia/Magadan',
66
+	'Auckland, Wellington' => 'Pacific/Auckland',
67
+	'Fiji Islands, Kamchatka, Marshall Is.' => 'Pacific/Fiji',
68
+	'Nuku\'alofa, Tonga' => 'Pacific/Tongatapu',
69
+	'Azores' => 'Atlantic/Azores',
70
+	'Cape Verde Is.' => 'Atlantic/Cape_Verde',
71
+	'Mid-Atlantic' => 'America/Noronha',
72
+	'Brasilia' => 'America/Sao_Paulo', // Best guess
73
+	'Buenos Aires' => 'America/Argentina/Buenos_Aires',
74
+	'Greenland' => 'America/Godthab',
75
+	'Newfoundland' => 'America/St_Johns',
76
+	'Atlantic Time (Canada)' => 'America/Halifax',
77
+	'Caracas, La Paz' => 'America/Caracas',
78
+	'Santiago' => 'America/Santiago',
79
+	'Bogota, Lima, Quito' => 'America/Bogota',
80
+	'Eastern Time (US & Canada)' => 'America/New_York',
81
+	'Indiana (East)' => 'America/Indiana/Indianapolis',
82
+	'Central America' => 'America/Guatemala',
83
+	'Central Time (US & Canada)' => 'America/Chicago',
84
+	'Mexico City, Tegucigalpa' => 'America/Mexico_City',
85
+	'Saskatchewan' => 'America/Edmonton',
86
+	'Arizona' => 'America/Phoenix',
87
+	'Mountain Time (US & Canada)' => 'America/Denver', // Best guess
88
+	'Pacific Time (US & Canada)' => 'America/Los_Angeles', // Best guess
89
+	'Pacific Time (US & Canada); Tijuana' => 'America/Los_Angeles', // Best guess
90
+	'Alaska' => 'America/Anchorage',
91
+	'Hawaii' => 'Pacific/Honolulu',
92
+	'Midway Island, Samoa' => 'Pacific/Midway',
93
+	'Eniwetok, Kwajalein, Dateline Time' => 'Pacific/Kwajalein',
94 94
 ];
Please login to merge, or discard this patch.
htdocs/includes/sabre/sabre/vobject/lib/timezonedata/php-workaround.php 1 patch
Indentation   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -15,32 +15,32 @@
 block discarded – undo
15 15
  * @license http://sabre.io/license/ Modified BSD License
16 16
  */
17 17
 return [
18
-    'CST6CDT' => 'America/Chicago',
19
-    'Cuba' => 'America/Havana',
20
-    'Egypt' => 'Africa/Cairo',
21
-    'Eire' => 'Europe/Dublin',
22
-    'EST5EDT' => 'America/New_York',
23
-    'Factory' => 'UTC',
24
-    'GB-Eire' => 'Europe/London',
25
-    'GMT0' => 'UTC',
26
-    'Greenwich' => 'UTC',
27
-    'Hongkong' => 'Asia/Hong_Kong',
28
-    'Iceland' => 'Atlantic/Reykjavik',
29
-    'Iran' => 'Asia/Tehran',
30
-    'Israel' => 'Asia/Jerusalem',
31
-    'Jamaica' => 'America/Jamaica',
32
-    'Japan' => 'Asia/Tokyo',
33
-    'Kwajalein' => 'Pacific/Kwajalein',
34
-    'Libya' => 'Africa/Tripoli',
35
-    'MST7MDT' => 'America/Denver',
36
-    'Navajo' => 'America/Denver',
37
-    'NZ-CHAT' => 'Pacific/Chatham',
38
-    'Poland' => 'Europe/Warsaw',
39
-    'Portugal' => 'Europe/Lisbon',
40
-    'PST8PDT' => 'America/Los_Angeles',
41
-    'Singapore' => 'Asia/Singapore',
42
-    'Turkey' => 'Europe/Istanbul',
43
-    'Universal' => 'UTC',
44
-    'W-SU' => 'Europe/Moscow',
45
-    'Zulu' => 'UTC',
18
+	'CST6CDT' => 'America/Chicago',
19
+	'Cuba' => 'America/Havana',
20
+	'Egypt' => 'Africa/Cairo',
21
+	'Eire' => 'Europe/Dublin',
22
+	'EST5EDT' => 'America/New_York',
23
+	'Factory' => 'UTC',
24
+	'GB-Eire' => 'Europe/London',
25
+	'GMT0' => 'UTC',
26
+	'Greenwich' => 'UTC',
27
+	'Hongkong' => 'Asia/Hong_Kong',
28
+	'Iceland' => 'Atlantic/Reykjavik',
29
+	'Iran' => 'Asia/Tehran',
30
+	'Israel' => 'Asia/Jerusalem',
31
+	'Jamaica' => 'America/Jamaica',
32
+	'Japan' => 'Asia/Tokyo',
33
+	'Kwajalein' => 'Pacific/Kwajalein',
34
+	'Libya' => 'Africa/Tripoli',
35
+	'MST7MDT' => 'America/Denver',
36
+	'Navajo' => 'America/Denver',
37
+	'NZ-CHAT' => 'Pacific/Chatham',
38
+	'Poland' => 'Europe/Warsaw',
39
+	'Portugal' => 'Europe/Lisbon',
40
+	'PST8PDT' => 'America/Los_Angeles',
41
+	'Singapore' => 'Asia/Singapore',
42
+	'Turkey' => 'Europe/Istanbul',
43
+	'Universal' => 'UTC',
44
+	'W-SU' => 'Europe/Moscow',
45
+	'Zulu' => 'UTC',
46 46
 ];
Please login to merge, or discard this patch.
htdocs/includes/sabre/sabre/vobject/lib/timezonedata/php-bc.php 1 patch
Indentation   +133 added lines, -133 removed lines patch added patch discarded remove patch
@@ -16,137 +16,137 @@
 block discarded – undo
16 16
  * @license http://sabre.io/license/ Modified BSD License
17 17
  */
18 18
 return [
19
-    'Africa/Asmera',
20
-    'Africa/Timbuktu',
21
-    'America/Argentina/ComodRivadavia',
22
-    'America/Atka',
23
-    'America/Buenos_Aires',
24
-    'America/Catamarca',
25
-    'America/Coral_Harbour',
26
-    'America/Cordoba',
27
-    'America/Ensenada',
28
-    'America/Fort_Wayne',
29
-    'America/Indianapolis',
30
-    'America/Jujuy',
31
-    'America/Knox_IN',
32
-    'America/Louisville',
33
-    'America/Mendoza',
34
-    'America/Montreal',
35
-    'America/Porto_Acre',
36
-    'America/Rosario',
37
-    'America/Shiprock',
38
-    'America/Virgin',
39
-    'Antarctica/South_Pole',
40
-    'Asia/Ashkhabad',
41
-    'Asia/Calcutta',
42
-    'Asia/Chungking',
43
-    'Asia/Dacca',
44
-    'Asia/Istanbul',
45
-    'Asia/Katmandu',
46
-    'Asia/Macao',
47
-    'Asia/Saigon',
48
-    'Asia/Tel_Aviv',
49
-    'Asia/Thimbu',
50
-    'Asia/Ujung_Pandang',
51
-    'Asia/Ulan_Bator',
52
-    'Atlantic/Faeroe',
53
-    'Atlantic/Jan_Mayen',
54
-    'Australia/ACT',
55
-    'Australia/Canberra',
56
-    'Australia/LHI',
57
-    'Australia/North',
58
-    'Australia/NSW',
59
-    'Australia/Queensland',
60
-    'Australia/South',
61
-    'Australia/Tasmania',
62
-    'Australia/Victoria',
63
-    'Australia/West',
64
-    'Australia/Yancowinna',
65
-    'Brazil/Acre',
66
-    'Brazil/DeNoronha',
67
-    'Brazil/East',
68
-    'Brazil/West',
69
-    'Canada/Atlantic',
70
-    'Canada/Central',
71
-    'Canada/Eastern',
72
-    'Canada/Mountain',
73
-    'Canada/Newfoundland',
74
-    'Canada/Pacific',
75
-    'Canada/Saskatchewan',
76
-    'Canada/Yukon',
77
-    'CET',
78
-    'Chile/Continental',
79
-    'Chile/EasterIsland',
80
-    'EET',
81
-    'EST',
82
-    'Etc/GMT',
83
-    'Etc/GMT+0',
84
-    'Etc/GMT+1',
85
-    'Etc/GMT+10',
86
-    'Etc/GMT+11',
87
-    'Etc/GMT+12',
88
-    'Etc/GMT+2',
89
-    'Etc/GMT+3',
90
-    'Etc/GMT+4',
91
-    'Etc/GMT+5',
92
-    'Etc/GMT+6',
93
-    'Etc/GMT+7',
94
-    'Etc/GMT+8',
95
-    'Etc/GMT+9',
96
-    'Etc/GMT-0',
97
-    'Etc/GMT-1',
98
-    'Etc/GMT-10',
99
-    'Etc/GMT-11',
100
-    'Etc/GMT-12',
101
-    'Etc/GMT-13',
102
-    'Etc/GMT-14',
103
-    'Etc/GMT-2',
104
-    'Etc/GMT-3',
105
-    'Etc/GMT-4',
106
-    'Etc/GMT-5',
107
-    'Etc/GMT-6',
108
-    'Etc/GMT-7',
109
-    'Etc/GMT-8',
110
-    'Etc/GMT-9',
111
-    'Etc/GMT0',
112
-    'Etc/Greenwich',
113
-    'Etc/UCT',
114
-    'Etc/Universal',
115
-    'Etc/UTC',
116
-    'Etc/Zulu',
117
-    'Europe/Belfast',
118
-    'Europe/Nicosia',
119
-    'Europe/Tiraspol',
120
-    'GB',
121
-    'GMT',
122
-    'GMT+0',
123
-    'GMT-0',
124
-    'HST',
125
-    'MET',
126
-    'Mexico/BajaNorte',
127
-    'Mexico/BajaSur',
128
-    'Mexico/General',
129
-    'MST',
130
-    'NZ',
131
-    'Pacific/Ponape',
132
-    'Pacific/Samoa',
133
-    'Pacific/Truk',
134
-    'Pacific/Yap',
135
-    'PRC',
136
-    'ROC',
137
-    'ROK',
138
-    'UCT',
139
-    'US/Alaska',
140
-    'US/Aleutian',
141
-    'US/Arizona',
142
-    'US/Central',
143
-    'US/East-Indiana',
144
-    'US/Eastern',
145
-    'US/Hawaii',
146
-    'US/Indiana-Starke',
147
-    'US/Michigan',
148
-    'US/Mountain',
149
-    'US/Pacific',
150
-    'US/Samoa',
151
-    'WET',
19
+	'Africa/Asmera',
20
+	'Africa/Timbuktu',
21
+	'America/Argentina/ComodRivadavia',
22
+	'America/Atka',
23
+	'America/Buenos_Aires',
24
+	'America/Catamarca',
25
+	'America/Coral_Harbour',
26
+	'America/Cordoba',
27
+	'America/Ensenada',
28
+	'America/Fort_Wayne',
29
+	'America/Indianapolis',
30
+	'America/Jujuy',
31
+	'America/Knox_IN',
32
+	'America/Louisville',
33
+	'America/Mendoza',
34
+	'America/Montreal',
35
+	'America/Porto_Acre',
36
+	'America/Rosario',
37
+	'America/Shiprock',
38
+	'America/Virgin',
39
+	'Antarctica/South_Pole',
40
+	'Asia/Ashkhabad',
41
+	'Asia/Calcutta',
42
+	'Asia/Chungking',
43
+	'Asia/Dacca',
44
+	'Asia/Istanbul',
45
+	'Asia/Katmandu',
46
+	'Asia/Macao',
47
+	'Asia/Saigon',
48
+	'Asia/Tel_Aviv',
49
+	'Asia/Thimbu',
50
+	'Asia/Ujung_Pandang',
51
+	'Asia/Ulan_Bator',
52
+	'Atlantic/Faeroe',
53
+	'Atlantic/Jan_Mayen',
54
+	'Australia/ACT',
55
+	'Australia/Canberra',
56
+	'Australia/LHI',
57
+	'Australia/North',
58
+	'Australia/NSW',
59
+	'Australia/Queensland',
60
+	'Australia/South',
61
+	'Australia/Tasmania',
62
+	'Australia/Victoria',
63
+	'Australia/West',
64
+	'Australia/Yancowinna',
65
+	'Brazil/Acre',
66
+	'Brazil/DeNoronha',
67
+	'Brazil/East',
68
+	'Brazil/West',
69
+	'Canada/Atlantic',
70
+	'Canada/Central',
71
+	'Canada/Eastern',
72
+	'Canada/Mountain',
73
+	'Canada/Newfoundland',
74
+	'Canada/Pacific',
75
+	'Canada/Saskatchewan',
76
+	'Canada/Yukon',
77
+	'CET',
78
+	'Chile/Continental',
79
+	'Chile/EasterIsland',
80
+	'EET',
81
+	'EST',
82
+	'Etc/GMT',
83
+	'Etc/GMT+0',
84
+	'Etc/GMT+1',
85
+	'Etc/GMT+10',
86
+	'Etc/GMT+11',
87
+	'Etc/GMT+12',
88
+	'Etc/GMT+2',
89
+	'Etc/GMT+3',
90
+	'Etc/GMT+4',
91
+	'Etc/GMT+5',
92
+	'Etc/GMT+6',
93
+	'Etc/GMT+7',
94
+	'Etc/GMT+8',
95
+	'Etc/GMT+9',
96
+	'Etc/GMT-0',
97
+	'Etc/GMT-1',
98
+	'Etc/GMT-10',
99
+	'Etc/GMT-11',
100
+	'Etc/GMT-12',
101
+	'Etc/GMT-13',
102
+	'Etc/GMT-14',
103
+	'Etc/GMT-2',
104
+	'Etc/GMT-3',
105
+	'Etc/GMT-4',
106
+	'Etc/GMT-5',
107
+	'Etc/GMT-6',
108
+	'Etc/GMT-7',
109
+	'Etc/GMT-8',
110
+	'Etc/GMT-9',
111
+	'Etc/GMT0',
112
+	'Etc/Greenwich',
113
+	'Etc/UCT',
114
+	'Etc/Universal',
115
+	'Etc/UTC',
116
+	'Etc/Zulu',
117
+	'Europe/Belfast',
118
+	'Europe/Nicosia',
119
+	'Europe/Tiraspol',
120
+	'GB',
121
+	'GMT',
122
+	'GMT+0',
123
+	'GMT-0',
124
+	'HST',
125
+	'MET',
126
+	'Mexico/BajaNorte',
127
+	'Mexico/BajaSur',
128
+	'Mexico/General',
129
+	'MST',
130
+	'NZ',
131
+	'Pacific/Ponape',
132
+	'Pacific/Samoa',
133
+	'Pacific/Truk',
134
+	'Pacific/Yap',
135
+	'PRC',
136
+	'ROC',
137
+	'ROK',
138
+	'UCT',
139
+	'US/Alaska',
140
+	'US/Aleutian',
141
+	'US/Arizona',
142
+	'US/Central',
143
+	'US/East-Indiana',
144
+	'US/Eastern',
145
+	'US/Hawaii',
146
+	'US/Indiana-Starke',
147
+	'US/Michigan',
148
+	'US/Mountain',
149
+	'US/Pacific',
150
+	'US/Samoa',
151
+	'WET',
152 152
 ];
Please login to merge, or discard this patch.
htdocs/includes/sabre/sabre/vobject/lib/PHPUnitAssertions.php 2 patches
Indentation   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -14,62 +14,62 @@
 block discarded – undo
14 14
  */
15 15
 trait PHPUnitAssertions
16 16
 {
17
-    /**
18
-     * This method tests whether two vcards or icalendar objects are
19
-     * semantically identical.
20
-     *
21
-     * It supports objects being supplied as strings, streams or
22
-     * Sabre\VObject\Component instances.
23
-     *
24
-     * PRODID is removed from both objects as this is often changes and would
25
-     * just get in the way.
26
-     *
27
-     * CALSCALE will automatically get removed if it's set to GREGORIAN.
28
-     *
29
-     * Any property that has the value **ANY** will be treated as a wildcard.
30
-     *
31
-     * @param resource|string|Component $expected
32
-     * @param resource|string|Component $actual
33
-     * @param string                    $message
34
-     */
35
-    public function assertVObjectEqualsVObject($expected, $actual, $message = '')
36
-    {
37
-        $getObj = function ($input) {
38
-            if (is_resource($input)) {
39
-                $input = stream_get_contents($input);
40
-            }
41
-            if (is_string($input)) {
42
-                $input = Reader::read($input);
43
-            }
44
-            if (!$input instanceof Component) {
45
-                $this->fail('Input must be a string, stream or VObject component');
46
-            }
47
-            unset($input->PRODID);
48
-            if ($input instanceof Component\VCalendar && 'GREGORIAN' === (string) $input->CALSCALE) {
49
-                unset($input->CALSCALE);
50
-            }
17
+	/**
18
+	 * This method tests whether two vcards or icalendar objects are
19
+	 * semantically identical.
20
+	 *
21
+	 * It supports objects being supplied as strings, streams or
22
+	 * Sabre\VObject\Component instances.
23
+	 *
24
+	 * PRODID is removed from both objects as this is often changes and would
25
+	 * just get in the way.
26
+	 *
27
+	 * CALSCALE will automatically get removed if it's set to GREGORIAN.
28
+	 *
29
+	 * Any property that has the value **ANY** will be treated as a wildcard.
30
+	 *
31
+	 * @param resource|string|Component $expected
32
+	 * @param resource|string|Component $actual
33
+	 * @param string                    $message
34
+	 */
35
+	public function assertVObjectEqualsVObject($expected, $actual, $message = '')
36
+	{
37
+		$getObj = function ($input) {
38
+			if (is_resource($input)) {
39
+				$input = stream_get_contents($input);
40
+			}
41
+			if (is_string($input)) {
42
+				$input = Reader::read($input);
43
+			}
44
+			if (!$input instanceof Component) {
45
+				$this->fail('Input must be a string, stream or VObject component');
46
+			}
47
+			unset($input->PRODID);
48
+			if ($input instanceof Component\VCalendar && 'GREGORIAN' === (string) $input->CALSCALE) {
49
+				unset($input->CALSCALE);
50
+			}
51 51
 
52
-            return $input;
53
-        };
52
+			return $input;
53
+		};
54 54
 
55
-        $expected = $getObj($expected)->serialize();
56
-        $actual = $getObj($actual)->serialize();
55
+		$expected = $getObj($expected)->serialize();
56
+		$actual = $getObj($actual)->serialize();
57 57
 
58
-        // Finding wildcards in expected.
59
-        preg_match_all('|^([A-Z]+):\\*\\*ANY\\*\\*\r$|m', $expected, $matches, PREG_SET_ORDER);
58
+		// Finding wildcards in expected.
59
+		preg_match_all('|^([A-Z]+):\\*\\*ANY\\*\\*\r$|m', $expected, $matches, PREG_SET_ORDER);
60 60
 
61
-        foreach ($matches as $match) {
62
-            $actual = preg_replace(
63
-                '|^'.preg_quote($match[1], '|').':(.*)\r$|m',
64
-                $match[1].':**ANY**'."\r",
65
-                $actual
66
-            );
67
-        }
61
+		foreach ($matches as $match) {
62
+			$actual = preg_replace(
63
+				'|^'.preg_quote($match[1], '|').':(.*)\r$|m',
64
+				$match[1].':**ANY**'."\r",
65
+				$actual
66
+			);
67
+		}
68 68
 
69
-        $this->assertEquals(
70
-            $expected,
71
-            $actual,
72
-            $message
73
-        );
74
-    }
69
+		$this->assertEquals(
70
+			$expected,
71
+			$actual,
72
+			$message
73
+		);
74
+	}
75 75
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@
 block discarded – undo
34 34
      */
35 35
     public function assertVObjectEqualsVObject($expected, $actual, $message = '')
36 36
     {
37
-        $getObj = function ($input) {
37
+        $getObj = function($input) {
38 38
             if (is_resource($input)) {
39 39
                 $input = stream_get_contents($input);
40 40
             }
Please login to merge, or discard this patch.
htdocs/includes/sabre/sabre/vobject/lib/Splitter/VCard.php 1 patch
Indentation   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -21,54 +21,54 @@
 block discarded – undo
21 21
  */
22 22
 class VCard implements SplitterInterface
23 23
 {
24
-    /**
25
-     * File handle.
26
-     *
27
-     * @var resource
28
-     */
29
-    protected $input;
24
+	/**
25
+	 * File handle.
26
+	 *
27
+	 * @var resource
28
+	 */
29
+	protected $input;
30 30
 
31
-    /**
32
-     * Persistent parser.
33
-     *
34
-     * @var MimeDir
35
-     */
36
-    protected $parser;
31
+	/**
32
+	 * Persistent parser.
33
+	 *
34
+	 * @var MimeDir
35
+	 */
36
+	protected $parser;
37 37
 
38
-    /**
39
-     * Constructor.
40
-     *
41
-     * The splitter should receive an readable file stream as its input.
42
-     *
43
-     * @param resource $input
44
-     * @param int      $options parser options, see the OPTIONS constants
45
-     */
46
-    public function __construct($input, $options = 0)
47
-    {
48
-        $this->input = $input;
49
-        $this->parser = new MimeDir($input, $options);
50
-    }
38
+	/**
39
+	 * Constructor.
40
+	 *
41
+	 * The splitter should receive an readable file stream as its input.
42
+	 *
43
+	 * @param resource $input
44
+	 * @param int      $options parser options, see the OPTIONS constants
45
+	 */
46
+	public function __construct($input, $options = 0)
47
+	{
48
+		$this->input = $input;
49
+		$this->parser = new MimeDir($input, $options);
50
+	}
51 51
 
52
-    /**
53
-     * Every time getNext() is called, a new object will be parsed, until we
54
-     * hit the end of the stream.
55
-     *
56
-     * When the end is reached, null will be returned.
57
-     *
58
-     * @return \Sabre\VObject\Component|null
59
-     */
60
-    public function getNext()
61
-    {
62
-        try {
63
-            $object = $this->parser->parse();
52
+	/**
53
+	 * Every time getNext() is called, a new object will be parsed, until we
54
+	 * hit the end of the stream.
55
+	 *
56
+	 * When the end is reached, null will be returned.
57
+	 *
58
+	 * @return \Sabre\VObject\Component|null
59
+	 */
60
+	public function getNext()
61
+	{
62
+		try {
63
+			$object = $this->parser->parse();
64 64
 
65
-            if (!$object instanceof VObject\Component\VCard) {
66
-                throw new VObject\ParseException('The supplied input contained non-VCARD data.');
67
-            }
68
-        } catch (VObject\EofException $e) {
69
-            return;
70
-        }
65
+			if (!$object instanceof VObject\Component\VCard) {
66
+				throw new VObject\ParseException('The supplied input contained non-VCARD data.');
67
+			}
68
+		} catch (VObject\EofException $e) {
69
+			return;
70
+		}
71 71
 
72
-        return $object;
73
-    }
72
+		return $object;
73
+	}
74 74
 }
Please login to merge, or discard this patch.
htdocs/includes/sabre/sabre/vobject/lib/Splitter/ICalendar.php 1 patch
Indentation   +71 added lines, -71 removed lines patch added patch discarded remove patch
@@ -21,86 +21,86 @@
 block discarded – undo
21 21
  */
22 22
 class ICalendar implements SplitterInterface
23 23
 {
24
-    /**
25
-     * Timezones.
26
-     *
27
-     * @var array
28
-     */
29
-    protected $vtimezones = [];
24
+	/**
25
+	 * Timezones.
26
+	 *
27
+	 * @var array
28
+	 */
29
+	protected $vtimezones = [];
30 30
 
31
-    /**
32
-     * iCalendar objects.
33
-     *
34
-     * @var array
35
-     */
36
-    protected $objects = [];
31
+	/**
32
+	 * iCalendar objects.
33
+	 *
34
+	 * @var array
35
+	 */
36
+	protected $objects = [];
37 37
 
38
-    /**
39
-     * Constructor.
40
-     *
41
-     * The splitter should receive an readable file stream as its input.
42
-     *
43
-     * @param resource $input
44
-     * @param int      $options parser options, see the OPTIONS constants
45
-     */
46
-    public function __construct($input, $options = 0)
47
-    {
48
-        $data = VObject\Reader::read($input, $options);
38
+	/**
39
+	 * Constructor.
40
+	 *
41
+	 * The splitter should receive an readable file stream as its input.
42
+	 *
43
+	 * @param resource $input
44
+	 * @param int      $options parser options, see the OPTIONS constants
45
+	 */
46
+	public function __construct($input, $options = 0)
47
+	{
48
+		$data = VObject\Reader::read($input, $options);
49 49
 
50
-        if (!$data instanceof VObject\Component\VCalendar) {
51
-            throw new VObject\ParseException('Supplied input could not be parsed as VCALENDAR.');
52
-        }
50
+		if (!$data instanceof VObject\Component\VCalendar) {
51
+			throw new VObject\ParseException('Supplied input could not be parsed as VCALENDAR.');
52
+		}
53 53
 
54
-        foreach ($data->children() as $component) {
55
-            if (!$component instanceof VObject\Component) {
56
-                continue;
57
-            }
54
+		foreach ($data->children() as $component) {
55
+			if (!$component instanceof VObject\Component) {
56
+				continue;
57
+			}
58 58
 
59
-            // Get all timezones
60
-            if ('VTIMEZONE' === $component->name) {
61
-                $this->vtimezones[(string) $component->TZID] = $component;
62
-                continue;
63
-            }
59
+			// Get all timezones
60
+			if ('VTIMEZONE' === $component->name) {
61
+				$this->vtimezones[(string) $component->TZID] = $component;
62
+				continue;
63
+			}
64 64
 
65
-            // Get component UID for recurring Events search
66
-            if (!$component->UID) {
67
-                $component->UID = sha1(microtime()).'-vobjectimport';
68
-            }
69
-            $uid = (string) $component->UID;
65
+			// Get component UID for recurring Events search
66
+			if (!$component->UID) {
67
+				$component->UID = sha1(microtime()).'-vobjectimport';
68
+			}
69
+			$uid = (string) $component->UID;
70 70
 
71
-            // Take care of recurring events
72
-            if (!array_key_exists($uid, $this->objects)) {
73
-                $this->objects[$uid] = new VCalendar();
74
-            }
71
+			// Take care of recurring events
72
+			if (!array_key_exists($uid, $this->objects)) {
73
+				$this->objects[$uid] = new VCalendar();
74
+			}
75 75
 
76
-            $this->objects[$uid]->add(clone $component);
77
-        }
78
-    }
76
+			$this->objects[$uid]->add(clone $component);
77
+		}
78
+	}
79 79
 
80
-    /**
81
-     * Every time getNext() is called, a new object will be parsed, until we
82
-     * hit the end of the stream.
83
-     *
84
-     * When the end is reached, null will be returned.
85
-     *
86
-     * @return \Sabre\VObject\Component|null
87
-     */
88
-    public function getNext()
89
-    {
90
-        if ($object = array_shift($this->objects)) {
91
-            // create our baseobject
92
-            $object->version = '2.0';
93
-            $object->prodid = '-//Sabre//Sabre VObject '.VObject\Version::VERSION.'//EN';
94
-            $object->calscale = 'GREGORIAN';
80
+	/**
81
+	 * Every time getNext() is called, a new object will be parsed, until we
82
+	 * hit the end of the stream.
83
+	 *
84
+	 * When the end is reached, null will be returned.
85
+	 *
86
+	 * @return \Sabre\VObject\Component|null
87
+	 */
88
+	public function getNext()
89
+	{
90
+		if ($object = array_shift($this->objects)) {
91
+			// create our baseobject
92
+			$object->version = '2.0';
93
+			$object->prodid = '-//Sabre//Sabre VObject '.VObject\Version::VERSION.'//EN';
94
+			$object->calscale = 'GREGORIAN';
95 95
 
96
-            // add vtimezone information to obj (if we have it)
97
-            foreach ($this->vtimezones as $vtimezone) {
98
-                $object->add($vtimezone);
99
-            }
96
+			// add vtimezone information to obj (if we have it)
97
+			foreach ($this->vtimezones as $vtimezone) {
98
+				$object->add($vtimezone);
99
+			}
100 100
 
101
-            return $object;
102
-        } else {
103
-            return;
104
-        }
105
-    }
101
+			return $object;
102
+		} else {
103
+			return;
104
+		}
105
+	}
106 106
 }
Please login to merge, or discard this patch.