Showing 57 of 591 total issues
Function fetchTranslations
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
protected function fetchTranslations(): array
{
$handle = \fopen($this->getTranslationsFileName(), 'rb');
$rows = [];
while (($row = \fgetcsv($handle)) !== false && $row !== 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 checkTranslationsFormat
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function checkTranslationsFormat(array $translations)
{
/**
* @var string $languageCode
* @var array|string[] $languageTranslations
Method I_can_extended_it_by_custom_translatable_code
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function I_can_extended_it_by_custom_translatable_code()
{
/** @var TranslatableExtendableCode $sutClass */
$sutClass = self::getSutClass();
$translations = $this->sutReflection->getProperty('translations');
Method fetchTranslations
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function fetchTranslations(): array
{
return [
'cs' => [
'one' => [
Function getPossibleValues
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public static function getPossibleValues(): array
{
if ((static::$possibleValues[static::class] ?? null) === null) {
static::$possibleValues[static::class] = [];
try {
- 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 I_can_get_its_english_translation
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function I_can_get_its_english_translation()
{
foreach ($this->getTranslatableCodeClasses() as $codeClass) {
$testClass = $this->getTestClass($codeClass);
self::assertTrue(
- 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 Has_unique_codes_across_all_weaponlikes
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function Has_unique_codes_across_all_weaponlikes()
{
$sutClass = self::getSutClass();
$reflection = new \ReflectionClass($sutClass);
$sameCodes = [];
- 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 guardSameCategory
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private static function guardSameCategory(string $meleeWeaponValue, WeaponCategoryCode $weaponCategoryCode)
{
if (!in_array($meleeWeaponValue, self::$customMeleeWeaponCodePerCategory[$weaponCategoryCode->getValue()] ?? [], true)) {
$alreadyUsedCategory = null;
foreach (WeaponCategoryCode::getPossibleValues() as $anotherCategory) {
- 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 I_get_whispered_current_code_as_return_value_of_factory_method
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function I_get_whispered_current_code_as_return_value_of_factory_method()
{
foreach ($this->getCodeClasses() as $codeClass) {
$reflectionClass = new \ReflectionClass($codeClass);
$classBaseName = preg_replace('~^.*[\\\](\w+)$~', '$1', $codeClass);
- 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 guardSameCategory
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private static function guardSameCategory(string $meleeWeaponValue, WeaponCategoryCode $weaponCategoryCode)
{
if (!\in_array($meleeWeaponValue, self::$customRangedWeaponCodePerCategory[$weaponCategoryCode->getValue()] ?? [], true)) {
$alreadyUsedCategory = null;
foreach (WeaponCategoryCode::getPossibleValues() as $anotherCategory) {
- 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
Avoid too many return
statements within this method. Open
return $translations[$code][$plural];
Avoid too many return
statements within this method. Open
return str_replace('_', ' ', $code); // just replacing underscores by spaces
Avoid too many return
statements within this method. Open
return $translations[$plural][$code];
Avoid too many return
statements within this method. Open
return $translations[$plural][$code];
Avoid too many return
statements within this method. Open
return str_replace('_', ' ', $code); // just replacing underscores by spaces
Avoid too many return
statements within this method. Open
return $translations[$code][$plural]; // explicit english translation
Function I_can_easily_find_out_if_sub_race_belongs_to_race
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function I_can_easily_find_out_if_sub_race_belongs_to_race()
{
foreach ($this->getExpectedRacesToSubRaces() as $race => $subRaces) {
$raceCode = RaceCode::getIt($race);
foreach ($subRaces as $subRace) {
- 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"