Conditions | 1 |
Paths | 1 |
Total Lines | 64 |
Code Lines | 55 |
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 |
||
114 | public function events() |
||
115 | { |
||
116 | $ret = []; |
||
117 | $ret[1]['name'] = 'category_created'; |
||
118 | $ret[1]['category'] = 'global'; |
||
119 | $ret[1]['title'] = _MI_PUBLISHER_GLOBAL_ITEM_CATEGORY_CREATED_NOTIFY; |
||
120 | $ret[1]['caption'] = _MI_PUBLISHER_GLOBAL_ITEM_CATEGORY_CREATED_NOTIFY_CAP; |
||
121 | $ret[1]['description'] = _MI_PUBLISHER_GLOBAL_ITEM_CATEGORY_CREATED_NOTIFY_DSC; |
||
122 | $ret[1]['mail_template'] = 'global_item_category_created'; |
||
123 | $ret[1]['mail_subject'] = _MI_PUBLISHER_GLOBAL_ITEM_CATEGORY_CREATED_NOTIFY_SBJ; |
||
124 | |||
125 | $ret[2]['name'] = 'submitted'; |
||
126 | $ret[2]['category'] = 'global'; |
||
127 | $ret[2]['admin_only'] = 1; |
||
128 | $ret[2]['title'] = _MI_PUBLISHER_GLOBAL_ITEM_SUBMITTED_NOTIFY; |
||
129 | $ret[2]['caption'] = _MI_PUBLISHER_GLOBAL_ITEM_SUBMITTED_NOTIFY_CAP; |
||
130 | $ret[2]['description'] = _MI_PUBLISHER_GLOBAL_ITEM_SUBMITTED_NOTIFY_DSC; |
||
131 | $ret[2]['mail_template'] = 'global_item_submitted'; |
||
132 | $ret[2]['mail_subject'] = _MI_PUBLISHER_GLOBAL_ITEM_SUBMITTED_NOTIFY_SBJ; |
||
133 | |||
134 | $ret[3]['name'] = 'published'; |
||
135 | $ret[3]['category'] = 'global'; |
||
136 | $ret[3]['title'] = _MI_PUBLISHER_GLOBAL_ITEM_PUBLISHED_NOTIFY; |
||
137 | $ret[3]['caption'] = _MI_PUBLISHER_GLOBAL_ITEM_PUBLISHED_NOTIFY_CAP; |
||
138 | $ret[3]['description'] = _MI_PUBLISHER_GLOBAL_ITEM_PUBLISHED_NOTIFY_DSC; |
||
139 | $ret[3]['mail_template'] = 'global_item_published'; |
||
140 | $ret[3]['mail_subject'] = _MI_PUBLISHER_GLOBAL_ITEM_PUBLISHED_NOTIFY_SBJ; |
||
141 | |||
142 | $ret[4]['name'] = 'submitted'; |
||
143 | $ret[4]['category'] = 'category'; |
||
144 | $ret[4]['admin_only'] = 1; |
||
145 | $ret[4]['title'] = _MI_PUBLISHER_CATEGORY_ITEM_SUBMITTED_NOTIFY; |
||
146 | $ret[4]['caption'] = _MI_PUBLISHER_CATEGORY_ITEM_SUBMITTED_NOTIFY_CAP; |
||
147 | $ret[4]['description'] = _MI_PUBLISHER_CATEGORY_ITEM_SUBMITTED_NOTIFY_DSC; |
||
148 | $ret[4]['mail_template'] = 'category_item_submitted'; |
||
149 | $ret[4]['mail_subject'] = _MI_PUBLISHER_CATEGORY_ITEM_SUBMITTED_NOTIFY_SBJ; |
||
150 | |||
151 | $ret[5]['name'] = 'published'; |
||
152 | $ret[5]['category'] = 'category'; |
||
153 | $ret[5]['title'] = _MI_PUBLISHER_CATEGORY_ITEM_PUBLISHED_NOTIFY; |
||
154 | $ret[5]['caption'] = _MI_PUBLISHER_CATEGORY_ITEM_PUBLISHED_NOTIFY_CAP; |
||
155 | $ret[5]['description'] = _MI_PUBLISHER_CATEGORY_ITEM_PUBLISHED_NOTIFY_DSC; |
||
156 | $ret[5]['mail_template'] = 'category_item_published'; |
||
157 | $ret[5]['mail_subject'] = _MI_PUBLISHER_CATEGORY_ITEM_PUBLISHED_NOTIFY_SBJ; |
||
158 | |||
159 | $ret[6]['name'] = 'rejected'; |
||
160 | $ret[6]['category'] = 'item'; |
||
161 | $ret[6]['invisible'] = 1; |
||
162 | $ret[6]['title'] = _MI_PUBLISHER_ITEM_REJECTED_NOTIFY; |
||
163 | $ret[6]['caption'] = _MI_PUBLISHER_ITEM_REJECTED_NOTIFY_CAP; |
||
164 | $ret[6]['description'] = _MI_PUBLISHER_ITEM_REJECTED_NOTIFY_DSC; |
||
165 | $ret[6]['mail_template'] = 'item_rejected'; |
||
166 | $ret[6]['mail_subject'] = _MI_PUBLISHER_ITEM_REJECTED_NOTIFY_SBJ; |
||
167 | |||
168 | $ret[7]['name'] = 'approved'; |
||
169 | $ret[7]['category'] = 'item'; |
||
170 | $ret[7]['invisible'] = 1; |
||
171 | $ret[7]['title'] = _MI_PUBLISHER_ITEM_APPROVED_NOTIFY; |
||
172 | $ret[7]['caption'] = _MI_PUBLISHER_ITEM_APPROVED_NOTIFY_CAP; |
||
173 | $ret[7]['description'] = _MI_PUBLISHER_ITEM_APPROVED_NOTIFY_DSC; |
||
174 | $ret[7]['mail_template'] = 'item_approved'; |
||
175 | $ret[7]['mail_subject'] = _MI_PUBLISHER_ITEM_APPROVED_NOTIFY_SBJ; |
||
176 | |||
177 | return $ret; |
||
178 | } |
||
192 |