Conditions | 4 |
Paths | 4 |
Total Lines | 91 |
Code Lines | 56 |
Lines | 0 |
Ratio | 0 % |
Changes | 3 | ||
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 |
||
39 | public static function initExtension( $credits = [] ) { |
||
40 | |||
41 | // See https://phabricator.wikimedia.org/T151136 |
||
42 | define( 'SCI_VERSION', isset( $credits['version'] ) ? $credits['version'] : 'UNKNOWN' ); |
||
43 | |||
44 | // Extend the upgrade key provided by SMW to ensure that an DB |
||
45 | // schema is updated accordingly before using the extension |
||
46 | if ( isset( $GLOBALS['smwgUpgradeKey'] ) ) { |
||
47 | // $GLOBALS['smwgUpgradeKey'] .= ':scite:2018-09'; |
||
48 | } |
||
49 | |||
50 | // Register message files |
||
51 | $GLOBALS['wgMessagesDirs']['SemanticCite'] = __DIR__ . '/i18n'; |
||
52 | $GLOBALS['wgExtensionMessagesFiles']['SemanticCiteMagic'] = __DIR__ . '/i18n/SemanticCite.magic.php'; |
||
53 | $GLOBALS['wgExtensionMessagesFiles']['SemanticCiteAlias'] = __DIR__ . '/i18n/SemanticCite.alias.php'; |
||
54 | |||
55 | $GLOBALS['wgSpecialPages']['FindCitableMetadata'] = '\SCI\Specials\SpecialFindCitableMetadata'; |
||
56 | |||
57 | // Restrict access to the meta search for registered users only |
||
58 | $GLOBALS['wgAvailableRights'][] = 'sci-metadatasearch'; |
||
59 | $GLOBALS['wgGroupPermissions']['user']['sci-metadatasearch'] = true; |
||
60 | |||
61 | // Register resource files |
||
62 | $GLOBALS['wgResourceModules']['ext.scite.styles'] = [ |
||
63 | 'styles' => 'res/scite.styles.css', |
||
64 | 'localBasePath' => __DIR__ , |
||
65 | 'remoteExtPath' => 'SemanticCite', |
||
66 | 'position' => 'top', |
||
67 | 'group' => 'ext.smw', |
||
68 | 'targets' => [ |
||
69 | 'mobile', |
||
70 | 'desktop' |
||
71 | ] |
||
72 | ]; |
||
73 | |||
74 | $GLOBALS['wgResourceModules']['ext.scite.metadata'] = [ |
||
75 | 'scripts' => [ |
||
76 | 'res/scite.text.selector.js', |
||
77 | 'res/scite.page.creator.js' |
||
78 | ], |
||
79 | 'localBasePath' => __DIR__ , |
||
80 | 'remoteExtPath' => 'SemanticCite', |
||
81 | 'position' => 'top', |
||
82 | 'group' => 'ext.smw', |
||
83 | 'dependencies' => [ |
||
84 | 'ext.scite.styles', |
||
85 | 'mediawiki.api' |
||
86 | ], |
||
87 | 'targets' => [ |
||
88 | 'mobile', |
||
89 | 'desktop' |
||
90 | ] |
||
91 | ]; |
||
92 | |||
93 | // #71 |
||
94 | if ( version_compare( $GLOBALS['wgVersion'], '1.32', '<' ) ) { |
||
95 | $dependencies = [ |
||
96 | 'onoi.qtip', |
||
97 | 'onoi.blobstore', |
||
98 | 'ext.scite.styles', |
||
99 | 'mediawiki.api.parse' |
||
100 | ]; |
||
101 | } else { |
||
102 | $dependencies = [ |
||
103 | 'onoi.qtip', |
||
104 | 'onoi.blobstore', |
||
105 | 'ext.scite.styles', |
||
106 | 'mediawiki.api' |
||
107 | ]; |
||
108 | } |
||
109 | |||
110 | $GLOBALS['wgResourceModules']['ext.scite.tooltip'] = [ |
||
111 | 'scripts' => [ |
||
112 | 'res/scite.tooltip.js' |
||
113 | ], |
||
114 | 'localBasePath' => __DIR__ , |
||
115 | 'remoteExtPath' => 'SemanticCite', |
||
116 | 'dependencies' => $dependencies, |
||
117 | 'messages' => [ |
||
118 | 'sci-tooltip-citation-lookup-failure', |
||
119 | 'sci-tooltip-citation-lookup-failure-multiple' |
||
120 | ], |
||
121 | 'targets' => [ |
||
122 | 'mobile', |
||
123 | 'desktop' |
||
124 | ] |
||
125 | ]; |
||
126 | |||
127 | // Register hooks that require to be listed as soon as possible and preferable |
||
128 | // before the execution of onExtensionFunction |
||
129 | HookRegistry::initExtension(); |
||
130 | } |
||
174 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths