Test Failed
Push — master ( 647c72...cd42b5 )
by
unknown
10:25
created

NewTodoTaskNotifier   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 10
dl 0
loc 28
rs 10
c 0
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A update() 0 11 2
A getEvents() 0 3 1
1
<?php
2
3
/**
4
 * NewTodoTaskNotifier
5
 *
6
 * Generates notifications update To-Do list folder.
7
 */
8
class NewTodoTaskNotifier extends Notifier
9
{
10
	/**
11
	 * @return Number the event which this module handles.
12
	 */
13
	public function getEvents()
14
	{
15
		return OBJECT_SAVE;
16
	}
17
18
	/**
19
	 * If an event elsewhere has occurred, it enters in this method. This method
20
	 * executes one or more actions, depends on the event.
21
	 * @param int $event Event.
22
	 * @param string $entryid Entryid.
23
	 * @param array $data array of data.
24
	 */
25
	public function update($event, $entryid, $props)
26
	{
27
		switch ($event) {
28
			case OBJECT_SAVE:
29
				$data['item'][] = array(
0 ignored issues
show
Comprehensibility Best Practice introduced by
$data was never initialized. Although not strictly required by PHP, it is generally a good practice to add $data = array(); before regardless.
Loading history...
30
					'entryid' =>  $entryid,
31
					'store_entryid' => bin2hex($props[PR_STORE_ENTRYID])
32
				);
33
				$this->addNotificationActionData("newtodotask", $data);
34
				$GLOBALS["bus"]->addData($this->createNotificationResponseData());
35
				break;
36
		}
37
	}
38
}
39
40
?>
0 ignored issues
show
Best Practice introduced by
It is not recommended to use PHP's closing tag ?> in files other than templates.

Using a closing tag in PHP files that only contain PHP code is not recommended as you might accidentally add whitespace after the closing tag which would then be output by PHP. This can cause severe problems, for example headers cannot be sent anymore.

A simple precaution is to leave off the closing tag as it is not required, and it also has no negative effects whatsoever.

Loading history...
41