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