File SkinTemplate.php
has 1059 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Copyright © Gabriel Wicke -- http://www.aulinx.de/
*
* This program is free software; you can redistribute it and/or modify
Function buildContentNavigationUrlsInternal
has a Cognitive Complexity of 105 (exceeds 5 allowed). Consider refactoring. Open
private function buildContentNavigationUrlsInternal() {
if ( $this->contentNavigationCached ) {
return $this->contentNavigationCached;
}
// Display tabs for the relevant title rather than always the title itself
- 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 buildContentNavigationUrlsInternal
has 291 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function buildContentNavigationUrlsInternal() {
if ( $this->contentNavigationCached ) {
return $this->contentNavigationCached;
}
// Display tabs for the relevant title rather than always the title itself
SkinTemplate
has 36 functions (exceeds 20 allowed). Consider refactoring. Open
class SkinTemplate extends Skin {
/**
* @var string For QuickTemplate, the name of the subclass which will
* actually fill the template.
*/
Method prepareQuickTemplate
has 112 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function prepareQuickTemplate() {
$title = $this->getTitle();
$request = $this->getRequest();
$out = $this->getOutput();
$config = $this->getConfig();
Method buildPersonalUrls
has 97 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function buildPersonalUrls( bool $includeNotifications = true ) {
$this->setupTemplateContext();
$title = $this->getTitle();
$authority = $this->getAuthority();
$request = $this->getRequest();
Function buildPersonalUrls
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
protected function buildPersonalUrls( bool $includeNotifications = true ) {
$this->setupTemplateContext();
$title = $this->getTitle();
$authority = $this->getAuthority();
$request = $this->getRequest();
- 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
Consider simplifying this complex logical expression. Open
if ( $this->getAuthority()->probablyCan( 'edit', $title ) ) {
// Builds CSS class for talk page links
$isTalkClass = $isTalk ? ' istalk' : '';
// Whether the user is editing the page
$isEditing = $onPage && ( $action == 'edit' || $action == 'submit' );
Function getPortletsTemplateData
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
private function getPortletsTemplateData() {
if ( $this->portletsCached ) {
return $this->portletsCached;
}
$portlets = [];
- 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 getPortletsTemplateData
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function getPortletsTemplateData() {
if ( $this->portletsCached ) {
return $this->portletsCached;
}
$portlets = [];
Function buildContentActionUrls
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
private function buildContentActionUrls( $content_navigation ) {
// content_actions has been replaced with content_navigation for backwards
// compatibility and also for skins that just want simple tabs content_actions
// is now built by flattening the content_navigation arrays into one
- 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 tabAction
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function tabAction( $title, $message, $selected, $query = '', $checkEdit = false ) {
$classes = [];
if ( $selected ) {
$classes[] = 'selected';
}
Method makeSearchButtonInternal
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function makeSearchButtonInternal( $mode, $searchData, $attrs = [] ) {
switch ( $mode ) {
case 'go':
$attrs['value'] ??= wfMessage( 'searcharticle' )->text();
return Html::element(
Function tabAction
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function tabAction( $title, $message, $selected, $query = '', $checkEdit = false ) {
$classes = [];
if ( $selected ) {
$classes[] = 'selected';
}
- 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 getWatchLinkAttrs
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function getWatchLinkAttrs(
string $mode, Authority $performer, Title $title, ?string $action, bool $onPage
): array {
$isWatchMode = $action == 'watch';
$class = 'mw-watchlink ' . (
Method makeContributionsLink
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function makeContributionsLink(
array &$personal_urls,
string $key,
?string $userName = null,
bool $active = false
Method getSpecialPageAssociatedNavigationLinks
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function getSpecialPageAssociatedNavigationLinks( Title $title ): array {
$specialAssociatedNavigationLinks = [];
$specialFactory = MediaWikiServices::getInstance()->getSpecialPageFactory();
$special = $specialFactory->getPage( $title->getText() );
if ( $special === null ) {
Method tabAction
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function tabAction( $title, $message, $selected, $query = '', $checkEdit = false ) {
Method getWatchLinkAttrs
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
string $mode, Authority $performer, Title $title, ?string $action, bool $onPage
Function getWatchLinkAttrs
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function getWatchLinkAttrs(
string $mode, Authority $performer, Title $title, ?string $action, bool $onPage
): array {
$isWatchMode = $action == 'watch';
$class = 'mw-watchlink ' . (
- 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 getSpecialPageAssociatedNavigationLinks
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function getSpecialPageAssociatedNavigationLinks( Title $title ): array {
$specialAssociatedNavigationLinks = [];
$specialFactory = MediaWikiServices::getInstance()->getSpecialPageFactory();
$special = $specialFactory->getPage( $title->getText() );
if ( $special === 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
Function prepareQuickTemplate
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function prepareQuickTemplate() {
$title = $this->getTitle();
$request = $this->getRequest();
$out = $this->getOutput();
$config = $this->getConfig();
- 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"