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

StickyNoteListModule::execute()   B

Complexity

Conditions 8
Paths 14

Size

Total Lines 28
Code Lines 22

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 8
eloc 22
nc 14
nop 0
dl 0
loc 28
rs 8.4444
c 0
b 0
f 0
1
<?php
2
	/**
3
	 * StickyNote Module
4
	 */
5
	class StickyNoteListModule extends ListModule
6
	{
7
		/**
8
		 * Constructor
9
		 * @param int $id unique id.
10
		 * @param array $data list of all actions.
11
		 */
12
		function __construct($id, $data)
13
		{
14
			parent::__construct($id, $data);
15
16
			$this->properties = $GLOBALS["properties"]->getStickyNoteListProperties();
17
18
			$this->start = 0;
19
		}
20
21
		/**
22
		 * Creates the notifiers for this module,
23
		 * and register them to the Bus.
24
		 */
25
		function createNotifiers()
26
		{
27
			$entryid = $this->getEntryID();
28
			$GLOBALS["bus"]->registerNotifier('stickynotelistnotifier', $entryid);
29
		}
30
31
		/**
32
		 * Executes all the actions in the $data variable.
33
		 * @return boolean true on success of false on fialure.
34
		 */
35
		function execute()
36
		{
37
			foreach($this->data as $actionType => $action)
38
			{
39
				if(isset($actionType)) {
40
					try {
41
						$store = $this->getActionStore($action);
42
						$entryid = $this->getActionEntryID($action);
43
44
						switch($actionType)
45
						{
46
							case "list":
47
								$this->messageList($store, $entryid, $action, $actionType);
0 ignored issues
show
Bug introduced by
$entryid of type object is incompatible with the type string expected by parameter $entryid of ListModule::messageList(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

47
								$this->messageList($store, /** @scrutinizer ignore-type */ $entryid, $action, $actionType);
Loading history...
48
								break;
49
							case "search":
50
								$this->search($store, $entryid, $action, $actionType);
51
								break;
52
							case "updatesearch":
53
								$this->updatesearch($store, $entryid, $action);
54
								break;
55
							case "stopsearch":
56
								$this->stopSearch($store, $entryid, $action);
57
								break;
58
							default:
59
								$this->handleUnknownActionType($actionType);
60
						}
61
					} catch (MAPIException $e) {
62
						$this->processException($e, $actionType);
63
					}
64
				}
65
			}
66
		}
67
68
		/**
69
		 * Function will be used to process private items in a list response,
70
		 * sticky notes doesn't have private items so function is overridden to not do 
71
		 * any processing.
72
		 * @param {Object} $item item properties
0 ignored issues
show
Documentation Bug introduced by
The doc comment {Object} at position 0 could not be parsed: Unknown type name '{' at position 0 in {Object}.
Loading history...
73
		 * @return {Object} item properties if its non private item otherwise empty array
0 ignored issues
show
Documentation Bug introduced by
The doc comment {Object} at position 0 could not be parsed: Unknown type name '{' at position 0 in {Object}.
Loading history...
74
		 */
75
		function processPrivateItem($item)
76
		{
77
			return $item;
78
		}
79
	}
80
?>
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...
81