MessageSourceChange
has 34 functions (exceeds 20 allowed). Consider refactoring. Open
class MessageSourceChange {
/**
* @var array[][][]
* @phpcs:ignore Generic.Files.LineLength
* @phan-var array<string,array<string,array<string|int,array{key:string,content:string,similarity?:float,matched_to?:string,previous_state?:string}>>>
File MessageSourceChange.php
has 282 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Contains a class to track changes to the messages when importing messages from remote source.
* @author Abijeet Patro
* @license GPL-2.0-or-later
Function findMessage
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public function findMessage( $language, $key, $possibleStates = [], &$modificationType = null ) {
$allChanges = [];
$allChanges[self::ADDITION] = $this->getAdditions( $language );
$allChanges[self::DELETION] = $this->getDeletions( $language );
$allChanges[self::CHANGE] = $this->getChanges( $language );
- 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 breakRename
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function breakRename( $languageCode, $msgKey ) {
$msg = $this->findMessage( $languageCode, $msgKey, [ self::RENAME ] );
if ( $msg === null ) {
return null;
}
Method hasOnly
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function hasOnly( $language, $type ) {
$deletions = $this->getDeletions( $language );
$additions = $this->getAdditions( $language );
$renames = $this->getRenames( $language );
$changes = $this->getChanges( $language );
Method findMessage
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function findMessage( $language, $key, $possibleStates = [], &$modificationType = null ) {
$allChanges = [];
$allChanges[self::ADDITION] = $this->getAdditions( $language );
$allChanges[self::DELETION] = $this->getDeletions( $language );
$allChanges[self::CHANGE] = $this->getChanges( $language );
Function hasOnly
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function hasOnly( $language, $type ) {
$deletions = $this->getDeletions( $language );
$additions = $this->getAdditions( $language );
$renames = $this->getRenames( $language );
$changes = $this->getChanges( $language );
- 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 breakRename
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function breakRename( $languageCode, $msgKey ) {
$msg = $this->findMessage( $languageCode, $msgKey, [ self::RENAME ] );
if ( $msg === null ) {
return null;
}
- 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"