Conditions | 1 |
Paths | 1 |
Total Lines | 191 |
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 |
||
145 | protected function createIndexes() |
||
146 | { |
||
147 | $this->createIndex( |
||
148 | $this->db->getIndexName( |
||
149 | OrganizationTypeRecord::tableName(), |
||
150 | 'handle', |
||
151 | true |
||
152 | ), |
||
153 | OrganizationTypeRecord::tableName(), |
||
154 | 'handle', |
||
155 | true |
||
156 | ); |
||
157 | $this->createIndex( |
||
158 | $this->db->getIndexName( |
||
159 | OrganizationTypeRecord::tableName(), |
||
160 | 'fieldLayoutId', |
||
161 | false, |
||
162 | true |
||
163 | ), |
||
164 | OrganizationTypeRecord::tableName(), |
||
165 | 'fieldLayoutId', |
||
166 | false |
||
167 | ); |
||
168 | |||
169 | $this->addPrimaryKey( |
||
170 | $this->db->getPrimaryKeyName( |
||
171 | OrganizationTypeSiteSettingsRecord::tableName(), |
||
172 | ['typeId', 'siteId'] |
||
173 | ), |
||
174 | OrganizationTypeSiteSettingsRecord::tableName(), |
||
175 | ['typeId', 'siteId'] |
||
176 | ); |
||
177 | $this->createIndex( |
||
178 | $this->db->getIndexName( |
||
179 | OrganizationTypeSiteSettingsRecord::tableName(), |
||
180 | 'typeId', |
||
181 | false, |
||
182 | true |
||
183 | ), |
||
184 | OrganizationTypeSiteSettingsRecord::tableName(), |
||
185 | 'typeId', |
||
186 | false |
||
187 | ); |
||
188 | $this->createIndex( |
||
189 | $this->db->getIndexName( |
||
190 | OrganizationTypeSiteSettingsRecord::tableName(), |
||
191 | 'siteId', |
||
192 | false, |
||
193 | true |
||
194 | ), |
||
195 | OrganizationTypeSiteSettingsRecord::tableName(), |
||
196 | 'siteId', |
||
197 | false |
||
198 | ); |
||
199 | $this->createIndex( |
||
200 | $this->db->getIndexName( |
||
201 | OrganizationTypeSiteSettingsRecord::tableName(), |
||
202 | 'typeId,siteId', |
||
203 | true |
||
204 | ), |
||
205 | OrganizationTypeSiteSettingsRecord::tableName(), |
||
206 | 'typeId,siteId', |
||
207 | true |
||
208 | ); |
||
209 | |||
210 | $this->addPrimaryKey( |
||
211 | $this->db->getPrimaryKeyName( |
||
212 | OrganizationTypeAssociationRecord::tableName(), |
||
213 | ['typeId', 'organizationId'] |
||
214 | ), |
||
215 | OrganizationTypeAssociationRecord::tableName(), |
||
216 | ['typeId', 'organizationId'] |
||
217 | ); |
||
218 | $this->createIndex( |
||
219 | $this->db->getIndexName( |
||
220 | OrganizationTypeAssociationRecord::tableName(), |
||
221 | 'typeId', |
||
222 | false, |
||
223 | true |
||
224 | ), |
||
225 | OrganizationTypeAssociationRecord::tableName(), |
||
226 | 'typeId', |
||
227 | false |
||
228 | ); |
||
229 | $this->createIndex( |
||
230 | $this->db->getIndexName( |
||
231 | OrganizationTypeAssociationRecord::tableName(), |
||
232 | 'organizationId', |
||
233 | false, |
||
234 | true |
||
235 | ), |
||
236 | OrganizationTypeAssociationRecord::tableName(), |
||
237 | 'organizationId', |
||
238 | false |
||
239 | ); |
||
240 | $this->createIndex( |
||
241 | $this->db->getIndexName( |
||
242 | OrganizationTypeAssociationRecord::tableName(), |
||
243 | 'typeId,organizationId', |
||
244 | true |
||
245 | ), |
||
246 | OrganizationTypeAssociationRecord::tableName(), |
||
247 | 'typeId,organizationId', |
||
248 | true |
||
249 | ); |
||
250 | |||
251 | $this->createIndex( |
||
252 | $this->db->getIndexName( |
||
253 | OrganizationUserRecord::tableName(), |
||
254 | 'userId', |
||
255 | false, |
||
256 | true |
||
257 | ), |
||
258 | OrganizationUserRecord::tableName(), |
||
259 | 'userId', |
||
260 | false |
||
261 | ); |
||
262 | $this->createIndex( |
||
263 | $this->db->getIndexName( |
||
264 | OrganizationUserRecord::tableName(), |
||
265 | 'organizationId', |
||
266 | false, |
||
267 | true |
||
268 | ), |
||
269 | OrganizationUserRecord::tableName(), |
||
270 | 'organizationId', |
||
271 | false |
||
272 | ); |
||
273 | $this->createIndex( |
||
274 | $this->db->getIndexName( |
||
275 | OrganizationUserRecord::tableName(), |
||
276 | 'userId,organizationId', |
||
277 | true |
||
278 | ), |
||
279 | OrganizationUserRecord::tableName(), |
||
280 | 'userId,organizationId', |
||
281 | true |
||
282 | ); |
||
283 | |||
284 | $this->createIndex( |
||
285 | $this->db->getIndexName( |
||
286 | OrganizationUserTypeRecord::tableName(), |
||
287 | 'handle', |
||
288 | true |
||
289 | ), |
||
290 | OrganizationUserTypeRecord::tableName(), |
||
291 | 'handle', |
||
292 | true |
||
293 | ); |
||
294 | |||
295 | $this->addPrimaryKey( |
||
296 | $this->db->getPrimaryKeyName( |
||
297 | OrganizationUserTypeAssociationRecord::tableName(), |
||
298 | ['userId', 'typeId'] |
||
299 | ), |
||
300 | OrganizationUserTypeAssociationRecord::tableName(), |
||
301 | ['userId', 'typeId'] |
||
302 | ); |
||
303 | $this->createIndex( |
||
304 | $this->db->getIndexName( |
||
305 | OrganizationUserTypeAssociationRecord::tableName(), |
||
306 | 'userId', |
||
307 | false, |
||
308 | true |
||
309 | ), |
||
310 | OrganizationUserTypeAssociationRecord::tableName(), |
||
311 | 'userId', |
||
312 | false |
||
313 | ); |
||
314 | $this->createIndex( |
||
315 | $this->db->getIndexName( |
||
316 | OrganizationUserTypeAssociationRecord::tableName(), |
||
317 | 'typeId', |
||
318 | false, |
||
319 | true |
||
320 | ), |
||
321 | OrganizationUserTypeAssociationRecord::tableName(), |
||
322 | 'typeId', |
||
323 | false |
||
324 | ); |
||
325 | $this->createIndex( |
||
326 | $this->db->getIndexName( |
||
327 | OrganizationUserTypeAssociationRecord::tableName(), |
||
328 | 'userId,typeId', |
||
329 | true |
||
330 | ), |
||
331 | OrganizationUserTypeAssociationRecord::tableName(), |
||
332 | 'userId,typeId', |
||
333 | true |
||
334 | ); |
||
335 | } |
||
336 | |||
472 |