| Conditions | 1 |
| Paths | 1 |
| Total Lines | 76 |
| 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 |
||
| 101 | public function getSubClient( string $type, string $name = null ) : \Aimeos\Admin\JQAdm\Iface |
||
| 102 | { |
||
| 103 | /** admin/jqadm/product/characteristic/decorators/excludes |
||
| 104 | * Excludes decorators added by the "common" option from the product JQAdm client |
||
| 105 | * |
||
| 106 | * Decorators extend the functionality of a class by adding new aspects |
||
| 107 | * (e.g. log what is currently done), executing the methods of the underlying |
||
| 108 | * class only in certain conditions (e.g. only for logged in users) or |
||
| 109 | * modify what is returned to the caller. |
||
| 110 | * |
||
| 111 | * This option allows you to remove a decorator added via |
||
| 112 | * "admin/jqadm/common/decorators/default" before they are wrapped |
||
| 113 | * around the JQAdm client. |
||
| 114 | * |
||
| 115 | * admin/jqadm/product/characteristic/decorators/excludes = array( 'decorator1' ) |
||
| 116 | * |
||
| 117 | * This would remove the decorator named "decorator1" from the list of |
||
| 118 | * common decorators ("\Aimeos\Admin\JQAdm\Common\Decorator\*") added via |
||
| 119 | * "admin/jqadm/common/decorators/default" to the JQAdm client. |
||
| 120 | * |
||
| 121 | * @param array List of decorator names |
||
| 122 | * @since 2016.01 |
||
| 123 | * @category Developer |
||
| 124 | * @see admin/jqadm/common/decorators/default |
||
| 125 | * @see admin/jqadm/product/characteristic/decorators/global |
||
| 126 | * @see admin/jqadm/product/characteristic/decorators/local |
||
| 127 | */ |
||
| 128 | |||
| 129 | /** admin/jqadm/product/characteristic/decorators/global |
||
| 130 | * Adds a list of globally available decorators only to the product JQAdm client |
||
| 131 | * |
||
| 132 | * Decorators extend the functionality of a class by adding new aspects |
||
| 133 | * (e.g. log what is currently done), executing the methods of the underlying |
||
| 134 | * class only in certain conditions (e.g. only for logged in users) or |
||
| 135 | * modify what is returned to the caller. |
||
| 136 | * |
||
| 137 | * This option allows you to wrap global decorators |
||
| 138 | * ("\Aimeos\Admin\JQAdm\Common\Decorator\*") around the JQAdm client. |
||
| 139 | * |
||
| 140 | * admin/jqadm/product/characteristic/decorators/global = array( 'decorator1' ) |
||
| 141 | * |
||
| 142 | * This would add the decorator named "decorator1" defined by |
||
| 143 | * "\Aimeos\Admin\JQAdm\Common\Decorator\Decorator1" only to the JQAdm client. |
||
| 144 | * |
||
| 145 | * @param array List of decorator names |
||
| 146 | * @since 2016.01 |
||
| 147 | * @category Developer |
||
| 148 | * @see admin/jqadm/common/decorators/default |
||
| 149 | * @see admin/jqadm/product/characteristic/decorators/excludes |
||
| 150 | * @see admin/jqadm/product/characteristic/decorators/local |
||
| 151 | */ |
||
| 152 | |||
| 153 | /** admin/jqadm/product/characteristic/decorators/local |
||
| 154 | * Adds a list of local decorators only to the product JQAdm client |
||
| 155 | * |
||
| 156 | * Decorators extend the functionality of a class by adding new aspects |
||
| 157 | * (e.g. log what is currently done), executing the methods of the underlying |
||
| 158 | * class only in certain conditions (e.g. only for logged in users) or |
||
| 159 | * modify what is returned to the caller. |
||
| 160 | * |
||
| 161 | * This option allows you to wrap local decorators |
||
| 162 | * ("\Aimeos\Admin\JQAdm\Product\Decorator\*") around the JQAdm client. |
||
| 163 | * |
||
| 164 | * admin/jqadm/product/characteristic/decorators/local = array( 'decorator2' ) |
||
| 165 | * |
||
| 166 | * This would add the decorator named "decorator2" defined by |
||
| 167 | * "\Aimeos\Admin\JQAdm\Product\Decorator\Decorator2" only to the JQAdm client. |
||
| 168 | * |
||
| 169 | * @param array List of decorator names |
||
| 170 | * @since 2016.01 |
||
| 171 | * @category Developer |
||
| 172 | * @see admin/jqadm/common/decorators/default |
||
| 173 | * @see admin/jqadm/product/characteristic/decorators/excludes |
||
| 174 | * @see admin/jqadm/product/characteristic/decorators/global |
||
| 175 | */ |
||
| 176 | return $this->createSubClient( 'product/characteristic/' . $type, $name ); |
||
| 177 | } |
||
| 257 |