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