File ValidationRunner.php
has 251 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Message validation framework.
*
* @file
Function doesKeyMatch
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
protected function doesKeyMatch( string $key, array $keyMatches ): bool {
$normalizedKey = lcfirst( $key );
foreach ( $keyMatches as $match ) {
if ( is_string( $match ) ) {
if ( lcfirst( $match ) === $normalizedKey ) {
- 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 reloadIgnorePatterns
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public static function reloadIgnorePatterns(): void {
$validationExclusionFile = Services::getInstance()->getConfigHelper()->getValidationExclusionFile();
if ( $validationExclusionFile === false ) {
self::$ignorePatterns = [];
- 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 addValidator
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function addValidator( array $validatorConfig ): void {
$validatorId = $validatorConfig['id'] ?? null;
$className = $validatorConfig['class'] ?? null;
if ( $validatorId !== null ) {
Method reloadIgnorePatterns
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function reloadIgnorePatterns(): void {
$validationExclusionFile = Services::getInstance()->getConfigHelper()->getValidationExclusionFile();
if ( $validationExclusionFile === false ) {
self::$ignorePatterns = [];
Method runValidation
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
array $validatorData,
Message $message,
string $targetLanguage,
ValidationIssues $errors,
ValidationIssues $warnings,
Method shouldIgnore
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
string $messageKey,
ValidationIssue $issue,
string $messageGroupId,
string $targetLanguage,
array $pattern
Function filterValidations
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function filterValidations(
string $messageKey,
ValidationIssues $issues,
string $targetLanguage
): ValidationIssues {
- 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 runValidation
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function runValidation(
array $validatorData,
Message $message,
string $targetLanguage,
ValidationIssues $errors,
- 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"