File ProtectionForm.php
has 454 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Page protection
*
* Copyright © 2005 Brooke Vibber <bvibber@wikimedia.org>
Method buildForm
has 162 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function buildForm() {
$this->mOut->enableOOUI();
$out = '';
$fields = [];
if ( !$this->disabled ) {
Function buildForm
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
private function buildForm() {
$this->mOut->enableOOUI();
$out = '';
$fields = [];
if ( !$this->disabled ) {
- 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 save
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function save() {
# Permission check!
if ( $this->disabled ) {
$this->show();
return false;
Function save
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
private function save() {
# Permission check!
if ( $this->disabled ) {
$this->show();
return false;
- 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 show
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function show( $err = null ) {
$out = $this->mOut;
$out->setRobotPolicy( 'noindex,nofollow' );
$out->addBacklinkSubtitle( $this->mTitle );
Method loadData
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function loadData() {
$levels = $this->permManager->getNamespaceRestrictionLevels(
$this->mTitle->getNamespace(), $this->mPerformer->getUser()
);
Function loadData
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
private function loadData() {
$levels = $this->permManager->getNamespaceRestrictionLevels(
$this->mTitle->getNamespace(), $this->mPerformer->getUser()
);
- 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 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __construct( Article $article ) {
// Set instance variables.
$this->mArticle = $article;
$this->mTitle = $article->getTitle();
$this->mContext = $article->getContext();
Function getExpiry
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private function getExpiry( $action ) {
if ( $this->mExpirySelection[$action] == 'existing' ) {
return $this->mExistingExpiry[$action];
} elseif ( $this->mExpirySelection[$action] == 'othertime' ) {
$value = $this->mExpiry[$action];
- 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 show
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private function show( $err = null ) {
$out = $this->mOut;
$out->setRobotPolicy( 'noindex,nofollow' );
$out->addBacklinkSubtitle( $this->mTitle );
- 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
Avoid too many return
statements within this method. Open
return false;
Avoid too many return
statements within this method. Open
return false;
Avoid too many return
statements within this method. Open
return true;