| Conditions | 1 |
| Paths | 1 |
| Total Lines | 77 |
| Code Lines | 38 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 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 |
||
| 11 | public function getFormatDataForSignatureData() |
||
| 12 | { |
||
| 13 | return [ |
||
| 14 | [ |
||
| 15 | [ |
||
| 16 | 'id' => null, |
||
| 17 | 'name' => null, |
||
| 18 | ], |
||
| 19 | [ |
||
| 20 | 'id' => 123, |
||
| 21 | 'name' => 'foo', |
||
| 22 | ], |
||
| 23 | '123|foo', |
||
| 24 | ], |
||
| 25 | [ |
||
| 26 | [ |
||
| 27 | 'id' => null, |
||
| 28 | 'name' => null, |
||
| 29 | ], |
||
| 30 | [ |
||
| 31 | 'name' => 'foo', |
||
| 32 | 'id' => 123, |
||
| 33 | ], |
||
| 34 | '123|foo', |
||
| 35 | ], |
||
| 36 | [ |
||
| 37 | [ |
||
| 38 | 'id' => null, |
||
| 39 | 'name' => null, |
||
| 40 | ], |
||
| 41 | [ |
||
| 42 | 'name' => 'foo', |
||
| 43 | 'id' => 123, |
||
| 44 | 'date' => '2015-10-10', |
||
| 45 | ], |
||
| 46 | '123|foo', |
||
| 47 | ], |
||
| 48 | [ |
||
| 49 | [ |
||
| 50 | 'id' => null, |
||
| 51 | 'name' => null, |
||
| 52 | 'date' => null, |
||
| 53 | ], |
||
| 54 | [ |
||
| 55 | 'name' => 'foo', |
||
| 56 | 'id' => 123, |
||
| 57 | ], |
||
| 58 | '123|foo', |
||
| 59 | ], |
||
| 60 | [ |
||
| 61 | [ |
||
| 62 | 'id' => null, |
||
| 63 | 'name' => null, |
||
| 64 | 'cart' => [ |
||
| 65 | 'name' => null, |
||
| 66 | 'price' => null, |
||
| 67 | ], |
||
| 68 | 'description' => null, |
||
| 69 | ], |
||
| 70 | [ |
||
| 71 | 'name' => 'foo', |
||
| 72 | 'id' => 123, |
||
| 73 | 'cart' => [ |
||
| 74 | [ |
||
| 75 | 'price' => 99, |
||
| 76 | 'name' => 'foo product', |
||
| 77 | ], |
||
| 78 | [ |
||
| 79 | 'name' => 'bar product', |
||
| 80 | ], |
||
| 81 | ], |
||
| 82 | 'description' => 'order description', |
||
| 83 | ], |
||
| 84 | '123|foo|foo product|99|bar product|order description', |
||
| 85 | ], |
||
| 86 | ]; |
||
| 87 | } |
||
| 88 | |||
| 104 |