deleteEntryCallback()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 1
crap 1
1
<?php
2
3
namespace Craft;
4
5
/**
6
 * Class DraftNotifications_EventsService
7
 */
8
class DraftNotifications_EventCallbackService extends BaseApplicationComponent
9
{
10
    const STATUS_NEW_DRAFT = 'savedNewDraft';
11
    const STATUS_EXISTING_DRAFT = 'savedExistingDraft';
12
    const STATUS_DELETED_DRAFT = 'deletedDraft';
13
14
15
    /**
16
     * @param Event $event
17
     */
18 2
    public static function saveDraftCallBack(Event $event)
19
    {
20 2
        $status = $event->params['isNewDraft'] ? self::STATUS_NEW_DRAFT : self::STATUS_EXISTING_DRAFT;
21 2
        craft()->draftNotifications->sendNotifications($event->params['draft'], $status);
22 2
    }
23
24
    /**
25
     * @param Event $event
26
     */
27 1
    public function deleteDraftCallback(Event $event)
28
    {
29 1
        craft()->draftNotifications->sendNotifications($event->params['draft'], self::STATUS_DELETED_DRAFT);
30 1
    }
31
32
    /**
33
     * @param Event $event
34
     */
35 2
    public function saveEntryCallback(Event $event)
36
    {
37 2
        $status = $event->params['isNewEntry'] ? self::STATUS_NEW_DRAFT : self::STATUS_EXISTING_DRAFT;
38 2
        craft()->draftNotifications->sendNotifications($event->params['entry'], $status);
39 2
    }
40
41
    /**
42
     * @param Event $event
43
     */
44 1
    public function deleteEntryCallback(Event $event)
45
    {
46 1
        craft()->draftNotifications->sendNotifications($event->params['entry'], self::STATUS_DELETED_DRAFT);
47
    }
48
}