includes/api/Validator/ApiParamValidator.php
Function checkSettings
has a Cognitive Complexity of 89 (exceeds 5 allowed). Consider refactoring. Open
Open
public function checkSettings(
ApiBase $module, array $params, string $name, array $options
): array {
$options['module'] = $module;
$settings = $params[$name];
- 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 checkSettings
has 131 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function checkSettings(
ApiBase $module, array $params, string $name, array $options
): array {
$options['module'] = $module;
$settings = $params[$name];
File ApiParamValidator.php
has 313 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
<?php
namespace MediaWiki\Api\Validator;
use ApiBase;
Function mapDeprecatedSettingsMessages
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
private function mapDeprecatedSettingsMessages( array $settings ): array {
if ( isset( $settings[EnumDef::PARAM_DEPRECATED_VALUES] ) ) {
foreach ( $settings[EnumDef::PARAM_DEPRECATED_VALUES] as &$v ) {
if ( $v === null || $v === true || $v instanceof MessageValue ) {
continue;
- 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 validateValue
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
ApiBase $module, string $name, $value, $settings, array $options = []