Function getParsedConfig
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
public function getParsedConfig( Language $lang = null ) {
if ( $lang === null ) {
$lang = $this->context->getLanguage();
}
- 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
File Campaign.php
has 309 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace MediaWiki\Extension\UploadWizard;
use InvalidArgumentException;
Method getParsedConfig
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getParsedConfig( Language $lang = null ) {
if ( $lang === null ) {
$lang = $this->context->getLanguage();
}
Campaign
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
class Campaign {
/**
* The campaign configuration.
*
Function parseArrayValues
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
private function parseArrayValues( $array, Language $lang, $forKeys = null ) {
$parsed = [];
foreach ( $array as $key => $value ) {
if ( $forKeys !== null ) {
if ( in_array( $key, $forKeys ) ) {
- 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 modifyIfNecessary
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
protected function modifyIfNecessary() {
foreach ( $this->parsedConfig as $cnf => $modifiers ) {
if ( $cnf === 'whileActive' && $this->isActive() ) {
$activeModifiers = $modifiers;
} elseif ( $cnf === 'afterActive' && $this->wasActive() ) {
- 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 applyObjectReferenceToButtons
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private function applyObjectReferenceToButtons( $objRef ) {
$customizableButtons = [ 'homeButton', 'beginButton' ];
foreach ( $customizableButtons as $button ) {
if ( isset( $this->parsedConfig['display'][$button]['target'] ) &&
- 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 __construct
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function __construct( $title, $config = null, $context = null ) {
$services = MediaWikiServices::getInstance();
$this->wanObjectCache = $services->getMainWANObjectCache();
$this->dbr = $services->getDBLoadBalancerFactory()->getReplicaDatabase();
$this->parser = $services->getParser();
- 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"