| Conditions | 1 |
| Paths | 1 |
| Total Lines | 203 |
| Code Lines | 137 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| 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 |
||
| 51 | protected function buildTcaArray(): array |
||
| 52 | { |
||
| 53 | return [ |
||
| 54 | 'ctrl' => $this->getCtrl(), |
||
| 55 | |||
| 56 | 'palettes' => [ |
||
| 57 | 'mail' => [ |
||
| 58 | 'showitem' => 'subject,markers,--linebreak--,body', |
||
| 59 | 'canNotCollapse' => true, |
||
| 60 | ], |
||
| 61 | 'send_to' => [ |
||
| 62 | 'showitem' => 'send_to,--linebreak--,send_to_provided', |
||
| 63 | 'canNotCollapse' => true, |
||
| 64 | ], |
||
| 65 | 'send_cc' => [ |
||
| 66 | 'showitem' => 'send_cc,--linebreak--,send_cc_provided', |
||
| 67 | 'canNotCollapse' => true, |
||
| 68 | ], |
||
| 69 | 'send_bcc' => [ |
||
| 70 | 'showitem' => 'send_bcc,--linebreak--,send_bcc_provided', |
||
| 71 | 'canNotCollapse' => true, |
||
| 72 | ], |
||
| 73 | ], |
||
| 74 | |||
| 75 | 'types' => [ |
||
| 76 | '0' => [ |
||
| 77 | 'showitem' => ' |
||
| 78 | error_message, |
||
| 79 | title, description, hidden, |
||
| 80 | --div--;' . self::LLL . ':tab.event, |
||
| 81 | event, event_configuration_flex, |
||
| 82 | --div--;' . self::LLL . ':tab.channel, |
||
| 83 | channel, |
||
| 84 | --div--;' . self::EMAIL_LLL . ':tab.mail_configuration, |
||
| 85 | layout, |
||
| 86 | --palette--;' . self::EMAIL_LLL . ':palette.mail;mail, |
||
| 87 | --div--;' . self::EMAIL_LLL . ':tab.mail_recipients, |
||
| 88 | --palette--;' . self::EMAIL_LLL . ':palette.mail_recipients_to;send_to, |
||
| 89 | --palette--;' . self::EMAIL_LLL . ':palette.mail_recipients_cc;send_cc, |
||
| 90 | --palette--;' . self::EMAIL_LLL . ':palette.mail_recipients_bcc;send_bcc, |
||
| 91 | --div--;' . self::EMAIL_LLL . ':tab.mail_sender, |
||
| 92 | sender_custom,--linebreak--,sender,sender_default, |
||
| 93 | ', |
||
| 94 | ], |
||
| 95 | ], |
||
| 96 | |||
| 97 | 'columns' => [ |
||
| 98 | |||
| 99 | // Mail configuration |
||
| 100 | |||
| 101 | 'layout' => [ |
||
| 102 | 'exclude' => 1, |
||
| 103 | 'label' => self::EMAIL_LLL . ':field.layout', |
||
| 104 | 'l10n_mode' => 'exclude', |
||
| 105 | 'l10n_display' => 'defaultAsReadonly', |
||
| 106 | 'config' => [ |
||
| 107 | 'type' => 'select', |
||
| 108 | 'renderType' => 'selectSingle', |
||
| 109 | 'itemsProcFunc' => $this->getNotificationTcaServiceClass() . '->getLayoutList', |
||
| 110 | 'size' => 1, |
||
| 111 | 'maxitems' => 1, |
||
| 112 | 'eval' => 'required', |
||
| 113 | ], |
||
| 114 | ], |
||
| 115 | |||
| 116 | // Mail content |
||
| 117 | |||
| 118 | 'subject' => [ |
||
| 119 | 'exclude' => 1, |
||
| 120 | 'label' => self::EMAIL_LLL . ':field.subject', |
||
| 121 | 'config' => [ |
||
| 122 | 'type' => 'input', |
||
| 123 | 'size' => 40, |
||
| 124 | 'eval' => 'trim,required', |
||
| 125 | ], |
||
| 126 | ], |
||
| 127 | |||
| 128 | /** |
||
| 129 | * This FlexForm field is fully configured in: |
||
| 130 | * @see \CuyZ\Notiz\Core\Notification\TCA\Processor\BodySlotsProcessor |
||
| 131 | */ |
||
| 132 | 'body' => [ |
||
| 133 | 'exclude' => 1, |
||
| 134 | 'label' => self::EMAIL_LLL . ':field.body', |
||
| 135 | 'config' => [ |
||
| 136 | 'type' => 'flex', |
||
| 137 | 'default' => '', |
||
| 138 | 'ds_pointerField' => 'event', |
||
| 139 | 'behaviour' => [ |
||
| 140 | 'allowLanguageSynchronization' => true, |
||
| 141 | ], |
||
| 142 | ], |
||
| 143 | ], |
||
| 144 | |||
| 145 | // Sender |
||
| 146 | |||
| 147 | 'sender_custom' => [ |
||
| 148 | 'exclude' => 1, |
||
| 149 | 'label' => self::EMAIL_LLL . ':field.sender_custom', |
||
| 150 | 'onChange' => 'reload', |
||
| 151 | 'config' => [ |
||
| 152 | 'type' => 'check', |
||
| 153 | 'default' => 0, |
||
| 154 | ], |
||
| 155 | ], |
||
| 156 | |||
| 157 | 'sender_default' => [ |
||
| 158 | 'exclude' => 1, |
||
| 159 | 'label' => self::EMAIL_LLL . ':field.sender_default', |
||
| 160 | 'displayCond' => 'FIELD:sender_custom:=:0', |
||
| 161 | 'config' => [ |
||
| 162 | 'type' => 'user', |
||
| 163 | 'userFunc' => $this->getNotificationTcaServiceClass() . '->getDefaultSender', |
||
| 164 | ], |
||
| 165 | ], |
||
| 166 | |||
| 167 | 'sender' => [ |
||
| 168 | 'exclude' => 1, |
||
| 169 | 'label' => self::EMAIL_LLL . ':field.sender', |
||
| 170 | 'displayCond' => 'FIELD:sender_custom:=:1', |
||
| 171 | 'config' => [ |
||
| 172 | 'type' => 'input', |
||
| 173 | 'size' => 255, |
||
| 174 | 'eval' => 'email,required', |
||
| 175 | 'default' => '', |
||
| 176 | 'placeholder' => '[email protected]', |
||
| 177 | ], |
||
| 178 | ], |
||
| 179 | |||
| 180 | // Recipients |
||
| 181 | |||
| 182 | 'send_to' => [ |
||
| 183 | 'exclude' => 1, |
||
| 184 | 'label' => self::EMAIL_LLL . ':field.send_to', |
||
| 185 | 'config' => [ |
||
| 186 | 'type' => 'input', |
||
| 187 | 'size' => 512, |
||
| 188 | 'eval' => 'trim', |
||
| 189 | 'placeholder' => '[email protected], [email protected]', |
||
| 190 | ], |
||
| 191 | ], |
||
| 192 | |||
| 193 | 'send_to_provided' => [ |
||
| 194 | 'exclude' => 1, |
||
| 195 | 'label' => self::EMAIL_LLL . ':field.send_to_provided', |
||
| 196 | 'displayCond' => 'USER:' . $this->getNotificationTcaServiceClass() . '->shouldShowProvidedRecipientsSelect', |
||
| 197 | 'config' => [ |
||
| 198 | 'type' => 'select', |
||
| 199 | 'default' => '', |
||
| 200 | 'itemsProcFunc' => $this->getNotificationTcaServiceClass() . '->getRecipientsList', |
||
| 201 | 'renderType' => 'selectMultipleSideBySide', |
||
| 202 | 'size' => 5, |
||
| 203 | 'maxitems' => 128, |
||
| 204 | ], |
||
| 205 | ], |
||
| 206 | |||
| 207 | 'send_cc' => [ |
||
| 208 | 'exclude' => 1, |
||
| 209 | 'label' => self::EMAIL_LLL . ':field.send_cc', |
||
| 210 | 'config' => [ |
||
| 211 | 'type' => 'input', |
||
| 212 | 'size' => 512, |
||
| 213 | 'eval' => 'trim', |
||
| 214 | 'placeholder' => '[email protected], [email protected]', |
||
| 215 | ], |
||
| 216 | ], |
||
| 217 | |||
| 218 | 'send_cc_provided' => [ |
||
| 219 | 'exclude' => 1, |
||
| 220 | 'label' => self::EMAIL_LLL . ':field.send_cc_provided', |
||
| 221 | 'displayCond' => 'USER:' . $this->getNotificationTcaServiceClass() . '->shouldShowProvidedRecipientsSelect', |
||
| 222 | 'config' => [ |
||
| 223 | 'type' => 'select', |
||
| 224 | 'default' => '', |
||
| 225 | 'itemsProcFunc' => $this->getNotificationTcaServiceClass() . '->getRecipientsList', |
||
| 226 | 'renderType' => 'selectMultipleSideBySide', |
||
| 227 | 'size' => 5, |
||
| 228 | 'maxitems' => 128, |
||
| 229 | ], |
||
| 230 | ], |
||
| 231 | |||
| 232 | 'send_bcc' => [ |
||
| 233 | 'exclude' => 1, |
||
| 234 | 'label' => self::EMAIL_LLL . ':field.send_bcc', |
||
| 235 | 'config' => [ |
||
| 236 | 'type' => 'input', |
||
| 237 | 'size' => 512, |
||
| 238 | 'eval' => 'trim', |
||
| 239 | 'placeholder' => '[email protected], [email protected]', |
||
| 240 | ], |
||
| 241 | ], |
||
| 242 | |||
| 243 | 'send_bcc_provided' => [ |
||
| 244 | 'exclude' => 1, |
||
| 245 | 'label' => self::EMAIL_LLL . ':field.send_bcc_provided', |
||
| 246 | 'displayCond' => 'USER:' . $this->getNotificationTcaServiceClass() . '->shouldShowProvidedRecipientsSelect', |
||
| 247 | 'config' => [ |
||
| 248 | 'type' => 'select', |
||
| 249 | 'default' => '', |
||
| 250 | 'itemsProcFunc' => $this->getNotificationTcaServiceClass() . '->getRecipientsList', |
||
| 251 | 'renderType' => 'selectMultipleSideBySide', |
||
| 252 | 'size' => 5, |
||
| 253 | 'maxitems' => 128, |
||
| 254 | ], |
||
| 283 |