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