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