Events::all()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 58
Code Lines 55

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 55
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
dl 0
loc 58
ccs 55
cts 55
cp 1
rs 9.639
c 1
b 0
f 1
cc 1
eloc 55
nc 1
nop 0
crap 1

How to fix   Long Method   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
3
namespace Trello;
4
5
/**
6
 * Trello API events
7
 * @link https://trello.com/docs/api/card/#get-1-cards-card-id-or-shortlink-actions
8
 */
9
final class Events
10
{
11
    /**************************************************************************************
12
     * Board Events                                                                       *
13
     **************************************************************************************/
14
15
    /**
16
     * When a board is created
17
     * The event listener method receives a Trello\Event\BoardEvent instance.
18
     */
19
    const BOARD_CREATE                        = 'createBoard';
20
21
    /**
22
     * When a board is updated
23
     * The event listener method receives a Trello\Event\BoardEvent instance.
24
     */
25
    const BOARD_UPDATE                        = 'updateBoard';
26
27
    /**
28
     * When a board is copied
29
     * The event listener method receives a Trello\Event\BoardEvent instance.
30
     */
31
    const BOARD_COPY                          = 'copyBoard';
32
33
    /**
34
     * When a card is moved from a board
35
     * The event listener method receives a Trello\Event\CardMoveEvent instance.
36
     */
37
    const BOARD_MOVE_CARD_FROM                = 'moveCardFromBoard';
38
39
    /**
40
     * When a card is moved to a board
41
     * The event listener method receives a Trello\Event\CardMoveEvent instance.
42
     */
43
    const BOARD_MOVE_CARD_TO                  = 'moveCardToBoard';
44
45
    /**
46
     * When a card is moved from a board
47
     * The event listener method receives a Trello\Event\ListMoveEvent instance.
48
     */
49
    const BOARD_MOVE_LIST_FROM                = 'moveListFromBoard';
50
51
    /**
52
     * When a card is moved to a board
53
     * The event listener method receives a Trello\Event\ListMoveEvent instance.
54
     */
55
    const BOARD_MOVE_LIST_TO                  = 'moveListToBoard';
56
57
    /**
58
     * When a member is added to a board
59
     * The event listener method receives a Trello\Event\BoardMemberEvent instance.
60
     */
61
    const BOARD_ADD_MEMBER                    = 'addMemberToBoard';
62
63
    /**
64
     * When a member becomes admin of a board
65
     * The event listener method receives a Trello\Event\BoardMemberEvent instance.
66
     */
67
    const BOARD_MAKE_ADMIN                    = 'makeAdminOfBoard';
68
69
    /**
70
     * When a member becomes normal member of a board
71
     * The event listener method receives a Trello\Event\BoardMemberEvent instance.
72
     */
73
    const BOARD_MAKE_NORMAL_MEMBER            = 'makeNormalMemberOfBoard';
74
75
    /**
76
     * When a member becomes observer of a board
77
     * The event listener method receives a Trello\Event\BoardMemberEvent instance.
78
     */
79
    const BOARD_MAKE_OBSERVER                 = 'makeObserverOfBoard';
80
81
    /**
82
     * When a member looses admin rights on a board
83
     * The event listener method receives a Trello\Event\BoardMemberEvent instance.
84
     */
85
    const BOARD_REMOVE_ADMIN                  = 'removeAdminFromBoard';
86
87
    /**
88
     * When an invitation is deleted
89
     * The event listener method receives a Trello\Event\BoardMemberEvent instance.
90
     */
91
    const BOARD_DELETE_INVITATION             = 'deleteBoardInvitation';
92
93
    /**
94
     * When an invitation is in unconfirmed state
95
     * The event listener method receives a Trello\Event\BoardMemberEvent instance.
96
     */
97
    const BOARD_UNCONFIRMED_INVITATION        = 'unconfirmedBoardInvitation';
98
99
    /**
100
     * When a board is added to an organization
101
     * The event listener method receives a Trello\Event\BoardOrganizationEvent instance.
102
     */
103
    const BOARD_ADD_TO_ORGANIZATION           = 'addToOrganizationBoard';
104
105
    /**
106
     * When a board is removed from an organization
107
     * The event listener method receives a Trello\Event\BoardOrganizationEvent instance.
108
     */
109
    const BOARD_REMOVE_FROM_ORGANIZATION      = 'removeFromOrganizationBoard';
110
111
    /**************************************************************************************
112
     * List Events                                                                        *
113
     **************************************************************************************/
114
115
    /**
116
     * When a list is created
117
     * The event listener method receives a Trello\Event\ListEvent instance.
118
     */
119
    const LIST_CREATE                         = 'createList';
120
121
    /**
122
     * When a list is updated
123
     * The event listener method receives a Trello\Event\ListEvent instance.
124
     */
125
    const LIST_UPDATE                         = 'updateList';
126
127
    /**
128
     * When a list's closed state changes
129
     * The event listener method receives a Trello\Event\ListEvent instance.
130
     */
131
    const LIST_UPDATE_CLOSED                  = 'updateList:closed';
132
133
    /**
134
     * When a list's name changes
135
     * The event listener method receives a Trello\Event\ListEvent instance.
136
     */
137
    const LIST_UPDATE_NAME                    = 'updateList:name';
138
139
    /**************************************************************************************
140
     * Card Events                                                                        *
141
     **************************************************************************************/
142
143
    /**
144
     * When a card is created
145
     * The event listener method receives a Trello\Event\CardEvent instance.
146
     */
147
    const CARD_CREATE                         = 'createCard';
148
149
    /**
150
     * When a card is updated
151
     * The event listener method receives a Trello\Event\CardEvent instance.
152
     */
153
    const CARD_UPDATE                         = 'updateCard';
154
155
    /**
156
     * When a card is moved to an other list
157
     * The event listener method receives a Trello\Event\CardMoveEvent instance.
158
     */
159
    const CARD_UPDATE_LIST                    = 'updateCard:idList';
160
161
    /**
162
     * When a card's name is updated
163
     * The event listener method receives a Trello\Event\CardEvent instance.
164
     */
165
    const CARD_UPDATE_NAME                    = 'updateCard:name';
166
167
    /**
168
     * When a card's description is updated
169
     * The event listener method receives a Trello\Event\CardEvent instance.
170
     */
171
    const CARD_UPDATE_DESC                    = 'updateCard:desc';
172
173
    /**
174
     * When a card's closed state changes
175
     * The event listener method receives a Trello\Event\CardEvent instance.
176
     */
177
    const CARD_UPDATE_CLOSED                  = 'updateCard:closed';
178
179
    /**
180
     * When a card is deleted
181
     * The event listener method receives a Trello\Event\CardEvent instance.
182
     */
183
    const CARD_DELETE                         = 'deleteCard';
184
185
    /**
186
     * When a card is copied
187
     * The event listener method receives a Trello\Event\CardCopyEvent instance.
188
     */
189
    const CARD_COPY                           = 'copyCard';
190
191
    /**
192
     * When a new member is added to a card
193
     * The event listener method receives a Trello\Event\CardMemberEvent instance.
194
     */
195
    const CARD_ADD_MEMBER                     = 'addMemberToCard';
196
197
    /**
198
     * When a new member is removed from a card
199
     * The event listener method receives a Trello\Event\CardMemberEvent instance.
200
     */
201
    const CARD_REMOVE_MEMBER                  = 'removeMemberFromCard';
202
203
    /**
204
     * When a new label is added to a card
205
     * The event listener method receives a Trello\Event\CardEvent instance.
206
     */
207
    const CARD_ADD_LABEL                      = 'addLabelToCard';
208
209
    /**
210
     * When a new label is removed from a card
211
     * The event listener method receives a Trello\Event\CardEvent instance.
212
     */
213
    const CARD_REMOVE_LABEL                   = 'removeLabelFromCard';
214
215
    /**
216
     * When a comment is added to a card
217
     * The event listener method receives a Trello\Event\CardCommentEvent instance.
218
     */
219
    const CARD_COMMENT                        = 'commentCard';
220
221
    /**
222
     * When a card's comment is copied
223
     * The event listener method receives a Trello\Event\CardCommentEvent instance.
224
     */
225
    const CARD_COPY_COMMENT                   = 'copyCommentCard';
226
227
    /**
228
     * When a card is created from a check item
229
     * The event listener method receives a Trello\Event\CardFromCheckItemEvent instance.
230
     */
231
    const CARD_FROM_CHECKITEM                 = 'convertToCardFromCheckItem';
232
233
    /**
234
     * When an attachment is added to a card
235
     * The event listener method receives a Trello\Event\CardAttachmentEvent instance.
236
     */
237
    const CARD_ADD_ATTACHMENT                 = 'addAttachmentToCard';
238
239
    /**
240
     * When an attachment is deleted from a card
241
     * The event listener method receives a Trello\Event\CardAttachmentEvent instance.
242
     */
243
    const CARD_DELETE_ATTACHMENT              = 'deleteAttachmentFromCard';
244
245
    /**
246
     * When a card is shared by email
247
     * The event listener method receives a Trello\Event\CardEvent instance.
248
     */
249
    const CARD_EMAIL                          = 'emailCard';
250
251
    /**************************************************************************************
252
     * Checklist Events                                                                   *
253
     **************************************************************************************/
254
255
    /**
256
     * When a checklist is added to a card
257
     * The event listener method receives a Trello\Event\CardChecklistEvent instance.
258
     */
259
    const CARD_ADD_CHECKLIST                  = 'addChecklistToCard';
260
261
    /**
262
     * When a checklist is updated on a card
263
     * The event listener method receives a Trello\Event\CardChecklistEvent instance.
264
     */
265
    const CARD_CREATE_CHECKLIST               = 'createChecklist';
266
267
    /**
268
     * When a checklist is updated on a card
269
     * The event listener method receives a Trello\Event\CardChecklistEvent instance.
270
     */
271
    const CARD_UPDATE_CHECKLIST               = 'updateChecklist';
272
273
    /**
274
     * When a checklist is removed from a card
275
     * The event listener method receives a Trello\Event\CardChecklistEvent instance.
276
     */
277
    const CARD_REMOVE_CHECKLIST               = 'removeChecklistFromCard';
278
279
    /**
280
     * When an item is added to a checklist
281
     * The event listener method receives a Trello\Event\CardChecklistEvent instance.
282
     */
283
    const CARD_CREATE_CHECKLIST_ITEM          = 'createCheckItem';
284
285
    /**
286
     * When a checklist is removed from a card
287
     * The event listener method receives a Trello\Event\CardChecklistEvent instance.
288
     */
289
    const CARD_UPDATE_CHECKLIST_ITEM_STATE    = 'updateCheckItemStateOnCard';
290
291
    /**************************************************************************************
292
     * Organization Events                                                                *
293
     **************************************************************************************/
294
295
    /**
296
     * When an organization is created
297
     * The event listener method receives a Trello\Event\OrganizationEvent instance.
298
     */
299
    const ORGANIZATION_CREATE                 = 'createOrganization';
300
301
    /**
302
     * When an organization is updated
303
     * The event listener method receives a Trello\Event\OrganizationEvent instance.
304
     */
305
    const ORGANIZATION_UPDATE                 = 'updateOrganization';
306
307
    /**
308
     * When a member is added to an organization
309
     * The event listener method receives a Trello\Event\OrganizationMemberEvent instance.
310
     */
311
    const ORGANIZATION_ADD_MEMBER             = 'addMemberToOrganization';
312
313
    /**
314
     * When a member is made normal member of an organization
315
     * The event listener method receives a Trello\Event\OrganizationMemberEvent instance.
316
     */
317
    const ORGANIZATION_MAKE_NORMAL_MEMBER     = 'makeNormalMemberOfOrganization';
318
319
    /**
320
     * When a member looses admin rights of an organization
321
     * The event listener method receives a Trello\Event\OrganizationMemberEvent instance.
322
     */
323
    const ORGANIZATION_REMOVE_ADMIN           = 'removeAdminFromOrganization';
324
325
    /**
326
     * When an invitation to join an organization is deleted
327
     * The event listener method receives a Trello\Event\OrganizationMemberEvent instance.
328
     */
329
    const ORGANIZATION_DELETE_INVITATION      = 'deleteOrganizationInvitation';
330
331
    /**
332
     * When a member is invited to an organization
333
     * The event listener method receives a Trello\Event\OrganizationMemberEvent instance.
334
     */
335
    const ORGANIZATION_UNCONFIRMED_INVITATION = 'unconfirmedOrganizationInvitation';
336
337
    /**************************************************************************************
338
     * Member Events                                                                      *
339
     **************************************************************************************/
340
341
    /**
342
     * When a member joins
343
     * The event listener method receives a Trello\Event\MemberEvent instance.
344
     */
345
    const MEMBER_JOINED                       = 'memberJoinedTrello';
346
347
    /**
348
     * When a member is updated
349
     * The event listener method receives a Trello\Event\MemberEvent instance.
350
     */
351
    const MEMBER_UPDATE                       = 'updateMember';
352
353
    /**************************************************************************************
354
     * PowerUp Events                                                                     *
355
     **************************************************************************************/
356
357
    /**
358
     * When a power up is enabled
359
     * The event listener method receives a Trello\Event\PowerUpEvent instance.
360
     */
361
    const POWERUP_ENABLE                      = 'enablePowerUp';
362
363
    /**
364
     * When a power up is disabled
365
     * The event listener method receives a Trello\Event\PowerUpEvent instance.
366
     */
367
    const POWERUP_DISABLE                     = 'disablePowerUp';
368
369 3
    public static function all()
370
    {
371
        return array(
372 3
            self::BOARD_CREATE,
373 3
            self::BOARD_UPDATE,
374 3
            self::BOARD_COPY,
375 3
            self::BOARD_MOVE_CARD_FROM,
376 3
            self::BOARD_MOVE_CARD_TO,
377 3
            self::BOARD_MOVE_LIST_FROM,
378 3
            self::BOARD_MOVE_LIST_TO,
379 3
            self::BOARD_ADD_MEMBER,
380 3
            self::BOARD_MAKE_ADMIN,
381 3
            self::BOARD_MAKE_NORMAL_MEMBER,
382 3
            self::BOARD_MAKE_OBSERVER,
383 3
            self::BOARD_REMOVE_ADMIN,
384 3
            self::BOARD_DELETE_INVITATION,
385 3
            self::BOARD_UNCONFIRMED_INVITATION,
386 3
            self::BOARD_ADD_TO_ORGANIZATION,
387 3
            self::BOARD_REMOVE_FROM_ORGANIZATION,
388 3
            self::LIST_CREATE,
389 3
            self::LIST_UPDATE,
390 3
            self::LIST_UPDATE_CLOSED,
391 3
            self::LIST_UPDATE_NAME,
392 3
            self::CARD_CREATE,
393 3
            self::CARD_UPDATE,
394 3
            self::CARD_UPDATE_LIST,
395 3
            self::CARD_UPDATE_NAME,
396 3
            self::CARD_UPDATE_DESC,
397 3
            self::CARD_UPDATE_CLOSED,
398 3
            self::CARD_DELETE,
399 3
            self::CARD_COPY,
400 3
            self::CARD_ADD_MEMBER,
401 3
            self::CARD_REMOVE_MEMBER,
402 3
            self::CARD_COMMENT,
403 3
            self::CARD_COPY_COMMENT,
404 3
            self::CARD_FROM_CHECKITEM,
405 3
            self::CARD_ADD_ATTACHMENT,
406 3
            self::CARD_DELETE_ATTACHMENT,
407 3
            self::CARD_EMAIL,
408 3
            self::CARD_ADD_LABEL,
409 3
            self::CARD_REMOVE_LABEL,
410 3
            self::CARD_ADD_CHECKLIST,
411 3
            self::CARD_UPDATE_CHECKLIST,
412 3
            self::CARD_REMOVE_CHECKLIST,
413 3
            self::CARD_UPDATE_CHECKLIST_ITEM_STATE,
414 3
            self::ORGANIZATION_CREATE,
415 3
            self::ORGANIZATION_UPDATE,
416 3
            self::ORGANIZATION_ADD_MEMBER,
417 3
            self::ORGANIZATION_MAKE_NORMAL_MEMBER,
418 3
            self::ORGANIZATION_REMOVE_ADMIN,
419 3
            self::ORGANIZATION_DELETE_INVITATION,
420 3
            self::ORGANIZATION_UNCONFIRMED_INVITATION,
421 3
            self::MEMBER_JOINED,
422 3
            self::MEMBER_UPDATE,
423 3
            self::POWERUP_ENABLE,
424 3
            self::POWERUP_DISABLE,
425 3
        );
426
    }
427
}
428