File SpecialVersion.php
has 960 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Copyright © 2005 Ævar Arnfjörð Bjarmason
*
* This program is free software; you can redistribute it and/or modify
Function getCreditsForExtension
has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring. Open
public function getCreditsForExtension( $type, array $extension ) {
$out = $this->getOutput();
// We must obtain the information for all the bits and pieces!
// ... such as extension names and links
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function execute
has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring. Open
public function execute( $par ) {
$config = $this->getConfig();
$credits = self::getCredits( ExtensionRegistry::getInstance(), $config );
$this->setHeaders();
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method getCreditsForExtension
has 135 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getCreditsForExtension( $type, array $extension ) {
$out = $this->getOutput();
// We must obtain the information for all the bits and pieces!
// ... such as extension names and links
Method execute
has 113 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function execute( $par ) {
$config = $this->getConfig();
$credits = self::getCredits( ExtensionRegistry::getInstance(), $config );
$this->setHeaders();
SpecialVersion
has 35 functions (exceeds 20 allowed). Consider refactoring. Open
class SpecialVersion extends SpecialPage {
/**
* @var string The current rev id/SHA hash of MediaWiki core
*/
Method getExternalLibraries
has 76 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function getExternalLibraries( array $credits ) {
$paths = [
MW_INSTALL_PATH . '/vendor/composer/installed.json'
];
Function getExternalLibraries
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
protected function getExternalLibraries( array $credits ) {
$paths = [
MW_INSTALL_PATH . '/vendor/composer/installed.json'
];
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method getEntryPointInfo
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getEntryPointInfo() {
$config = $this->getConfig();
$scriptPath = $config->get( MainConfigNames::ScriptPath ) ?: '/';
$entryPoints = [
Function listAuthors
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public function listAuthors( $authors, $extName, $extDir ): string {
$hasOthers = false;
$linkRenderer = $this->getLinkRenderer();
$list = [];
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method listAuthors
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function listAuthors( $authors, $extName, $extDir ): string {
$hasOthers = false;
$linkRenderer = $this->getLinkRenderer();
$list = [];
Method getClientSideLibraries
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function getClientSideLibraries() {
$this->addTocSection( 'version-libraries-client', 'mw-version-libraries-client' );
$out = Html::element(
'h2',
Method getExtensionCredits
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function getExtensionCredits( array $credits ) {
$extensionTypes = self::getExtensionTypes();
$this->addTocSection( 'version-extensions', 'mw-version-ext' );
Method getHooks
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function getHooks() {
if ( !$this->getConfig()->get( MainConfigNames::SpecialVersionShowHooks ) ) {
return '';
}
Method getParserTags
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function getParserTags() {
$tags = $this->parserFactory->getMainInstance()->getTags();
if ( !$tags ) {
return '';
}
Method getCopyrightAndAuthorList
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function getCopyrightAndAuthorList() {
if ( defined( 'MEDIAWIKI_INSTALL' ) ) {
$othersLink = '[https://www.mediawiki.org/wiki/Special:Version/Credits ' .
wfMessage( 'version-poweredby-others' )->plain() . ']';
} else {
Function getExtensionCredits
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private function getExtensionCredits( array $credits ) {
$extensionTypes = self::getExtensionTypes();
$this->addTocSection( 'version-extensions', 'mw-version-ext' );
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function arrayToString
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public static function arrayToString( $list ) {
if ( is_array( $list ) && count( $list ) == 1 ) {
$list = $list[0];
}
if ( $list instanceof Closure ) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function parseForeignResources
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public static function parseForeignResources() {
$registryDirs = [ 'MediaWiki' => MW_INSTALL_PATH . '/resources/lib' ]
+ ExtensionRegistry::getInstance()->getAttribute( 'ForeignResourcesDir' );
$modules = [];
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"