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