includes/parser/Parsoid/Config/SiteConfig.php
File SiteConfig.php
has 514 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
<?php
/**
* Copyright (C) 2011-2022 Wikimedia Foundation and others.
*
* This program is free software; you can redistribute it and/or modify
SiteConfig
has 56 functions (exceeds 20 allowed). Consider refactoring. Open
Open
class SiteConfig extends ISiteConfig {
/**
* Regular expression fragment for matching wikitext comments.
* Meant for inclusion in other regular expressions.
Function interwikiMap
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
Open
public function interwikiMap(): array {
// Unfortunate that this mostly duplicates \ApiQuerySiteinfo::appendInterwikiMap()
if ( $this->interwikiMap !== null ) {
return $this->interwikiMap;
}
- 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 18 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
ServiceOptions $config,
array $parsoidSettings,
ObjectFactory $objectFactory,
Language $contentLanguage,
StatsdDataFactoryInterface $stats,
Method interwikiMap
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function interwikiMap(): array {
// Unfortunate that this mostly duplicates \ApiQuerySiteinfo::appendInterwikiMap()
if ( $this->interwikiMap !== null ) {
return $this->interwikiMap;
}
Function variants
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
Open
public function variants(): array {
// Deprecated for all external callers; to make private and remove this warning.
if ( wfGetCaller() !== __CLASS__ . '->variantsFor' ) {
wfDeprecated( __METHOD__, '1.43' );
}
- 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 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function __construct(
ServiceOptions $config,
array $parsoidSettings,
ObjectFactory $objectFactory,
Language $contentLanguage,
Method variants
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function variants(): array {
// Deprecated for all external callers; to make private and remove this warning.
if ( wfGetCaller() !== __CLASS__ . '->variantsFor' ) {
wfDeprecated( __METHOD__, '1.43' );
}