Conditions | 1 |
Paths | 1 |
Total Lines | 308 |
Code Lines | 253 |
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 |
||
25 | function _flag_abuse_reason_abuse_node_flags(&$flags) { |
||
26 | // Exported flag: "Node Abuse metalink". |
||
27 | $flags[] = array ( |
||
|
|||
28 | 'content_type' => 'node', |
||
29 | 'name' => 'abuse_node_meta', |
||
30 | 'title' => 'Node Abuse meta', |
||
31 | 'global' => false, |
||
32 | 'types' => array ( |
||
33 | '0' => 'forum', |
||
34 | '1' => 'news', |
||
35 | '2' => 'team_forum', |
||
36 | ), |
||
37 | 'events' => array ( |
||
38 | 0 => 'flag', |
||
39 | 1 => 'unflag', |
||
40 | 2 => 'reset', |
||
41 | ), |
||
42 | 'flag_short' => 'Meta Flag for node', |
||
43 | 'flag_long' => 'Meta Flag for node.', |
||
44 | 'flag_message' => '', |
||
45 | 'unflag_short' => 'Meta Flag for node', |
||
46 | 'unflag_long' => 'Meta Flag for node.', |
||
47 | 'unflag_message' => '', |
||
48 | 'unflag_denied_text' => '', |
||
49 | 'link_type' => 'confirm', |
||
50 | 'roles' => array ( |
||
51 | 'flag' => array ( |
||
52 | 0 => '2', |
||
53 | ), |
||
54 | 'unflag' => array ( |
||
55 | 0 => '2', |
||
56 | ), |
||
57 | ), |
||
58 | 'show_on_page' => true, |
||
59 | 'show_on_teaser' => false, |
||
60 | 'show_on_form' => false, |
||
61 | 'access_author' => '', |
||
62 | 'i18n' => 0, |
||
63 | 'flag_confirmation' => 'Are you sure you want to flag this content?', |
||
64 | 'unflag_confirmation' => 'Are you sure you want to unflag this content?', |
||
65 | 'reset_short' => 'Reset flags', |
||
66 | 'reset_long' => 'Reset all flags on this content', |
||
67 | 'reset_confirmation' => 'Are you sure you want to reset all flags on this content?', |
||
68 | 'status' => false, |
||
69 | 'locked' => array ( |
||
70 | 'name' => 'name', |
||
71 | 'global' => 'global', |
||
72 | ), |
||
73 | 'module' => 'flag_abuse_reason', |
||
74 | 'api_version' => 2, |
||
75 | ); |
||
76 | |||
77 | // Exported flag: "Node Abuse 1". |
||
78 | $flags[] = array ( |
||
79 | 'content_type' => 'node', |
||
80 | 'name' => 'abuse_node_1', |
||
81 | 'title' => 'Node Abuse 1', |
||
82 | 'global' => false, |
||
83 | 'types' => array ( |
||
84 | '0' => 'forum', |
||
85 | '1' => 'news', |
||
86 | '2' => 'team_forum', |
||
87 | ), |
||
88 | 'events' => array ( |
||
89 | 0 => 'flag', |
||
90 | 1 => 'unflag', |
||
91 | 2 => 'reset', |
||
92 | ), |
||
93 | 'flag_short' => 'Flag as offensive', |
||
94 | 'flag_long' => 'Flag this content as offensive.', |
||
95 | 'flag_message' => '', |
||
96 | 'unflag_short' => 'Flag as non-offensive', |
||
97 | 'unflag_long' => 'Flag this content as non-offensive.', |
||
98 | 'unflag_message' => '', |
||
99 | 'unflag_denied_text' => '', |
||
100 | 'link_type' => 'confirm', |
||
101 | 'roles' => array ( |
||
102 | 'flag' => array ( |
||
103 | 0 => '2', |
||
104 | ), |
||
105 | 'unflag' => array ( |
||
106 | 0 => '2', |
||
107 | ), |
||
108 | ), |
||
109 | 'show_on_page' => true, |
||
110 | 'show_on_teaser' => false, |
||
111 | 'show_on_form' => false, |
||
112 | 'access_author' => '', |
||
113 | 'i18n' => 0, |
||
114 | 'flag_confirmation' => 'Are you sure you want to flag this content as offensive?', |
||
115 | 'unflag_confirmation' => 'Are you sure you want to flag this content as non-offensive?', |
||
116 | 'reset_short' => 'Reset flags', |
||
117 | 'reset_long' => 'Reset all flags on this content', |
||
118 | 'reset_confirmation' => 'Are you sure you want to reset all flags on this content?', |
||
119 | 'status' => false, |
||
120 | 'locked' => array ( |
||
121 | 'name' => 'name', |
||
122 | 'global' => 'global', |
||
123 | ), |
||
124 | 'module' => 'flag_abuse_reason', |
||
125 | 'api_version' => 2, |
||
126 | ); |
||
127 | |||
128 | // Exported flag: "Node Abuse 2". |
||
129 | $flags[] = array ( |
||
130 | 'content_type' => 'node', |
||
131 | 'name' => 'abuse_node_2', |
||
132 | 'title' => 'Node Abuse 2', |
||
133 | 'global' => false, |
||
134 | 'types' => array ( |
||
135 | '0' => 'forum', |
||
136 | '1' => 'news', |
||
137 | '2' => 'team_forum', |
||
138 | ), |
||
139 | 'events' => array ( |
||
140 | 0 => 'flag', |
||
141 | 1 => 'unflag', |
||
142 | 2 => 'reset', |
||
143 | ), |
||
144 | 'flag_short' => 'Flag as offensive', |
||
145 | 'flag_long' => 'Flag this content as offensive.', |
||
146 | 'flag_message' => '', |
||
147 | 'unflag_short' => 'Flag as non-offensive', |
||
148 | 'unflag_long' => 'Flag this content as non-offensive.', |
||
149 | 'unflag_message' => '', |
||
150 | 'unflag_denied_text' => '', |
||
151 | 'link_type' => 'confirm', |
||
152 | 'roles' => array ( |
||
153 | 'flag' => array ( |
||
154 | 0 => '2', |
||
155 | ), |
||
156 | 'unflag' => array ( |
||
157 | 0 => '2', |
||
158 | ), |
||
159 | ), |
||
160 | 'show_on_page' => true, |
||
161 | 'show_on_teaser' => false, |
||
162 | 'show_on_form' => false, |
||
163 | 'access_author' => '', |
||
164 | 'i18n' => 0, |
||
165 | 'flag_confirmation' => 'Are you sure you want to flag this content as offensive?', |
||
166 | 'unflag_confirmation' => 'Are you sure you want to flag this content as non-offensive?', |
||
167 | 'reset_short' => 'Reset flags', |
||
168 | 'reset_long' => 'Reset all flags on this content', |
||
169 | 'reset_confirmation' => 'Are you sure you want to reset all flags on this content?', |
||
170 | 'status' => false, |
||
171 | 'locked' => array ( |
||
172 | 'name' => 'name', |
||
173 | 'global' => 'global', |
||
174 | ), |
||
175 | 'module' => 'flag_abuse_reason', |
||
176 | 'api_version' => 2, |
||
177 | ); |
||
178 | |||
179 | // Exported flag: "Node Abuse 3". |
||
180 | $flags[] = array ( |
||
181 | 'content_type' => 'node', |
||
182 | 'name' => 'abuse_node_3', |
||
183 | 'title' => 'Node Abuse 3', |
||
184 | 'global' => false, |
||
185 | 'types' => array ( |
||
186 | '0' => 'forum', |
||
187 | '1' => 'news', |
||
188 | '2' => 'team_forum', |
||
189 | ), |
||
190 | 'events' => array ( |
||
191 | 0 => 'flag', |
||
192 | 1 => 'unflag', |
||
193 | 2 => 'reset', |
||
194 | ), |
||
195 | 'flag_short' => 'Flag as offensive', |
||
196 | 'flag_long' => 'Flag this content as offensive.', |
||
197 | 'flag_message' => '', |
||
198 | 'unflag_short' => 'Flag as non-offensive', |
||
199 | 'unflag_long' => 'Flag this content as non-offensive.', |
||
200 | 'unflag_message' => '', |
||
201 | 'unflag_denied_text' => '', |
||
202 | 'link_type' => 'confirm', |
||
203 | 'roles' => array ( |
||
204 | 'flag' => array ( |
||
205 | 0 => '2', |
||
206 | ), |
||
207 | 'unflag' => array ( |
||
208 | 0 => '2', |
||
209 | ), |
||
210 | ), |
||
211 | 'show_on_page' => true, |
||
212 | 'show_on_teaser' => false, |
||
213 | 'show_on_form' => false, |
||
214 | 'access_author' => '', |
||
215 | 'i18n' => 0, |
||
216 | 'flag_confirmation' => 'Are you sure you want to flag this content as offensive?', |
||
217 | 'unflag_confirmation' => 'Are you sure you want to flag this content as non-offensive?', |
||
218 | 'reset_short' => 'Reset flags', |
||
219 | 'reset_long' => 'Reset all flags on this content', |
||
220 | 'reset_confirmation' => 'Are you sure you want to reset all flags on this content?', |
||
221 | 'status' => false, |
||
222 | 'locked' => array ( |
||
223 | 'name' => 'name', |
||
224 | 'global' => 'global', |
||
225 | ), |
||
226 | 'module' => 'flag_abuse_reason', |
||
227 | 'api_version' => 2, |
||
228 | ); |
||
229 | |||
230 | // Exported flag: "Node Abuse 4". |
||
231 | $flags[] = array ( |
||
232 | 'content_type' => 'node', |
||
233 | 'name' => 'abuse_node_4', |
||
234 | 'title' => 'Node Abuse 4', |
||
235 | 'global' => false, |
||
236 | 'types' => array ( |
||
237 | '0' => 'forum', |
||
238 | '1' => 'news', |
||
239 | '2' => 'team_forum', |
||
240 | ), |
||
241 | 'events' => array ( |
||
242 | 0 => 'flag', |
||
243 | 1 => 'unflag', |
||
244 | 2 => 'reset', |
||
245 | ), |
||
246 | 'flag_short' => 'Flag as offensive', |
||
247 | 'flag_long' => 'Flag this content as offensive.', |
||
248 | 'flag_message' => '', |
||
249 | 'unflag_short' => 'Flag as non-offensive', |
||
250 | 'unflag_long' => 'Flag this content as non-offensive.', |
||
251 | 'unflag_message' => '', |
||
252 | 'unflag_denied_text' => '', |
||
253 | 'link_type' => 'confirm', |
||
254 | 'roles' => array ( |
||
255 | 'flag' => array ( |
||
256 | 0 => '2', |
||
257 | ), |
||
258 | 'unflag' => array ( |
||
259 | 0 => '2', |
||
260 | ), |
||
261 | ), |
||
262 | 'show_on_page' => true, |
||
263 | 'show_on_teaser' => false, |
||
264 | 'show_on_form' => false, |
||
265 | 'access_author' => '', |
||
266 | 'i18n' => 0, |
||
267 | 'flag_confirmation' => 'Are you sure you want to flag this content as offensive?', |
||
268 | 'unflag_confirmation' => 'Are you sure you want to flag this content as non-offensive?', |
||
269 | 'reset_short' => 'Reset flags', |
||
270 | 'reset_long' => 'Reset all flags on this content', |
||
271 | 'reset_confirmation' => 'Are you sure you want to reset all flags on this content?', |
||
272 | 'status' => false, |
||
273 | 'locked' => array ( |
||
274 | 'name' => 'name', |
||
275 | 'global' => 'global', |
||
276 | ), |
||
277 | 'module' => 'flag_abuse_reason', |
||
278 | 'api_version' => 2, |
||
279 | ); |
||
280 | |||
281 | // Exported flag: "Node Abuse 5". |
||
282 | $flags[] = array ( |
||
283 | 'content_type' => 'node', |
||
284 | 'name' => 'abuse_node_5', |
||
285 | 'title' => 'Node Abuse 5', |
||
286 | 'global' => false, |
||
287 | 'types' => array ( |
||
288 | '0' => 'forum', |
||
289 | '1' => 'news', |
||
290 | '2' => 'team_forum', |
||
291 | ), |
||
292 | 'events' => array ( |
||
293 | 0 => 'flag', |
||
294 | 1 => 'unflag', |
||
295 | 2 => 'reset', |
||
296 | ), |
||
297 | 'flag_short' => 'Flag as offensive', |
||
298 | 'flag_long' => 'Flag this content as offensive.', |
||
299 | 'flag_message' => '', |
||
300 | 'unflag_short' => 'Flag as non-offensive', |
||
301 | 'unflag_long' => 'Flag this content as non-offensive.', |
||
302 | 'unflag_message' => '', |
||
303 | 'unflag_denied_text' => '', |
||
304 | 'link_type' => 'confirm', |
||
305 | 'roles' => array ( |
||
306 | 'flag' => array ( |
||
307 | 0 => '2', |
||
308 | ), |
||
309 | 'unflag' => array ( |
||
310 | 0 => '2', |
||
311 | ), |
||
312 | ), |
||
313 | 'show_on_page' => true, |
||
314 | 'show_on_teaser' => false, |
||
315 | 'show_on_form' => false, |
||
316 | 'access_author' => '', |
||
317 | 'i18n' => 0, |
||
318 | 'flag_confirmation' => 'Are you sure you want to flag this content as offensive?', |
||
319 | 'unflag_confirmation' => 'Are you sure you want to flag this content as non-offensive?', |
||
320 | 'reset_short' => 'Reset flags', |
||
321 | 'reset_long' => 'Reset all flags on this content', |
||
322 | 'reset_confirmation' => 'Are you sure you want to reset all flags on this content?', |
||
323 | 'status' => false, |
||
324 | 'locked' => array ( |
||
325 | 'name' => 'name', |
||
326 | 'global' => 'global', |
||
327 | ), |
||
328 | 'module' => 'flag_abuse_reason', |
||
329 | 'api_version' => 2, |
||
330 | ); |
||
331 | |||
332 | return $flags; |
||
333 | } |
||
863 |