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