1<?php
2
3namespace Sabre\VObject\ITip;
4
5/**
6 * This class represents an iTip message
7 *
8 * A message holds all the information relevant to the message, including the
9 * object itself.
10 *
11 * It should for the most part be treated as immutable.
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 */
17class Message {
18
19    /**
20     * The object's UID
21     *
22     * @var string
23     */
24    public $uid;
25
26    /**
27     * The component type, such as VEVENT
28     *
29     * @var string
30     */
31    public $component;
32
33    /**
34     * Contains the ITip method, which is something like REQUEST, REPLY or
35     * CANCEL.
36     *
37     * @var string
38     */
39    public $method;
40
41    /**
42     * The current sequence number for the event.
43     *
44     * @var int
45     */
46    public $sequence;
47
48    /**
49     * The senders' email address.
50     *
51     * Note that this does not imply that this has to be used in a From: field
52     * if the message is sent by email. It may also be populated in Reply-To:
53     * or not at all.
54     *
55     * @var string
56     */
57    public $sender;
58
59    /**
60     * The name of the sender. This is often populated from a CN parameter from
61     * either the ORGANIZER or ATTENDEE, depending on the message.
62     *
63     * @var string|null
64     */
65    public $senderName;
66
67    /**
68     * The recipient's email address.
69     *
70     * @var string
71     */
72    public $recipient;
73
74    /**
75     * The name of the recipient. This is usually populated with the CN
76     * parameter from the ATTENDEE or ORGANIZER property, if it's available.
77     *
78     * @var string|null
79     */
80    public $recipientName;
81
82    /**
83     * After the message has been delivered, this should contain a string such
84     * as : 1.1;Sent or 1.2;Delivered.
85     *
86     * In case of a failure, this will hold the error status code.
87     *
88     * See:
89     * http://tools.ietf.org/html/rfc6638#section-7.3
90     *
91     * @var string
92     */
93    public $scheduleStatus;
94
95    /**
96     * The iCalendar / iTip body.
97     *
98     * @var \Sabre\VObject\Component\VCalendar
99     */
100    public $message;
101
102    /**
103     * This will be set to true, if the iTip broker considers the change
104     * 'significant'.
105     *
106     * In practice, this means that we'll only mark it true, if for instance
107     * DTSTART changed. This allows systems to only send iTip messages when
108     * significant changes happened. This is especially useful for iMip, as
109     * normally a ton of messages may be generated for normal calendar use.
110     *
111     * To see the list of properties that are considered 'significant', check
112     * out Sabre\VObject\ITip\Broker::$significantChangeProperties.
113     *
114     * @var bool
115     */
116    public $significantChange = true;
117
118    /**
119     * Returns the schedule status as a string.
120     *
121     * For example:
122     * 1.2
123     *
124     * @return mixed bool|string
125     */
126    public function getScheduleStatus() {
127
128        if(!$this->scheduleStatus) {
129
130            return false;
131
132        } else {
133
134            list($scheduleStatus) = explode(';', $this->scheduleStatus);
135            return $scheduleStatus;
136
137        }
138
139    }
140
141}
142