SettingsBuilder
has 38 functions (exceeds 20 allowed). Consider refactoring. Open
class SettingsBuilder {
/**
* @var int The initial stage in which settings can be loaded,
* but config values cannot be accessed.
File SettingsBuilder.php
has 356 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace MediaWiki\Settings;
use MediaWiki\Config\Config;
Function applySettings
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
private function applySettings( array $settings ) {
// First extract config variables that change the behavior of SettingsBuilder.
// No merge strategies are applied, defaults are set in the constructor.
if ( isset( $settings['config'] ) ) {
$this->updateSettingsConfig( $settings['config'] );
- 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 applySettings
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function applySettings( array $settings ) {
// First extract config variables that change the behavior of SettingsBuilder.
// No merge strategies are applied, defaults are set in the constructor.
if ( isset( $settings['config'] ) ) {
$this->updateSettingsConfig( $settings['config'] );
Method applySchemas
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function applySchemas( array $settings ) {
$defaults = [];
if ( isset( $settings['config-schema-inverse'] ) ) {
$defaults = $settings['config-schema-inverse']['default'] ?? [];
Function applySchemas
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private function applySchemas( array $settings ) {
$defaults = [];
if ( isset( $settings['config-schema-inverse'] ) ) {
$defaults = $settings['config-schema-inverse']['default'] ?? [];
- 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 loadRecursive
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private function loadRecursive( array $batch, array $stack = [] ): array {
$allSettings = [];
// Depth-first traversal of settings sources.
foreach ( $batch as $source ) {
- 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
string $baseDir,
ExtensionRegistry $extensionRegistry,
ConfigBuilder $configSink,
PhpIniSink $phpIniSink,
BagOStuff $cache = null
Function detectDeprecatedConfig
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function detectDeprecatedConfig(): array {
$config = $this->getConfig();
$keys = $this->getDefinedConfigKeys();
$deprecated = [];
- 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"