1 | <?php |
||
20 | class PulseNote extends ApiObject |
||
21 | { |
||
22 | const API_PREFIX = "pulses"; |
||
23 | |||
24 | // ================================================================================================================ |
||
25 | // Instance Variables |
||
26 | // ================================================================================================================ |
||
27 | |||
28 | /** |
||
29 | * The collaboration box type (rich_text, file_list, faq_list). |
||
30 | * |
||
31 | * @var string |
||
32 | */ |
||
33 | protected $type; |
||
34 | |||
35 | /** |
||
36 | * The note's title. |
||
37 | * |
||
38 | * @var string |
||
39 | */ |
||
40 | protected $title; |
||
41 | |||
42 | /** |
||
43 | * The note's project_id. |
||
44 | * |
||
45 | * @var string |
||
46 | */ |
||
47 | protected $project_id; |
||
48 | |||
49 | /** |
||
50 | * Describes who can edit this note. Can be either 'everyone' or 'owners'. |
||
51 | * |
||
52 | * @var string |
||
53 | */ |
||
54 | protected $permissions; |
||
55 | |||
56 | /** |
||
57 | * The note's body |
||
58 | * |
||
59 | * @var string |
||
60 | */ |
||
61 | protected $content; |
||
62 | |||
63 | /** |
||
64 | * Creation time. |
||
65 | * |
||
66 | * @var \DateTime |
||
67 | */ |
||
68 | protected $created_at; |
||
69 | |||
70 | /** |
||
71 | * Last update time. |
||
72 | * |
||
73 | * @var \DateTime |
||
74 | */ |
||
75 | protected $updated_at; |
||
76 | |||
77 | /** |
||
78 | * PulseNote constructor. |
||
79 | * |
||
80 | * @internal |
||
81 | * |
||
82 | * @param array $array |
||
83 | */ |
||
84 | 1 | public function __construct ($array) |
|
90 | |||
91 | // ================================================================================================================ |
||
92 | // Getter functions |
||
93 | // ================================================================================================================ |
||
94 | |||
95 | /** |
||
96 | * The collaboration box type (rich_text, file_list, faq_list). |
||
97 | * |
||
98 | * @api |
||
99 | * |
||
100 | * @since 0.1.0 |
||
101 | * |
||
102 | * @return string |
||
103 | */ |
||
104 | 1 | public function getType () |
|
108 | |||
109 | /** |
||
110 | * The note's id. |
||
111 | * |
||
112 | * @api |
||
113 | * |
||
114 | * @since 0.1.0 |
||
115 | * |
||
116 | * @return string |
||
|
|||
117 | */ |
||
118 | 2 | public function getId () |
|
122 | |||
123 | /** |
||
124 | * The note's title. |
||
125 | * |
||
126 | * @api |
||
127 | * |
||
128 | * @since 0.1.0 |
||
129 | * |
||
130 | * @return string |
||
131 | */ |
||
132 | 2 | public function getTitle () |
|
136 | |||
137 | /** |
||
138 | * The note's project_id. |
||
139 | * |
||
140 | * @api |
||
141 | * |
||
142 | * @since 0.1.0 |
||
143 | * |
||
144 | * @return string |
||
145 | */ |
||
146 | 2 | public function getPulseId () |
|
150 | |||
151 | /** |
||
152 | * Describes who can edit this note. Can be either 'everyone' or 'owners'. |
||
153 | * |
||
154 | * @api |
||
155 | * |
||
156 | * @since 0.1.0 |
||
157 | * |
||
158 | * @return string |
||
159 | */ |
||
160 | 1 | public function getPermissions () |
|
164 | |||
165 | /** |
||
166 | * The note's body. |
||
167 | * |
||
168 | * @api |
||
169 | * |
||
170 | * @since 0.1.0 |
||
171 | * |
||
172 | * @return string |
||
173 | */ |
||
174 | 2 | public function getContent () |
|
178 | |||
179 | /** |
||
180 | * Creation time. |
||
181 | * |
||
182 | * @api |
||
183 | * |
||
184 | * @since 0.1.0 |
||
185 | * |
||
186 | * @return \DateTime |
||
187 | */ |
||
188 | 1 | public function getCreatedAt () |
|
194 | |||
195 | /** |
||
196 | * Last update time. |
||
197 | * |
||
198 | * @api |
||
199 | * |
||
200 | * @since 0.1.0 |
||
201 | * |
||
202 | * @return \DateTime |
||
203 | */ |
||
204 | 1 | public function getUpdatedAt () |
|
210 | |||
211 | // ================================================================================================================ |
||
212 | // Modification functions |
||
213 | // ================================================================================================================ |
||
214 | |||
215 | /** |
||
216 | * Edit a note's content or information. Set values to NULL in order to not update them |
||
217 | * |
||
218 | * @api |
||
219 | * |
||
220 | * @param null|string $title The new title of the note |
||
221 | * @param null|string $content The new content of the note |
||
222 | * @param null|int|PulseUser $user The new author of the note |
||
223 | * @param null|bool $createUpdate Whether to create an update or not |
||
224 | * |
||
225 | * @since 0.1.0 |
||
226 | * |
||
227 | * @throws InvalidObjectException The object has already been deleted from DaPulse |
||
228 | * @throws \InvalidArgumentException An update was to be created but no author for the update was specified |
||
229 | * |
||
230 | * @return $this |
||
231 | */ |
||
232 | 1 | public function editNote ($title = null, $content = null, $user = null, $createUpdate = null) |
|
262 | |||
263 | /** |
||
264 | * Edit the title of the note only. |
||
265 | * |
||
266 | * **Note** This is a convenience function that just calls PulseNote->editNote(). In order to change multiple |
||
267 | * values, use PulseNote->editNote() instead of chaining the individual edit functions because each convenience |
||
268 | * function will make their own separate API call making the process significantly slower. |
||
269 | * |
||
270 | * @api |
||
271 | * |
||
272 | * @param string $title The new title of the note |
||
273 | * |
||
274 | * @since 0.1.0 |
||
275 | * |
||
276 | * @return $this |
||
277 | */ |
||
278 | 1 | public function editTitle ($title) |
|
282 | |||
283 | /** |
||
284 | * Edit the content of the note only. |
||
285 | * |
||
286 | * **Note** This is a convenience function that just calls PulseNote->editNote(). In order to change multiple |
||
287 | * values, use PulseNote->editNote() instead of chaining the individual edit functions because each convenience |
||
288 | * function will make their own separate API call making the process significantly slower. |
||
289 | * |
||
290 | * @api |
||
291 | * |
||
292 | * @param string $content The new content of the note |
||
293 | * |
||
294 | * @since 0.1.0 |
||
295 | * |
||
296 | * @return $this |
||
297 | */ |
||
298 | 1 | public function editContent ($content) |
|
302 | |||
303 | /** |
||
304 | * Edit the author of the note only. |
||
305 | * |
||
306 | * **Note** This is a convenience function that just calls PulseNote->editNote(). In order to change multiple |
||
307 | * values, use PulseNote->editNote() instead of chaining the individual edit functions because each convenience |
||
308 | * function will make their own separate API call making the process significantly slower. |
||
309 | * |
||
310 | * @api |
||
311 | * |
||
312 | * @param string $userId The new author of the note |
||
313 | * |
||
314 | * @since 0.1.0 |
||
315 | * |
||
316 | * @return $this |
||
317 | */ |
||
318 | public function editAuthor ($userId) |
||
322 | |||
323 | /** |
||
324 | * Delete this note |
||
325 | * |
||
326 | * @api |
||
327 | * |
||
328 | * @since 0.1.0 |
||
329 | * |
||
330 | * @throws InvalidObjectException The object has already been deleted from DaPulse |
||
331 | */ |
||
332 | 1 | public function deleteNote () |
|
340 | |||
341 | 2 | private function getNotesUrl () |
|
345 | } |
This check compares the return type specified in the
@return
annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.