File SpecialPageFactory.php
has 1509 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Factory for handling the special page list and generating SpecialPage objects.
*
* This program is free software; you can redistribute it and/or modify
Function getAliasList
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
private function getAliasList(): array {
if ( $this->aliases === null ) {
$aliases = $this->contLang->getSpecialPageAliases();
$pageList = $this->getPageList();
- 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 getPageList
has 79 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function getPageList(): array {
if ( !is_array( $this->list ) ) {
$this->list = self::CORE_LIST;
if ( !$this->options->get( MainConfigNames::DisableInternalSearch ) ) {
Function getLocalNameFor
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
public function getLocalNameFor( $name, $subpage = false ) {
$aliases = $this->contLang->getSpecialPageAliases();
$aliasList = $this->getAliasList();
// Find the first alias that maps back to $name
- 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 getPageList
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
private function getPageList(): array {
if ( !is_array( $this->list ) ) {
$this->list = self::CORE_LIST;
if ( !$this->options->get( MainConfigNames::DisableInternalSearch ) ) {
- 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 capturePath
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function capturePath(
PageReference $page, IContextSource $context, LinkRenderer $linkRenderer = null
) {
// phpcs:ignore MediaWiki.Usage.DeprecatedGlobalVariables.Deprecated$wgUser
global $wgTitle, $wgOut, $wgRequest, $wgUser, $wgLang;
Method executePath
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function executePath( $path, IContextSource $context, $including = false,
LinkRenderer $linkRenderer = null
) {
if ( $path instanceof PageReference ) {
$path = $path->getDBkey();
Function executePath
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function executePath( $path, IContextSource $context, $including = false,
LinkRenderer $linkRenderer = null
) {
if ( $path instanceof PageReference ) {
$path = $path->getDBkey();
- 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 getAliasList
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function getAliasList(): array {
if ( $this->aliases === null ) {
$aliases = $this->contLang->getSpecialPageAliases();
$pageList = $this->getPageList();
Method getLocalNameFor
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getLocalNameFor( $name, $subpage = false ) {
$aliases = $this->contLang->getSpecialPageAliases();
$aliasList = $this->getAliasList();
// Find the first alias that maps back to $name
Function getUsablePages
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function getUsablePages( User $user ): array {
$pages = [];
foreach ( $this->getPageList() as $name => $rec ) {
$page = $this->getPage( $name );
if ( $page ) { // not null
- 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 __construct
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
ServiceOptions $options,
Language $contLang,
ObjectFactory $objectFactory,
TitleFactory $titleFactory,
HookContainer $hookContainer
Function getPage
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function getPage( $name ) {
[ $realName, /*...*/ ] = $this->resolveAlias( $name );
$specialPageList = $this->getPageList();
- 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"