Conditions | 10 |
Paths | 26 |
Total Lines | 33 |
Code Lines | 25 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 1 | Features | 0 |
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:
If many parameters/temporary variables are present:
1 | <?php |
||
20 | #[Override] |
||
21 | public function execute() { |
||
22 | foreach ($this->data as $actionType => $action) { |
||
23 | if (isset($actionType)) { |
||
24 | try { |
||
25 | switch ($actionType) { |
||
26 | case "retrieveAll": |
||
27 | $this->retrieveAll($actionType); |
||
28 | break; |
||
29 | |||
30 | case "set": |
||
31 | if (isset($action["setting"])) { |
||
32 | $this->set($action["setting"], false); |
||
33 | } |
||
34 | if (isset($action["persistentSetting"])) { |
||
35 | $this->set($action["persistentSetting"], true); |
||
36 | } |
||
37 | break; |
||
38 | |||
39 | case "delete": |
||
40 | case "reset": |
||
41 | $userStore = $GLOBALS['mapisession']->getDefaultMessageStore(); |
||
42 | $inbox = mapi_msgstore_getreceivefolder($userStore); |
||
43 | mapi_deleteprops($inbox, [PR_ADDITIONAL_REN_ENTRYIDS_EX, PR_ADDITIONAL_REN_ENTRYIDS]); |
||
44 | $this->delete($action["setting"]); |
||
45 | break; |
||
46 | |||
47 | default: |
||
48 | $this->handleUnknownActionType($actionType); |
||
49 | } |
||
50 | } |
||
51 | catch (MAPIException|SettingsException $e) { |
||
52 | $this->processException($e, $actionType); |
||
53 | } |
||
141 |