| Conditions | 1 |
| Paths | 1 |
| Total Lines | 65 |
| 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 |
||
| 45 | public function addParameterInfo( array &$params ) { |
||
| 46 | global $egMapsOLLayers, $egMapsOLControls, $egMapsResizableByDefault; |
||
| 47 | |||
| 48 | $params['zoom'] = [ |
||
| 49 | 'type' => 'integer', |
||
| 50 | 'range' => [ 0, 19 ], |
||
| 51 | 'default' => self::getDefaultZoom(), |
||
| 52 | 'message' => 'maps-par-zoom', |
||
| 53 | ]; |
||
| 54 | |||
| 55 | $params['controls'] = [ |
||
| 56 | 'default' => $egMapsOLControls, |
||
| 57 | 'values' => self::getControlNames(), |
||
| 58 | 'message' => 'maps-openlayers-par-controls', |
||
| 59 | 'islist' => true, |
||
| 60 | 'tolower' => true, |
||
| 61 | ]; |
||
| 62 | |||
| 63 | $params['layers'] = [ |
||
| 64 | 'default' => $egMapsOLLayers, |
||
| 65 | 'message' => 'maps-openlayers-par-layers', |
||
| 66 | 'manipulatedefault' => true, |
||
| 67 | 'islist' => true, |
||
| 68 | 'tolower' => true, |
||
| 69 | // TODO-customMaps: addCriteria( new CriterionOLLayer() ); |
||
| 70 | ]; |
||
| 71 | |||
| 72 | $params['resizable'] = [ |
||
| 73 | 'type' => 'boolean', |
||
| 74 | 'default' => false, |
||
| 75 | 'manipulatedefault' => false, |
||
| 76 | 'message' => 'maps-par-resizable', |
||
| 77 | ]; |
||
| 78 | |||
| 79 | $params['overlays'] = [ |
||
| 80 | // Default empty array will end up in JS just right without manipulation. |
||
| 81 | 'default' => [], |
||
| 82 | 'manipulatedefault' => false, |
||
| 83 | 'message' => 'maps-openlayers-par-overlays', |
||
| 84 | |||
| 85 | // NOTE: code has moved into @see Maps\MediaWiki\ParserHooks\MapsDisplayMapRenderer |
||
| 86 | // TODO-customMaps: addCriteria( new CriterionOLLayer( ';' ) ); |
||
| 87 | // TODO-customMaps: addManipulations( new MapsParamOLLayers() ); |
||
| 88 | ]; |
||
| 89 | |||
| 90 | $params['resizable'] = [ |
||
| 91 | 'type' => 'boolean', |
||
| 92 | 'default' => $egMapsResizableByDefault, |
||
| 93 | 'message' => 'maps-par-resizable', |
||
| 94 | ]; |
||
| 95 | |||
| 96 | $params['searchmarkers'] = [ |
||
| 97 | 'default' => '', |
||
| 98 | 'message' => 'maps-par-searchmarkers', |
||
| 99 | 'values' => [ 'title', 'all', '' ], |
||
| 100 | 'tolower' => true, |
||
| 101 | ]; |
||
| 102 | |||
| 103 | $params['kml'] = [ |
||
| 104 | 'default' => [], |
||
| 105 | 'message' => 'maps-par-kml', |
||
| 106 | 'islist' => true, |
||
| 107 | // new MapsParamFile() FIXME |
||
| 108 | ]; |
||
| 109 | } |
||
| 110 | |||
| 198 |