Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
Complex classes like ApiQuerySiteinfo often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use ApiQuerySiteinfo, and based on these observations, apply Extract Interface, too.
1 | <?php |
||
32 | class ApiQuerySiteinfo extends ApiQueryBase { |
||
33 | |||
34 | public function __construct( ApiQuery $query, $moduleName ) { |
||
37 | |||
38 | public function execute() { |
||
127 | |||
128 | protected function appendGeneralInfo( $property ) { |
||
|
|||
129 | global $wgContLang; |
||
130 | |||
131 | $config = $this->getConfig(); |
||
132 | |||
133 | $data = []; |
||
134 | $mainPage = Title::newMainPage(); |
||
135 | $data['mainpage'] = $mainPage->getPrefixedText(); |
||
136 | $data['base'] = wfExpandUrl( $mainPage->getFullURL(), PROTO_CURRENT ); |
||
137 | $data['sitename'] = $config->get( 'Sitename' ); |
||
138 | |||
139 | // wgLogo can either be a relative or an absolute path |
||
140 | // make sure we always return an absolute path |
||
141 | $data['logo'] = wfExpandUrl( $config->get( 'Logo' ), PROTO_RELATIVE ); |
||
142 | |||
143 | $data['generator'] = "MediaWiki {$config->get( 'Version' )}"; |
||
144 | |||
145 | $data['phpversion'] = PHP_VERSION; |
||
146 | $data['phpsapi'] = PHP_SAPI; |
||
147 | if ( defined( 'HHVM_VERSION' ) ) { |
||
148 | $data['hhvmversion'] = HHVM_VERSION; |
||
149 | } |
||
150 | $data['dbtype'] = $config->get( 'DBtype' ); |
||
151 | $data['dbversion'] = $this->getDB()->getServerVersion(); |
||
152 | |||
153 | $allowFrom = [ '' ]; |
||
154 | $allowException = true; |
||
155 | if ( !$config->get( 'AllowExternalImages' ) ) { |
||
156 | $data['imagewhitelistenabled'] = (bool)$config->get( 'EnableImageWhitelist' ); |
||
157 | $allowFrom = $config->get( 'AllowExternalImagesFrom' ); |
||
158 | $allowException = !empty( $allowFrom ); |
||
159 | } |
||
160 | if ( $allowException ) { |
||
161 | $data['externalimages'] = (array)$allowFrom; |
||
162 | ApiResult::setIndexedTagName( $data['externalimages'], 'prefix' ); |
||
163 | } |
||
164 | |||
165 | $data['langconversion'] = !$config->get( 'DisableLangConversion' ); |
||
166 | $data['titleconversion'] = !$config->get( 'DisableTitleConversion' ); |
||
167 | |||
168 | if ( $wgContLang->linkPrefixExtension() ) { |
||
169 | $linkPrefixCharset = $wgContLang->linkPrefixCharset(); |
||
170 | $data['linkprefixcharset'] = $linkPrefixCharset; |
||
171 | // For backwards compatibility |
||
172 | $data['linkprefix'] = "/^((?>.*[^$linkPrefixCharset]|))(.+)$/sDu"; |
||
173 | } else { |
||
174 | $data['linkprefixcharset'] = ''; |
||
175 | $data['linkprefix'] = ''; |
||
176 | } |
||
177 | |||
178 | $linktrail = $wgContLang->linkTrail(); |
||
179 | $data['linktrail'] = $linktrail ?: ''; |
||
180 | |||
181 | $data['legaltitlechars'] = Title::legalChars(); |
||
182 | $data['invalidusernamechars'] = $config->get( 'InvalidUsernameCharacters' ); |
||
183 | |||
184 | $data['allunicodefixes'] = (bool)$config->get( 'AllUnicodeFixes' ); |
||
185 | $data['fixarabicunicode'] = (bool)$config->get( 'FixArabicUnicode' ); |
||
186 | $data['fixmalayalamunicode'] = (bool)$config->get( 'FixMalayalamUnicode' ); |
||
187 | |||
188 | global $IP; |
||
189 | $git = SpecialVersion::getGitHeadSha1( $IP ); |
||
190 | if ( $git ) { |
||
191 | $data['git-hash'] = $git; |
||
192 | $data['git-branch'] = |
||
193 | SpecialVersion::getGitCurrentBranch( $GLOBALS['IP'] ); |
||
194 | } |
||
195 | |||
196 | // 'case-insensitive' option is reserved for future |
||
197 | $data['case'] = $config->get( 'CapitalLinks' ) ? 'first-letter' : 'case-sensitive'; |
||
198 | $data['lang'] = $config->get( 'LanguageCode' ); |
||
199 | |||
200 | $fallbacks = []; |
||
201 | foreach ( $wgContLang->getFallbackLanguages() as $code ) { |
||
202 | $fallbacks[] = [ 'code' => $code ]; |
||
203 | } |
||
204 | $data['fallback'] = $fallbacks; |
||
205 | ApiResult::setIndexedTagName( $data['fallback'], 'lang' ); |
||
206 | |||
207 | if ( $wgContLang->hasVariants() ) { |
||
208 | $variants = []; |
||
209 | foreach ( $wgContLang->getVariants() as $code ) { |
||
210 | $variants[] = [ |
||
211 | 'code' => $code, |
||
212 | 'name' => $wgContLang->getVariantname( $code ), |
||
213 | ]; |
||
214 | } |
||
215 | $data['variants'] = $variants; |
||
216 | ApiResult::setIndexedTagName( $data['variants'], 'lang' ); |
||
217 | } |
||
218 | |||
219 | $data['rtl'] = $wgContLang->isRTL(); |
||
220 | $data['fallback8bitEncoding'] = $wgContLang->fallback8bitEncoding(); |
||
221 | |||
222 | $data['readonly'] = wfReadOnly(); |
||
223 | if ( $data['readonly'] ) { |
||
224 | $data['readonlyreason'] = wfReadOnlyReason(); |
||
225 | } |
||
226 | $data['writeapi'] = (bool)$config->get( 'EnableWriteAPI' ); |
||
227 | |||
228 | $data['maxarticlesize'] = $config->get( 'MaxArticleSize' ) * 1024; |
||
229 | |||
230 | $tz = $config->get( 'Localtimezone' ); |
||
231 | $offset = $config->get( 'LocalTZoffset' ); |
||
232 | if ( is_null( $tz ) ) { |
||
233 | $tz = 'UTC'; |
||
234 | $offset = 0; |
||
235 | } elseif ( is_null( $offset ) ) { |
||
236 | $offset = 0; |
||
237 | } |
||
238 | $data['timezone'] = $tz; |
||
239 | $data['timeoffset'] = intval( $offset ); |
||
240 | $data['articlepath'] = $config->get( 'ArticlePath' ); |
||
241 | $data['scriptpath'] = $config->get( 'ScriptPath' ); |
||
242 | $data['script'] = $config->get( 'Script' ); |
||
243 | $data['variantarticlepath'] = $config->get( 'VariantArticlePath' ); |
||
244 | $data[ApiResult::META_BC_BOOLS][] = 'variantarticlepath'; |
||
245 | $data['server'] = $config->get( 'Server' ); |
||
246 | $data['servername'] = $config->get( 'ServerName' ); |
||
247 | $data['wikiid'] = wfWikiID(); |
||
248 | $data['time'] = wfTimestamp( TS_ISO_8601, time() ); |
||
249 | |||
250 | $data['misermode'] = (bool)$config->get( 'MiserMode' ); |
||
251 | |||
252 | $data['uploadsenabled'] = UploadBase::isEnabled(); |
||
253 | $data['maxuploadsize'] = UploadBase::getMaxUploadSize(); |
||
254 | $data['minuploadchunksize'] = (int)$config->get( 'MinUploadChunkSize' ); |
||
255 | |||
256 | $data['thumblimits'] = $config->get( 'ThumbLimits' ); |
||
257 | ApiResult::setArrayType( $data['thumblimits'], 'BCassoc' ); |
||
258 | ApiResult::setIndexedTagName( $data['thumblimits'], 'limit' ); |
||
259 | $data['imagelimits'] = []; |
||
260 | ApiResult::setArrayType( $data['imagelimits'], 'BCassoc' ); |
||
261 | ApiResult::setIndexedTagName( $data['imagelimits'], 'limit' ); |
||
262 | foreach ( $config->get( 'ImageLimits' ) as $k => $limit ) { |
||
263 | $data['imagelimits'][$k] = [ 'width' => $limit[0], 'height' => $limit[1] ]; |
||
264 | } |
||
265 | |||
266 | $favicon = $config->get( 'Favicon' ); |
||
267 | if ( !empty( $favicon ) ) { |
||
268 | // wgFavicon can either be a relative or an absolute path |
||
269 | // make sure we always return an absolute path |
||
270 | $data['favicon'] = wfExpandUrl( $favicon, PROTO_RELATIVE ); |
||
271 | } |
||
272 | |||
273 | $data['centralidlookupprovider'] = $config->get( 'CentralIdLookupProvider' ); |
||
274 | $providerIds = array_keys( $config->get( 'CentralIdLookupProviders' ) ); |
||
275 | $data['allcentralidlookupproviders'] = $providerIds; |
||
276 | |||
277 | $data['interwikimagic'] = (bool)$config->get( 'InterwikiMagic' ); |
||
278 | $data['magiclinks'] = $config->get( 'EnableMagicLinks' ); |
||
279 | |||
280 | Hooks::run( 'APIQuerySiteInfoGeneralInfo', [ $this, &$data ] ); |
||
281 | |||
282 | return $this->getResult()->addValue( 'query', $property, $data ); |
||
283 | } |
||
284 | |||
285 | protected function appendNamespaces( $property ) { |
||
286 | global $wgContLang; |
||
287 | $data = [ |
||
288 | ApiResult::META_TYPE => 'assoc', |
||
289 | ]; |
||
290 | foreach ( $wgContLang->getFormattedNamespaces() as $ns => $title ) { |
||
291 | $data[$ns] = [ |
||
292 | 'id' => intval( $ns ), |
||
293 | 'case' => MWNamespace::isCapitalized( $ns ) ? 'first-letter' : 'case-sensitive', |
||
294 | ]; |
||
295 | ApiResult::setContentValue( $data[$ns], 'name', $title ); |
||
296 | $canonical = MWNamespace::getCanonicalName( $ns ); |
||
297 | |||
298 | $data[$ns]['subpages'] = MWNamespace::hasSubpages( $ns ); |
||
299 | |||
300 | if ( $canonical ) { |
||
301 | $data[$ns]['canonical'] = strtr( $canonical, '_', ' ' ); |
||
302 | } |
||
303 | |||
304 | $data[$ns]['content'] = MWNamespace::isContent( $ns ); |
||
305 | $data[$ns]['nonincludable'] = MWNamespace::isNonincludable( $ns ); |
||
306 | |||
307 | $contentmodel = MWNamespace::getNamespaceContentModel( $ns ); |
||
308 | if ( $contentmodel ) { |
||
309 | $data[$ns]['defaultcontentmodel'] = $contentmodel; |
||
310 | } |
||
311 | } |
||
312 | |||
313 | ApiResult::setArrayType( $data, 'assoc' ); |
||
314 | ApiResult::setIndexedTagName( $data, 'ns' ); |
||
315 | |||
316 | return $this->getResult()->addValue( 'query', $property, $data ); |
||
317 | } |
||
318 | |||
319 | protected function appendNamespaceAliases( $property ) { |
||
320 | global $wgContLang; |
||
321 | $aliases = array_merge( $this->getConfig()->get( 'NamespaceAliases' ), |
||
322 | $wgContLang->getNamespaceAliases() ); |
||
323 | $namespaces = $wgContLang->getNamespaces(); |
||
324 | $data = []; |
||
325 | foreach ( $aliases as $title => $ns ) { |
||
326 | if ( $namespaces[$ns] == $title ) { |
||
327 | // Don't list duplicates |
||
328 | continue; |
||
329 | } |
||
330 | $item = [ |
||
331 | 'id' => intval( $ns ) |
||
332 | ]; |
||
333 | ApiResult::setContentValue( $item, 'alias', strtr( $title, '_', ' ' ) ); |
||
334 | $data[] = $item; |
||
335 | } |
||
336 | |||
337 | sort( $data ); |
||
338 | |||
339 | ApiResult::setIndexedTagName( $data, 'ns' ); |
||
340 | |||
341 | return $this->getResult()->addValue( 'query', $property, $data ); |
||
342 | } |
||
343 | |||
344 | View Code Duplication | protected function appendSpecialPageAliases( $property ) { |
|
345 | global $wgContLang; |
||
346 | $data = []; |
||
347 | $aliases = $wgContLang->getSpecialPageAliases(); |
||
348 | foreach ( SpecialPageFactory::getNames() as $specialpage ) { |
||
349 | if ( isset( $aliases[$specialpage] ) ) { |
||
350 | $arr = [ 'realname' => $specialpage, 'aliases' => $aliases[$specialpage] ]; |
||
351 | ApiResult::setIndexedTagName( $arr['aliases'], 'alias' ); |
||
352 | $data[] = $arr; |
||
353 | } |
||
354 | } |
||
355 | ApiResult::setIndexedTagName( $data, 'specialpage' ); |
||
356 | |||
357 | return $this->getResult()->addValue( 'query', $property, $data ); |
||
358 | } |
||
359 | |||
360 | View Code Duplication | protected function appendMagicWords( $property ) { |
|
361 | global $wgContLang; |
||
362 | $data = []; |
||
363 | foreach ( $wgContLang->getMagicWords() as $magicword => $aliases ) { |
||
364 | $caseSensitive = array_shift( $aliases ); |
||
365 | $arr = [ 'name' => $magicword, 'aliases' => $aliases ]; |
||
366 | $arr['case-sensitive'] = (bool)$caseSensitive; |
||
367 | ApiResult::setIndexedTagName( $arr['aliases'], 'alias' ); |
||
368 | $data[] = $arr; |
||
369 | } |
||
370 | ApiResult::setIndexedTagName( $data, 'magicword' ); |
||
371 | |||
372 | return $this->getResult()->addValue( 'query', $property, $data ); |
||
373 | } |
||
374 | |||
375 | protected function appendInterwikiMap( $property, $filter ) { |
||
376 | $local = null; |
||
377 | if ( $filter === 'local' ) { |
||
378 | $local = 1; |
||
379 | } elseif ( $filter === '!local' ) { |
||
380 | $local = 0; |
||
381 | } elseif ( $filter ) { |
||
382 | ApiBase::dieDebug( __METHOD__, "Unknown filter=$filter" ); |
||
383 | } |
||
384 | |||
385 | $params = $this->extractRequestParams(); |
||
386 | $langCode = isset( $params['inlanguagecode'] ) ? $params['inlanguagecode'] : ''; |
||
387 | $langNames = Language::fetchLanguageNames( $langCode ); |
||
388 | |||
389 | $getPrefixes = Interwiki::getAllPrefixes( $local ); |
||
390 | $extraLangPrefixes = $this->getConfig()->get( 'ExtraInterlanguageLinkPrefixes' ); |
||
391 | $localInterwikis = $this->getConfig()->get( 'LocalInterwikis' ); |
||
392 | $data = []; |
||
393 | |||
394 | foreach ( $getPrefixes as $row ) { |
||
395 | $prefix = $row['iw_prefix']; |
||
396 | $val = []; |
||
397 | $val['prefix'] = $prefix; |
||
398 | if ( isset( $row['iw_local'] ) && $row['iw_local'] == '1' ) { |
||
399 | $val['local'] = true; |
||
400 | } |
||
401 | if ( isset( $row['iw_trans'] ) && $row['iw_trans'] == '1' ) { |
||
402 | $val['trans'] = true; |
||
403 | } |
||
404 | |||
405 | if ( isset( $langNames[$prefix] ) ) { |
||
406 | $val['language'] = $langNames[$prefix]; |
||
407 | } |
||
408 | if ( in_array( $prefix, $localInterwikis ) ) { |
||
409 | $val['localinterwiki'] = true; |
||
410 | } |
||
411 | if ( in_array( $prefix, $extraLangPrefixes ) ) { |
||
412 | $val['extralanglink'] = true; |
||
413 | |||
414 | $linktext = wfMessage( "interlanguage-link-$prefix" ); |
||
415 | if ( !$linktext->isDisabled() ) { |
||
416 | $val['linktext'] = $linktext->text(); |
||
417 | } |
||
418 | |||
419 | $sitename = wfMessage( "interlanguage-link-sitename-$prefix" ); |
||
420 | if ( !$sitename->isDisabled() ) { |
||
421 | $val['sitename'] = $sitename->text(); |
||
422 | } |
||
423 | } |
||
424 | |||
425 | $val['url'] = wfExpandUrl( $row['iw_url'], PROTO_CURRENT ); |
||
426 | $val['protorel'] = substr( $row['iw_url'], 0, 2 ) == '//'; |
||
427 | if ( isset( $row['iw_wikiid'] ) && $row['iw_wikiid'] !== '' ) { |
||
428 | $val['wikiid'] = $row['iw_wikiid']; |
||
429 | } |
||
430 | if ( isset( $row['iw_api'] ) && $row['iw_api'] !== '' ) { |
||
431 | $val['api'] = $row['iw_api']; |
||
432 | } |
||
433 | |||
434 | $data[] = $val; |
||
435 | } |
||
436 | |||
437 | ApiResult::setIndexedTagName( $data, 'iw' ); |
||
438 | |||
439 | return $this->getResult()->addValue( 'query', $property, $data ); |
||
440 | } |
||
441 | |||
442 | protected function appendDbReplLagInfo( $property, $includeAll ) { |
||
443 | $data = []; |
||
444 | $lb = wfGetLB(); |
||
445 | $showHostnames = $this->getConfig()->get( 'ShowHostnames' ); |
||
446 | if ( $includeAll ) { |
||
447 | if ( !$showHostnames ) { |
||
448 | $this->dieUsage( |
||
449 | 'Cannot view all servers info unless $wgShowHostnames is true', |
||
450 | 'includeAllDenied' |
||
451 | ); |
||
452 | } |
||
453 | |||
454 | $lags = $lb->getLagTimes(); |
||
455 | foreach ( $lags as $i => $lag ) { |
||
456 | $data[] = [ |
||
457 | 'host' => $lb->getServerName( $i ), |
||
458 | 'lag' => $lag |
||
459 | ]; |
||
460 | } |
||
461 | } else { |
||
462 | list( , $lag, $index ) = $lb->getMaxLag(); |
||
463 | $data[] = [ |
||
464 | 'host' => $showHostnames |
||
465 | ? $lb->getServerName( $index ) |
||
466 | : '', |
||
467 | 'lag' => intval( $lag ) |
||
468 | ]; |
||
469 | } |
||
470 | |||
471 | ApiResult::setIndexedTagName( $data, 'db' ); |
||
472 | |||
473 | return $this->getResult()->addValue( 'query', $property, $data ); |
||
474 | } |
||
475 | |||
476 | protected function appendStatistics( $property ) { |
||
477 | $data = []; |
||
478 | $data['pages'] = intval( SiteStats::pages() ); |
||
479 | $data['articles'] = intval( SiteStats::articles() ); |
||
480 | $data['edits'] = intval( SiteStats::edits() ); |
||
481 | $data['images'] = intval( SiteStats::images() ); |
||
482 | $data['users'] = intval( SiteStats::users() ); |
||
483 | $data['activeusers'] = intval( SiteStats::activeUsers() ); |
||
484 | $data['admins'] = intval( SiteStats::numberingroup( 'sysop' ) ); |
||
485 | $data['jobs'] = intval( SiteStats::jobs() ); |
||
486 | |||
487 | Hooks::run( 'APIQuerySiteInfoStatisticsInfo', [ &$data ] ); |
||
488 | |||
489 | return $this->getResult()->addValue( 'query', $property, $data ); |
||
490 | } |
||
491 | |||
492 | protected function appendUserGroups( $property, $numberInGroup ) { |
||
493 | $config = $this->getConfig(); |
||
494 | |||
495 | $data = []; |
||
496 | $result = $this->getResult(); |
||
497 | $allGroups = array_values( User::getAllGroups() ); |
||
498 | foreach ( $config->get( 'GroupPermissions' ) as $group => $permissions ) { |
||
499 | $arr = [ |
||
500 | 'name' => $group, |
||
501 | 'rights' => array_keys( $permissions, true ), |
||
502 | ]; |
||
503 | |||
504 | if ( $numberInGroup ) { |
||
505 | $autopromote = $config->get( 'Autopromote' ); |
||
506 | |||
507 | if ( $group == 'user' ) { |
||
508 | $arr['number'] = SiteStats::users(); |
||
509 | // '*' and autopromote groups have no size |
||
510 | } elseif ( $group !== '*' && !isset( $autopromote[$group] ) ) { |
||
511 | $arr['number'] = SiteStats::numberingroup( $group ); |
||
512 | } |
||
513 | } |
||
514 | |||
515 | $groupArr = [ |
||
516 | 'add' => $config->get( 'AddGroups' ), |
||
517 | 'remove' => $config->get( 'RemoveGroups' ), |
||
518 | 'add-self' => $config->get( 'GroupsAddToSelf' ), |
||
519 | 'remove-self' => $config->get( 'GroupsRemoveFromSelf' ) |
||
520 | ]; |
||
521 | |||
522 | foreach ( $groupArr as $type => $rights ) { |
||
523 | if ( isset( $rights[$group] ) ) { |
||
524 | if ( $rights[$group] === true ) { |
||
525 | $groups = $allGroups; |
||
526 | } else { |
||
527 | $groups = array_intersect( $rights[$group], $allGroups ); |
||
528 | } |
||
529 | if ( $groups ) { |
||
530 | $arr[$type] = $groups; |
||
531 | ApiResult::setArrayType( $arr[$type], 'BCarray' ); |
||
532 | ApiResult::setIndexedTagName( $arr[$type], 'group' ); |
||
533 | } |
||
534 | } |
||
535 | } |
||
536 | |||
537 | ApiResult::setIndexedTagName( $arr['rights'], 'permission' ); |
||
538 | $data[] = $arr; |
||
539 | } |
||
540 | |||
541 | ApiResult::setIndexedTagName( $data, 'group' ); |
||
542 | |||
543 | return $result->addValue( 'query', $property, $data ); |
||
544 | } |
||
545 | |||
546 | protected function appendFileExtensions( $property ) { |
||
547 | $data = []; |
||
548 | foreach ( array_unique( $this->getConfig()->get( 'FileExtensions' ) ) as $ext ) { |
||
549 | $data[] = [ 'ext' => $ext ]; |
||
550 | } |
||
551 | ApiResult::setIndexedTagName( $data, 'fe' ); |
||
552 | |||
553 | return $this->getResult()->addValue( 'query', $property, $data ); |
||
554 | } |
||
555 | |||
556 | protected function appendInstalledLibraries( $property ) { |
||
557 | global $IP; |
||
558 | $path = "$IP/vendor/composer/installed.json"; |
||
559 | if ( !file_exists( $path ) ) { |
||
560 | return true; |
||
561 | } |
||
562 | |||
563 | $data = []; |
||
564 | $installed = new ComposerInstalled( $path ); |
||
565 | foreach ( $installed->getInstalledDependencies() as $name => $info ) { |
||
566 | if ( strpos( $info['type'], 'mediawiki-' ) === 0 ) { |
||
567 | // Skip any extensions or skins since they'll be listed |
||
568 | // in their proper section |
||
569 | continue; |
||
570 | } |
||
571 | $data[] = [ |
||
572 | 'name' => $name, |
||
573 | 'version' => $info['version'], |
||
574 | ]; |
||
575 | } |
||
576 | ApiResult::setIndexedTagName( $data, 'library' ); |
||
577 | |||
578 | return $this->getResult()->addValue( 'query', $property, $data ); |
||
579 | } |
||
580 | |||
581 | protected function appendExtensions( $property ) { |
||
653 | |||
654 | protected function appendRightsInfo( $property ) { |
||
676 | |||
677 | protected function appendRestrictions( $property ) { |
||
698 | |||
699 | public function appendLanguages( $property ) { |
||
715 | |||
716 | public function appendSkins( $property ) { |
||
745 | |||
746 | View Code Duplication | public function appendExtensionTags( $property ) { |
|
755 | |||
756 | View Code Duplication | public function appendFunctionHooks( $property ) { |
|
765 | |||
766 | public function appendVariables( $property ) { |
||
773 | |||
774 | public function appendProtocols( $property ) { |
||
782 | |||
783 | public function appendDefaultOptions( $property ) { |
||
788 | |||
789 | public function appendUploadDialog( $property ) { |
||
793 | |||
794 | private function formatParserTags( $item ) { |
||
797 | |||
798 | public function appendSubscribedHooks( $property ) { |
||
819 | |||
820 | public function getCacheMode( $params ) { |
||
832 | |||
833 | public function getAllowedParams() { |
||
876 | |||
877 | protected function getExamplesMessages() { |
||
887 | |||
888 | public function getHelpUrls() { |
||
891 | } |
||
892 |
Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable: