1 | <?php |
||
7 | class ZendeskMessage |
||
8 | { |
||
9 | /** @var int|null */ |
||
10 | protected $ticket; |
||
11 | |||
12 | /** @var string */ |
||
13 | protected $subject; |
||
14 | |||
15 | /** @var array */ |
||
16 | protected $requester = []; |
||
17 | |||
18 | /** @var string */ |
||
19 | protected $description = ''; |
||
20 | |||
21 | /** @var string */ |
||
22 | protected $type; |
||
23 | |||
24 | /** @var string */ |
||
25 | protected $status = 'new'; |
||
26 | |||
27 | /** @var array */ |
||
28 | protected $tags = []; |
||
29 | |||
30 | /** @var string */ |
||
31 | protected $content = ''; |
||
32 | |||
33 | /** @var string */ |
||
34 | protected $htmlContent = ''; |
||
35 | |||
36 | /** @var bool */ |
||
37 | protected $isPublic = false; |
||
38 | |||
39 | /** @var string */ |
||
40 | protected $priority = 'normal'; |
||
41 | |||
42 | /** @var array */ |
||
43 | protected $customFields = []; |
||
44 | |||
45 | /** @var int */ |
||
46 | protected $groupId = ''; |
||
47 | |||
48 | /** |
||
49 | * @param string $subject |
||
50 | * |
||
51 | * @return static |
||
52 | */ |
||
53 | 1 | public static function create($subject = '', $description = '') |
|
57 | |||
58 | /** |
||
59 | * @param string $subject |
||
60 | */ |
||
61 | 10 | public function __construct($subject = '', $description = '') |
|
67 | |||
68 | /** |
||
69 | * Set the ticket subject. |
||
70 | * |
||
71 | * @param $subject |
||
72 | * |
||
73 | * @return $this |
||
74 | */ |
||
75 | public function subject($subject) |
||
81 | |||
82 | /** |
||
83 | * Set the ticket customer name. |
||
84 | * |
||
85 | * @param string $name |
||
86 | * @param string $email |
||
87 | * |
||
88 | * @return $this |
||
89 | */ |
||
90 | 2 | public function from($name, $email) |
|
99 | |||
100 | /** |
||
101 | * Set the content message. |
||
102 | * |
||
103 | * @param $content |
||
104 | * |
||
105 | * @return $this |
||
106 | */ |
||
107 | 3 | public function content($content) |
|
113 | |||
114 | /** |
||
115 | * Set the HTML content of message. |
||
116 | * |
||
117 | * @param string $html |
||
118 | * |
||
119 | * @return $this |
||
120 | */ |
||
121 | public function htmlContent($html) |
||
127 | |||
128 | /** |
||
129 | * Set the description. |
||
130 | * |
||
131 | * @param string $description |
||
132 | * |
||
133 | * @return $this |
||
134 | */ |
||
135 | 2 | public function description($description) |
|
141 | |||
142 | /** |
||
143 | * Set the ticket type. |
||
144 | * Allowed values are problem, incident, question, or task. |
||
145 | * |
||
146 | * @param string $type |
||
147 | * |
||
148 | * @return $this |
||
149 | */ |
||
150 | 1 | public function type($type) |
|
159 | |||
160 | /** |
||
161 | * Set the ticket priority. |
||
162 | * Allowed values are urgent, high, normal, or low. |
||
163 | * |
||
164 | * @param string $priority |
||
165 | * |
||
166 | * @return $this |
||
167 | */ |
||
168 | 1 | public function priority($priority) |
|
177 | |||
178 | /** |
||
179 | * Set the ticket status. |
||
180 | * Allowed values are new, open, pending, hold, solved or closed. |
||
181 | * |
||
182 | * @return $this |
||
183 | */ |
||
184 | 2 | public function status($status) |
|
193 | |||
194 | /** |
||
195 | * Set the message to be public. |
||
196 | * |
||
197 | * @return $this |
||
198 | */ |
||
199 | 2 | public function visible() |
|
205 | |||
206 | /** |
||
207 | * Add a tag to the ticket. |
||
208 | * |
||
209 | * @param string $tag |
||
210 | * |
||
211 | * @return $this |
||
212 | */ |
||
213 | public function tag($tag) |
||
219 | |||
220 | /** |
||
221 | * Set the value of custom field in the new ticket. |
||
222 | * |
||
223 | * @param int $id |
||
224 | * @param string $value |
||
225 | * |
||
226 | * @return $this |
||
227 | */ |
||
228 | public function customField($id, $value) |
||
237 | |||
238 | /** |
||
239 | * Set the value of group id. |
||
240 | * |
||
241 | * @param int $id |
||
242 | * |
||
243 | * @return $this |
||
244 | */ |
||
245 | public function group($id) |
||
251 | |||
252 | /** |
||
253 | * Set the ticket id. If it set the system will update |
||
254 | * the ticket rather than create a new ticket. |
||
255 | * |
||
256 | * @param int $id |
||
257 | * |
||
258 | * @return $this |
||
259 | */ |
||
260 | 1 | public function ticket($id) |
|
266 | |||
267 | /** |
||
268 | * Return the comment array. |
||
269 | * |
||
270 | * @see https://developer.zendesk.com/rest_api/docs/core/ticket_audits#audit-events Documentation of ticket comment. |
||
271 | * |
||
272 | * @return array |
||
273 | */ |
||
274 | 7 | public function getComment() |
|
290 | |||
291 | /** |
||
292 | * @return array |
||
293 | */ |
||
294 | 7 | public function toArray() |
|
310 | } |
||
311 |