7
|
1 <?php
|
|
2
|
|
3 namespace Sabre\VObject\Component;
|
|
4
|
|
5 use Sabre\VObject;
|
|
6
|
|
7 /**
|
|
8 * The VTimeZone component
|
|
9 *
|
|
10 * This component adds functionality to a component, specific for VTIMEZONE
|
|
11 * components.
|
|
12 *
|
|
13 * @copyright Copyright (C) 2011-2015 fruux GmbH (https://fruux.com/).
|
|
14 * @author Evert Pot (http://evertpot.com/)
|
|
15 * @license http://sabre.io/license/ Modified BSD License
|
|
16 */
|
|
17 class VTimeZone extends VObject\Component {
|
|
18
|
|
19 /**
|
|
20 * Returns the PHP DateTimeZone for this VTIMEZONE component.
|
|
21 *
|
|
22 * If we can't accurately determine the timezone, this method will return
|
|
23 * UTC.
|
|
24 *
|
|
25 * @return \DateTimeZone
|
|
26 */
|
|
27 function getTimeZone() {
|
|
28
|
|
29 return VObject\TimeZoneUtil::getTimeZone((string)$this->TZID, $this->root);
|
|
30
|
|
31 }
|
|
32
|
|
33 /**
|
|
34 * A simple list of validation rules.
|
|
35 *
|
|
36 * This is simply a list of properties, and how many times they either
|
|
37 * must or must not appear.
|
|
38 *
|
|
39 * Possible values per property:
|
|
40 * * 0 - Must not appear.
|
|
41 * * 1 - Must appear exactly once.
|
|
42 * * + - Must appear at least once.
|
|
43 * * * - Can appear any number of times.
|
|
44 *
|
|
45 * @var array
|
|
46 */
|
|
47 function getValidationRules() {
|
|
48
|
|
49 return array(
|
|
50 'TZID' => 1,
|
|
51
|
|
52 'LAST-MODIFICATION' => '?',
|
|
53 'TZURL' => '?',
|
|
54
|
|
55 // At least 1 STANDARD or DAYLIGHT must appear, or more. But both
|
|
56 // cannot appear in the same VTIMEZONE.
|
|
57 //
|
|
58 // The validator is not specific yet to pick this up, so these
|
|
59 // rules are too loose.
|
|
60 'STANDARD' => '*',
|
|
61 'DAYLIGHT' => '*',
|
|
62 );
|
|
63
|
|
64 }
|
|
65
|
|
66 }
|
|
67
|