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