Conditions | 1 |
Paths | 1 |
Total Lines | 171 |
Code Lines | 118 |
Lines | 0 |
Ratio | 0 % |
Changes | 5 | ||
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 |
||
29 | protected function buildTcaArray(): array |
||
30 | { |
||
31 | return [ |
||
32 | 'ctrl' => $this->getDefaultCtrl(), |
||
33 | |||
34 | 'palettes' => [ |
||
35 | 'content' => [ |
||
36 | 'showitem' => 'message,markers', |
||
37 | 'canNotCollapse' => true, |
||
38 | ], |
||
39 | 'bot' => [ |
||
40 | 'showitem' => 'custom_bot,--linebreak--,name,avatar,bot,--linebreak--,no_defined_bot', |
||
41 | 'canNotCollapse' => true, |
||
42 | ], |
||
43 | 'channel' => [ |
||
44 | 'showitem' => 'slack_channel,no_defined_slack_channel', |
||
45 | 'canNotCollapse' => true, |
||
46 | ], |
||
47 | 'channel_custom' => [ |
||
48 | 'showitem' => 'target,--linebreak--,webhook_url', |
||
49 | 'canNotCollapse' => true, |
||
50 | ], |
||
51 | ], |
||
52 | |||
53 | 'types' => [ |
||
54 | '0' => [ |
||
55 | 'showitem' => ' |
||
56 | error_message, |
||
57 | title, description, hidden, |
||
58 | --div--;' . self::LLL . ':tab.event, |
||
59 | event, event_configuration_flex, |
||
60 | --div--;' . self::LLL . ':tab.channel, |
||
61 | channel, |
||
62 | --div--;' . self::SLACK_LLL . ':tab.content, |
||
63 | --palette--;' . self::SLACK_LLL . ':palette.content;content, |
||
64 | --div--;' . self::SLACK_LLL . ':tab.slack, |
||
65 | --palette--;' . self::SLACK_LLL . ':palette.bot;bot, |
||
66 | --palette--;' . self::SLACK_LLL . ':palette.channel;channel, |
||
67 | --palette--;' . self::SLACK_LLL . ':palette.channel_custom;channel_custom |
||
68 | ' |
||
69 | ] |
||
70 | ], |
||
71 | |||
72 | 'columns' => [ |
||
73 | |||
74 | 'message' => [ |
||
75 | 'exclude' => 1, |
||
76 | 'label' => self::SLACK_LLL . ':field.message', |
||
77 | 'config' => [ |
||
78 | 'type' => 'text', |
||
79 | 'default' => '', |
||
80 | 'size' => 4000, |
||
81 | 'eval' => 'trim,required', |
||
82 | ], |
||
83 | ], |
||
84 | |||
85 | 'custom_bot' => [ |
||
86 | 'exclude' => 1, |
||
87 | 'label' => self::SLACK_LLL . ':field.custom_bot', |
||
88 | 'displayCond' => 'USER:' . $this->getNotificationTcaServiceClass() . '->hasDefinedBot', |
||
89 | 'onChange' => 'reload', |
||
90 | 'config' => [ |
||
91 | 'type' => 'check', |
||
92 | 'default' => 1, |
||
93 | ], |
||
94 | ], |
||
95 | |||
96 | 'bot' => [ |
||
97 | 'exclude' => 1, |
||
98 | 'label' => self::SLACK_LLL . ':field.bot', |
||
99 | 'displayCond' => [ |
||
100 | 'AND' => [ |
||
101 | 'FIELD:custom_bot:=:0', |
||
102 | 'USER:' . $this->getNotificationTcaServiceClass() . '->hasDefinedBot', |
||
103 | ], |
||
104 | ], |
||
105 | 'config' => [ |
||
106 | 'type' => 'select', |
||
107 | 'renderType' => 'selectSingle', |
||
108 | 'itemsProcFunc' => $this->getNotificationTcaServiceClass() . '->getBotsList', |
||
109 | 'size' => 1, |
||
110 | 'maxitems' => 1, |
||
111 | 'eval' => 'required', |
||
112 | ], |
||
113 | ], |
||
114 | |||
115 | 'no_defined_bot' => [ |
||
116 | 'label' => self::SLACK_LLL . ':field.no_defined_bot', |
||
117 | 'displayCond' => [ |
||
118 | 'AND' => [ |
||
119 | 'FIELD:custom_bot:=:0', |
||
120 | 'USER:' . $this->getNotificationTcaServiceClass() . '->hasNoDefinedBot', |
||
121 | ], |
||
122 | ], |
||
123 | 'config' => [ |
||
124 | 'type' => 'user', |
||
125 | 'userFunc' => $this->getNotificationTcaServiceClass() . '->getNoDefinedBotText', |
||
126 | ], |
||
127 | ], |
||
128 | |||
129 | 'name' => [ |
||
130 | 'exclude' => 1, |
||
131 | 'label' => self::SLACK_LLL . ':field.name', |
||
132 | 'displayCond' => [ |
||
133 | 'OR' => [ |
||
134 | 'FIELD:custom_bot:=:1', |
||
135 | 'USER:' . $this->getNotificationTcaServiceClass() . '->hasNoDefinedBot', |
||
136 | ], |
||
137 | ], |
||
138 | 'config' => [ |
||
139 | 'type' => 'input', |
||
140 | 'size' => 255, |
||
141 | 'eval' => 'trim,required', |
||
142 | ], |
||
143 | ], |
||
144 | |||
145 | 'avatar' => [ |
||
146 | 'exclude' => 1, |
||
147 | 'label' => self::SLACK_LLL . ':field.avatar', |
||
148 | 'displayCond' => [ |
||
149 | 'OR' => [ |
||
150 | 'FIELD:custom_bot:=:1', |
||
151 | 'USER:' . $this->getNotificationTcaServiceClass() . '->hasNoDefinedBot', |
||
152 | ], |
||
153 | ], |
||
154 | 'config' => [ |
||
155 | 'type' => 'input', |
||
156 | 'size' => 255, |
||
157 | 'eval' => 'trim,required', |
||
158 | ], |
||
159 | ], |
||
160 | |||
161 | 'no_defined_slack_channel' => [ |
||
162 | 'label' => self::SLACK_LLL . ':field.no_defined_slack_channel', |
||
163 | 'displayCond' => 'USER:' . $this->getNotificationTcaServiceClass() . '->hasNoDefinedSlackChannel', |
||
164 | 'config' => [ |
||
165 | 'type' => 'user', |
||
166 | 'userFunc' => $this->getNotificationTcaServiceClass() . '->getNoDefinedSlackChannelText', |
||
167 | ], |
||
168 | ], |
||
169 | |||
170 | 'slack_channel' => [ |
||
171 | 'exclude' => 1, |
||
172 | 'label' => self::SLACK_LLL . ':field.slack_channel', |
||
173 | 'displayCond' => 'USER:' . $this->getNotificationTcaServiceClass() . '->hasDefinedSlackChannel', |
||
174 | 'config' => [ |
||
175 | 'type' => 'select', |
||
176 | 'itemsProcFunc' => $this->getNotificationTcaServiceClass() . '->getSlackChannelsList', |
||
177 | 'renderType' => 'selectMultipleSideBySide', |
||
178 | 'size' => 5, |
||
179 | 'maxitems' => 128, |
||
180 | ], |
||
181 | ], |
||
182 | |||
183 | 'target' => [ |
||
184 | 'exclude' => 1, |
||
185 | 'label' => self::SLACK_LLL . ':field.target', |
||
186 | 'config' => [ |
||
187 | 'type' => 'input', |
||
188 | 'size' => 255, |
||
189 | 'eval' => 'trim', |
||
190 | ], |
||
191 | ], |
||
192 | |||
193 | 'webhook_url' => [ |
||
194 | 'exclude' => 1, |
||
195 | 'label' => self::SLACK_LLL . ':field.webhook_url', |
||
196 | 'config' => [ |
||
197 | 'type' => 'input', |
||
198 | 'size' => 255, |
||
199 | 'eval' => 'trim', |
||
200 | ], |
||
223 |