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