| Conditions | 1 |
| Paths | 1 |
| Total Lines | 72 |
| 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 |
||
| 38 | public static function initExtension() { |
||
| 39 | |||
| 40 | define( 'SUC_VERSION', '1.0.0-alpha' ); |
||
| 41 | |||
| 42 | // Register the extension |
||
| 43 | $GLOBALS['wgExtensionCredits']['others'][ ] = array( |
||
| 44 | 'path' => __FILE__, |
||
| 45 | 'name' => 'Summary Cards', |
||
| 46 | 'author' => array( |
||
| 47 | 'James Hong Kong' |
||
| 48 | ), |
||
| 49 | 'url' => 'https://github.com/SemanticMediaWiki/SummaryCards/', |
||
| 50 | 'descriptionmsg' => 'suc-desc', |
||
| 51 | 'version' => SUC_VERSION, |
||
| 52 | 'license-name' => 'GPL-2.0-or-later', |
||
| 53 | ); |
||
| 54 | |||
| 55 | // Register message files |
||
| 56 | $GLOBALS['wgMessagesDirs']['SummaryCards'] = __DIR__ . '/i18n'; |
||
| 57 | |||
| 58 | $GLOBALS['wgAPIModules']['summarycards'] = '\SUC\ApiSummaryCardContentParser'; |
||
| 59 | |||
| 60 | $GLOBALS['wgResourceModules']['ext.summary.cards.styles'] = array( |
||
| 61 | 'styles' => 'res/ext.summaryCards.css', |
||
| 62 | 'localBasePath' => __DIR__ , |
||
| 63 | 'remoteExtPath' => 'SummaryCards', |
||
| 64 | 'position' => 'top', |
||
| 65 | 'targets' => array( |
||
| 66 | 'mobile', |
||
| 67 | 'desktop' |
||
| 68 | ) |
||
| 69 | ); |
||
| 70 | |||
| 71 | $GLOBALS['wgResourceModules']['ext.summary.cards.tooltip'] = array( |
||
| 72 | 'localBasePath' => __DIR__ , |
||
| 73 | 'remoteExtPath' => 'SummaryCards', |
||
| 74 | 'position' => 'bottom', |
||
| 75 | 'dependencies' => array( |
||
| 76 | 'onoi.qtip', |
||
| 77 | 'onoi.md5', |
||
| 78 | 'onoi.blobstore', |
||
| 79 | 'onoi.util' |
||
| 80 | ), |
||
| 81 | 'targets' => array( |
||
| 82 | 'mobile', |
||
| 83 | 'desktop' |
||
| 84 | ) |
||
| 85 | ); |
||
| 86 | |||
| 87 | $GLOBALS['wgResourceModules']['ext.summary.cards'] = array( |
||
| 88 | 'scripts' => array( |
||
| 89 | 'res/ext.summaryCards.js' |
||
| 90 | ), |
||
| 91 | 'localBasePath' => __DIR__ , |
||
| 92 | 'remoteExtPath' => 'SummaryCards', |
||
| 93 | 'position' => 'bottom', |
||
| 94 | 'dependencies' => array( |
||
| 95 | 'mediawiki.api', |
||
| 96 | 'mediawiki.api.parse', |
||
| 97 | 'ext.summary.cards.styles', |
||
| 98 | 'ext.summary.cards.tooltip', |
||
| 99 | ), |
||
| 100 | 'messages' => array( |
||
| 101 | 'suc-tooltip-title', |
||
| 102 | 'suc-tooltip-error' |
||
| 103 | ), |
||
| 104 | 'targets' => array( |
||
| 105 | 'mobile', |
||
| 106 | 'desktop' |
||
| 107 | ) |
||
| 108 | ); |
||
| 109 | } |
||
| 110 | |||
| 133 |