Function parseFile
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
public function parseFile( string $csvFilePath ): Status {
if ( !file_exists( $csvFilePath ) || !is_file( $csvFilePath ) ) {
return Status::newFatal(
"CSV file path '$csvFilePath' does not exist, is not readable or is not a file"
);
- 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 parseFile
has 74 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function parseFile( string $csvFilePath ): Status {
if ( !file_exists( $csvFilePath ) || !is_file( $csvFilePath ) ) {
return Status::newFatal(
"CSV file path '$csvFilePath' does not exist, is not readable or is not a file"
);
Function importData
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public function importData(
array $messagesWithTranslations,
Authority $authority,
string $comment,
?callable $progressReporter = 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"
Further reading
Method importData
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function importData(
array $messagesWithTranslations,
Authority $authority,
string $comment,
?callable $progressReporter = null
Method getLanguagesFromHeader
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function getLanguagesFromHeader( array $csvHeader ): Status {
if ( count( $csvHeader ) < 2 ) {
return Status::newFatal(
'CSV has < 2 columns. Assuming that there are no languages to import'
);
Function getLanguagesFromHeader
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function getLanguagesFromHeader( array $csvHeader ): Status {
if ( count( $csvHeader ) < 2 ) {
return Status::newFatal(
'CSV has < 2 columns. Assuming that there are no languages to import'
);
- 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"