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