| Conditions | 12 |
| Paths | 513 |
| Total Lines | 54 |
| Code Lines | 37 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 4 | ||
| Bugs | 0 | 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 |
||
| 54 | public function getOofSettings() { |
||
| 55 | $otherStores = $this->getOwnerPermissionStores(); |
||
| 56 | array_unshift($otherStores, $GLOBALS['mapisession']->getDefaultMessageStore()); |
||
| 57 | |||
| 58 | $oofSettings = []; |
||
| 59 | foreach ($otherStores as $storeEntryId => $storeObj) { |
||
| 60 | $props = mapi_getprops($storeObj, $this->properties); |
||
| 61 | if (!isset($props[PR_EC_OUTOFOFFICE])) { |
||
| 62 | $props[PR_EC_OUTOFOFFICE] = false; |
||
| 63 | } |
||
| 64 | if (!isset($props[PR_EC_OUTOFOFFICE_MSG])) { |
||
| 65 | $props[PR_EC_OUTOFOFFICE_MSG] = ''; |
||
| 66 | } |
||
| 67 | if (!isset($props[PR_EC_OUTOFOFFICE_SUBJECT])) { |
||
| 68 | $props[PR_EC_OUTOFOFFICE_SUBJECT] = ''; |
||
| 69 | } |
||
| 70 | if (!isset($props[PR_EC_OUTOFOFFICE_FROM])) { |
||
| 71 | $props[PR_EC_OUTOFOFFICE_FROM] = 0; |
||
| 72 | } |
||
| 73 | if (!isset($props[PR_EC_OUTOFOFFICE_UNTIL]) || $props[PR_EC_OUTOFOFFICE_UNTIL] === FUTURE_ENDDATE) { |
||
| 74 | $props[PR_EC_OUTOFOFFICE_UNTIL] = 0; |
||
| 75 | } |
||
| 76 | if (!isset($props[PR_EC_ALLOW_EXTERNAL])) { |
||
| 77 | $props[PR_EC_ALLOW_EXTERNAL] = 0; |
||
| 78 | } |
||
| 79 | if (!isset($props[PR_EC_EXTERNAL_AUDIENCE])) { |
||
| 80 | $props[PR_EC_EXTERNAL_AUDIENCE] = 0; |
||
| 81 | } |
||
| 82 | if (!isset($props[PR_EC_EXTERNAL_REPLY])) { |
||
| 83 | $props[PR_EC_EXTERNAL_REPLY] = ''; |
||
| 84 | } |
||
| 85 | if (!isset($props[PR_EC_EXTERNAL_SUBJECT])) { |
||
| 86 | $props[PR_EC_EXTERNAL_SUBJECT] = ''; |
||
| 87 | } |
||
| 88 | |||
| 89 | $externalProps['props']['entryid'] = bin2hex($props[PR_MAILBOX_OWNER_ENTRYID]); |
||
| 90 | $externalProps['props']['store_entryid'] = bin2hex($props[PR_ENTRYID]); |
||
| 91 | $externalProps['props']['set'] = $props[PR_EC_OUTOFOFFICE]; |
||
| 92 | $externalProps['props']['internal_reply'] = trim($props[PR_EC_OUTOFOFFICE_MSG]); |
||
| 93 | $externalProps['props']['internal_subject'] = trim($props[PR_EC_OUTOFOFFICE_SUBJECT]); |
||
| 94 | $externalProps['props']['from'] = $props[PR_EC_OUTOFOFFICE_FROM]; |
||
| 95 | $externalProps['props']['until'] = $props[PR_EC_OUTOFOFFICE_UNTIL]; |
||
| 96 | $externalProps['props']['allow_external'] = $props[PR_EC_ALLOW_EXTERNAL]; |
||
| 97 | $externalProps['props']['external_audience'] = $props[PR_EC_EXTERNAL_AUDIENCE]; |
||
| 98 | $externalProps['props']['external_reply'] = trim($props[PR_EC_EXTERNAL_REPLY]); |
||
| 99 | $externalProps['props']['external_subject'] = trim($props[PR_EC_EXTERNAL_SUBJECT]); |
||
| 100 | |||
| 101 | array_push($oofSettings, $externalProps); |
||
| 102 | } |
||
| 103 | |||
| 104 | // Send success message to client |
||
| 105 | $this->addActionData('list', ['item' => $oofSettings]); |
||
| 106 | |||
| 107 | $GLOBALS["bus"]->addData($this->getResponseData()); |
||
| 108 | } |
||
| 192 |