| Conditions | 1 |
| Paths | 1 |
| Total Lines | 58 |
| Code Lines | 2 |
| 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 |
||
| 78 | private function getExpectedData() |
||
| 79 | { |
||
| 80 | return '{ |
||
| 81 | "results" : [ |
||
| 82 | { |
||
| 83 | "address_components" : [ |
||
| 84 | { |
||
| 85 | "long_name" : "Melbourne", |
||
| 86 | "short_name" : "Melbourne", |
||
| 87 | "types" : [ "colloquial_area", "locality", "political" ] |
||
| 88 | }, |
||
| 89 | { |
||
| 90 | "long_name" : "Victoria", |
||
| 91 | "short_name" : "VIC", |
||
| 92 | "types" : [ "administrative_area_level_1", "political" ] |
||
| 93 | }, |
||
| 94 | { |
||
| 95 | "long_name" : "Australia", |
||
| 96 | "short_name" : "AU", |
||
| 97 | "types" : [ "country", "political" ] |
||
| 98 | } |
||
| 99 | ], |
||
| 100 | "formatted_address" : "Melbourne VIC, Australia", |
||
| 101 | "geometry" : { |
||
| 102 | "bounds" : { |
||
| 103 | "northeast" : { |
||
| 104 | "lat" : -37.5112737, |
||
| 105 | "lng" : 145.5125288 |
||
| 106 | }, |
||
| 107 | "southwest" : { |
||
| 108 | "lat" : -38.4338593, |
||
| 109 | "lng" : 144.5937418 |
||
| 110 | } |
||
| 111 | }, |
||
| 112 | "location" : { |
||
| 113 | "lat" : -37.8136276, |
||
| 114 | "lng" : 144.9630576 |
||
| 115 | }, |
||
| 116 | "location_type" : "APPROXIMATE", |
||
| 117 | "viewport" : { |
||
| 118 | "northeast" : { |
||
| 119 | "lat" : -37.5112737, |
||
| 120 | "lng" : 145.5125288 |
||
| 121 | }, |
||
| 122 | "southwest" : { |
||
| 123 | "lat" : -38.4338593, |
||
| 124 | "lng" : 144.5937418 |
||
| 125 | } |
||
| 126 | } |
||
| 127 | }, |
||
| 128 | "place_id" : "ChIJ90260rVG1moRkM2MIXVWBAQ", |
||
| 129 | "types" : [ "colloquial_area", "locality", "political" ] |
||
| 130 | } |
||
| 131 | ], |
||
| 132 | "status" : "OK" |
||
| 133 | } |
||
| 134 | '; |
||
| 135 | } |
||
| 136 | } |
||
| 137 |