Conditions | 1 |
Paths | 1 |
Total Lines | 77 |
Code Lines | 2 |
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 |
||
159 | public function getSubClient( $type, $name = null ) |
||
160 | { |
||
161 | /** admin/jqadm/dashboard/decorators/excludes |
||
162 | * Excludes decorators added by the "common" option from the dashboard JQAdm client |
||
163 | * |
||
164 | * Decorators extend the functionality of a class by adding new aspects |
||
165 | * (e.g. log what is currently done), executing the methods of the underlying |
||
166 | * class only in certain conditions (e.g. only for logged in users) or |
||
167 | * modify what is returned to the caller. |
||
168 | * |
||
169 | * This option allows you to remove a decorator added via |
||
170 | * "client/jqadm/common/decorators/default" before they are wrapped |
||
171 | * around the JQAdm client. |
||
172 | * |
||
173 | * admin/jqadm/dashboard/decorators/excludes = array( 'decorator1' ) |
||
174 | * |
||
175 | * This would remove the decorator named "decorator1" from the list of |
||
176 | * common decorators ("\Aimeos\Admin\JQAdm\Common\Decorator\*") added via |
||
177 | * "client/jqadm/common/decorators/default" to the JQAdm client. |
||
178 | * |
||
179 | * @param array List of decorator names |
||
180 | * @since 2016.07 |
||
181 | * @category Developer |
||
182 | * @see admin/jqadm/common/decorators/default |
||
183 | * @see admin/jqadm/dashboard/decorators/global |
||
184 | * @see admin/jqadm/dashboard/decorators/local |
||
185 | */ |
||
186 | |||
187 | /** admin/jqadm/dashboard/decorators/global |
||
188 | * Adds a list of globally available decorators only to the dashboard JQAdm client |
||
189 | * |
||
190 | * Decorators extend the functionality of a class by adding new aspects |
||
191 | * (e.g. log what is currently done), executing the methods of the underlying |
||
192 | * class only in certain conditions (e.g. only for logged in users) or |
||
193 | * modify what is returned to the caller. |
||
194 | * |
||
195 | * This option allows you to wrap global decorators |
||
196 | * ("\Aimeos\Admin\JQAdm\Common\Decorator\*") around the JQAdm client. |
||
197 | * |
||
198 | * admin/jqadm/dashboard/decorators/global = array( 'decorator1' ) |
||
199 | * |
||
200 | * This would add the decorator named "decorator1" defined by |
||
201 | * "\Aimeos\Admin\JQAdm\Common\Decorator\Decorator1" only to the JQAdm client. |
||
202 | * |
||
203 | * @param array List of decorator names |
||
204 | * @since 2016.07 |
||
205 | * @category Developer |
||
206 | * @see admin/jqadm/common/decorators/default |
||
207 | * @see admin/jqadm/dashboard/decorators/excludes |
||
208 | * @see admin/jqadm/dashboard/decorators/local |
||
209 | */ |
||
210 | |||
211 | /** admin/jqadm/dashboard/decorators/local |
||
212 | * Adds a list of local decorators only to the dashboard JQAdm client |
||
213 | * |
||
214 | * Decorators extend the functionality of a class by adding new aspects |
||
215 | * (e.g. log what is currently done), executing the methods of the underlying |
||
216 | * class only in certain conditions (e.g. only for logged in users) or |
||
217 | * modify what is returned to the caller. |
||
218 | * |
||
219 | * This option allows you to wrap local decorators |
||
220 | * ("\Aimeos\Admin\JQAdm\Dashboard\Decorator\*") around the JQAdm client. |
||
221 | * |
||
222 | * admin/jqadm/dashboard/decorators/local = array( 'decorator2' ) |
||
223 | * |
||
224 | * This would add the decorator named "decorator2" defined by |
||
225 | * "\Aimeos\Admin\JQAdm\Dashboard\Decorator\Decorator2" only to the JQAdm client. |
||
226 | * |
||
227 | * @param array List of decorator names |
||
228 | * @since 2016.07 |
||
229 | * @category Developer |
||
230 | * @see admin/jqadm/common/decorators/default |
||
231 | * @see admin/jqadm/dashboard/decorators/excludes |
||
232 | * @see admin/jqadm/dashboard/decorators/global |
||
233 | */ |
||
234 | return $this->createSubClient( 'dashboard/' . $type, $name ); |
||
235 | } |
||
236 | |||
249 |