Conditions | 1 |
Paths | 1 |
Total Lines | 76 |
Code Lines | 1 |
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 |
||
123 | public function getSubClient( string $type, string $name = null ) : \Aimeos\Admin\JQAdm\Iface |
||
124 | { |
||
125 | /** admin/jqadm/type/rule/decorators/excludes |
||
126 | * Excludes decorators added by the "common" option from the type JQAdm client |
||
127 | * |
||
128 | * Decorators extend the functionality of a class by adding new aspects |
||
129 | * (e.g. log what is currently done), executing the methods of the underlying |
||
130 | * class only in certain conditions (e.g. only for logged in users) or |
||
131 | * modify what is returned to the caller. |
||
132 | * |
||
133 | * This option allows you to remove a decorator added via |
||
134 | * "client/jqadm/common/decorators/default" before they are wrapped |
||
135 | * around the JQAdm client. |
||
136 | * |
||
137 | * admin/jqadm/type/rule/decorators/excludes = array( 'decorator1' ) |
||
138 | * |
||
139 | * This would remove the decorator named "decorator1" from the list of |
||
140 | * common decorators ("\Aimeos\Admin\JQAdm\Common\Decorator\*") added via |
||
141 | * "client/jqadm/common/decorators/default" to the JQAdm client. |
||
142 | * |
||
143 | * @param array List of decorator names |
||
144 | * @since 2021.04 |
||
145 | * @category Developer |
||
146 | * @see admin/jqadm/common/decorators/default |
||
147 | * @see admin/jqadm/type/rule/decorators/global |
||
148 | * @see admin/jqadm/type/rule/decorators/local |
||
149 | */ |
||
150 | |||
151 | /** admin/jqadm/type/rule/decorators/global |
||
152 | * Adds a list of globally available decorators only to the type JQAdm client |
||
153 | * |
||
154 | * Decorators extend the functionality of a class by adding new aspects |
||
155 | * (e.g. log what is currently done), executing the methods of the underlying |
||
156 | * class only in certain conditions (e.g. only for logged in users) or |
||
157 | * modify what is returned to the caller. |
||
158 | * |
||
159 | * This option allows you to wrap global decorators |
||
160 | * ("\Aimeos\Admin\JQAdm\Common\Decorator\*") around the JQAdm client. |
||
161 | * |
||
162 | * admin/jqadm/type/rule/decorators/global = array( 'decorator1' ) |
||
163 | * |
||
164 | * This would add the decorator named "decorator1" defined by |
||
165 | * "\Aimeos\Admin\JQAdm\Common\Decorator\Decorator1" only to the JQAdm client. |
||
166 | * |
||
167 | * @param array List of decorator names |
||
168 | * @since 2021.04 |
||
169 | * @category Developer |
||
170 | * @see admin/jqadm/common/decorators/default |
||
171 | * @see admin/jqadm/type/rule/decorators/excludes |
||
172 | * @see admin/jqadm/type/rule/decorators/local |
||
173 | */ |
||
174 | |||
175 | /** admin/jqadm/type/rule/decorators/local |
||
176 | * Adds a list of local decorators only to the type JQAdm client |
||
177 | * |
||
178 | * Decorators extend the functionality of a class by adding new aspects |
||
179 | * (e.g. log what is currently done), executing the methods of the underlying |
||
180 | * class only in certain conditions (e.g. only for logged in users) or |
||
181 | * modify what is returned to the caller. |
||
182 | * |
||
183 | * This option allows you to wrap local decorators |
||
184 | * ("\Aimeos\Admin\JQAdm\Type\Rule\Decorator\*") around the JQAdm client. |
||
185 | * |
||
186 | * admin/jqadm/type/rule/decorators/local = array( 'decorator2' ) |
||
187 | * |
||
188 | * This would add the decorator named "decorator2" defined by |
||
189 | * "\Aimeos\Admin\JQAdm\Type\Rule\Decorator\Decorator2" only to the JQAdm client. |
||
190 | * |
||
191 | * @param array List of decorator names |
||
192 | * @since 2021.04 |
||
193 | * @category Developer |
||
194 | * @see admin/jqadm/common/decorators/default |
||
195 | * @see admin/jqadm/type/rule/decorators/excludes |
||
196 | * @see admin/jqadm/type/rule/decorators/global |
||
197 | */ |
||
198 | return $this->createSubClient( 'type/rule' . $type, $name ); |
||
199 | } |
||
279 |