| Conditions | 1 | 
| Paths | 1 | 
| Total Lines | 135 | 
| Code Lines | 74 | 
| 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  | 
            ||
| 223 | public function fieldManagerMatchedDefinitionsData()  | 
            ||
| 224 |     { | 
            ||
| 225 | $mockDefinitions = [  | 
            ||
| 226 | [  | 
            ||
| 227 | 'id' => 'A',  | 
            ||
| 228 | 'weight' => 0,  | 
            ||
| 229 | 'entityTypes' => ['node'],  | 
            ||
| 230 | 'fieldTypes' => ['datetime'],  | 
            ||
| 231 | 'fieldNames' => ['datefield'],  | 
            ||
| 232 | ],  | 
            ||
| 233 | [  | 
            ||
| 234 | 'id' => 'B',  | 
            ||
| 235 | 'weight' => 0,  | 
            ||
| 236 | 'fieldTypes' => ['datetime'],  | 
            ||
| 237 | ],  | 
            ||
| 238 | [  | 
            ||
| 239 | 'id' => 'C',  | 
            ||
| 240 | 'weight' => 0,  | 
            ||
| 241 | 'entityTypes' => ['node'],  | 
            ||
| 242 | 'fieldNames' => ['datefield'],  | 
            ||
| 243 | ],  | 
            ||
| 244 | [  | 
            ||
| 245 | 'id' => 'D',  | 
            ||
| 246 | 'weight' => 0,  | 
            ||
| 247 | 'entityTypes' => ['node'],  | 
            ||
| 248 | ],  | 
            ||
| 249 | [  | 
            ||
| 250 | 'id' => 'E',  | 
            ||
| 251 | 'weight' => 0,  | 
            ||
| 252 | 'entityTypes' => ['node'],  | 
            ||
| 253 | 'entityBundles' => ['article'],  | 
            ||
| 254 | 'fieldTypes' => ['datetime'],  | 
            ||
| 255 | 'fieldNames' => ['datefield'],  | 
            ||
| 256 | ],  | 
            ||
| 257 | [  | 
            ||
| 258 | 'id' => 'F',  | 
            ||
| 259 | 'weight' => 0,  | 
            ||
| 260 | ],  | 
            ||
| 261 | ];  | 
            ||
| 262 | |||
| 263 | $reweightedDefinitions = $mockDefinitions;  | 
            ||
| 264 | $reweightedDefinitions[0]['weight'] = 10;  | 
            ||
| 265 | |||
| 266 | $capitalisedDefinitions = $mockDefinitions;  | 
            ||
| 267 | $capitalisedDefinitions[0]['entityTypes'][0] = 'Node';  | 
            ||
| 268 | $capitalisedDefinitions[0]['fieldTypes'][0] = 'Datetime';  | 
            ||
| 269 | $capitalisedDefinitions[0]['fieldNames'][0] = 'DATEFIELD';  | 
            ||
| 270 | |||
| 271 | return array(  | 
            ||
| 272 | // Test specificity order.  | 
            ||
| 273 | [  | 
            ||
| 274 | [  | 
            ||
| 275 | 'entityTypes' => 'node',  | 
            ||
| 276 | 'entityBundles' => 'article',  | 
            ||
| 277 | 'fieldTypes' => 'datetime',  | 
            ||
| 278 | 'fieldNames' => 'datefield'  | 
            ||
| 279 | ],  | 
            ||
| 280 | $mockDefinitions,  | 
            ||
| 281 | ['E','A','C','B','D','F'],  | 
            ||
| 282 | ],  | 
            ||
| 283 | |||
| 284 | // Test entity type must not conflict.  | 
            ||
| 285 | [  | 
            ||
| 286 | [  | 
            ||
| 287 | 'entityTypes' => 'user',  | 
            ||
| 288 | 'entityBundles' => 'article',  | 
            ||
| 289 | 'fieldTypes' => 'datetime',  | 
            ||
| 290 | 'fieldNames' => 'datefield'  | 
            ||
| 291 | ],  | 
            ||
| 292 | $mockDefinitions,  | 
            ||
| 293 | ['B','F'],  | 
            ||
| 294 | ],  | 
            ||
| 295 | |||
| 296 | // Test entity bundle must not conflict.  | 
            ||
| 297 | [  | 
            ||
| 298 | [  | 
            ||
| 299 | 'entityTypes' => 'node',  | 
            ||
| 300 | 'entityBundles' => 'page',  | 
            ||
| 301 | 'fieldTypes' => 'datetime',  | 
            ||
| 302 | 'fieldNames' => 'datefield'  | 
            ||
| 303 | ],  | 
            ||
| 304 | $mockDefinitions,  | 
            ||
| 305 | ['A','C','B','D','F'],  | 
            ||
| 306 | ],  | 
            ||
| 307 | |||
| 308 | // Test field type must not conflict.  | 
            ||
| 309 | [  | 
            ||
| 310 | [  | 
            ||
| 311 | 'entityTypes' => 'node',  | 
            ||
| 312 | 'entityBundles' => 'article',  | 
            ||
| 313 | 'fieldTypes' => 'string',  | 
            ||
| 314 | 'fieldNames' => 'datefield'  | 
            ||
| 315 | ],  | 
            ||
| 316 | $mockDefinitions,  | 
            ||
| 317 | ['C','D','F'],  | 
            ||
| 318 | ],  | 
            ||
| 319 | |||
| 320 | // Test field name must not conflict.  | 
            ||
| 321 | [  | 
            ||
| 322 | [  | 
            ||
| 323 | 'entityTypes' => 'node',  | 
            ||
| 324 | 'entityBundles' => 'page',  | 
            ||
| 325 | 'fieldTypes' => 'datetime',  | 
            ||
| 326 | 'fieldNames' => 'otherdatefield'  | 
            ||
| 327 | ],  | 
            ||
| 328 | $mockDefinitions,  | 
            ||
| 329 | ['B','D','F'],  | 
            ||
| 330 | ],  | 
            ||
| 331 | |||
| 332 | // Weight trumps specificity.  | 
            ||
| 333 | [  | 
            ||
| 334 | [  | 
            ||
| 335 | 'entityTypes' => 'node',  | 
            ||
| 336 | 'entityBundles' => 'article',  | 
            ||
| 337 | 'fieldTypes' => 'datetime',  | 
            ||
| 338 | 'fieldNames' => 'datefield'  | 
            ||
| 339 | ],  | 
            ||
| 340 | $reweightedDefinitions,  | 
            ||
| 341 | ['A','E','C','B','D','F'],  | 
            ||
| 342 | ],  | 
            ||
| 343 | |||
| 344 | // Test case insensitivity.  | 
            ||
| 345 | [  | 
            ||
| 346 | [  | 
            ||
| 347 | 'entityTypes' => 'node',  | 
            ||
| 348 | 'entityBundles' => 'article',  | 
            ||
| 349 | 'fieldTypes' => 'datetime',  | 
            ||
| 350 | 'fieldNames' => 'datefield'  | 
            ||
| 351 | ],  | 
            ||
| 352 | $capitalisedDefinitions,  | 
            ||
| 353 | ['E','A','C','B','D','F'],  | 
            ||
| 354 | ],  | 
            ||
| 355 | |||
| 356 | );  | 
            ||
| 357 | }  | 
            ||
| 358 | }  | 
            ||
| 359 | 
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.