Showing 57 of 591 total issues
File SpellCode.php
has 1016 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php declare(strict_types=1);
namespace DrdPlus\Codes\Wizard;
use DrdPlus\Codes\Partials\TranslatableCode;
Method fetchTranslations
has 486 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function fetchTranslations(): array
{
return [
'en' => [
// TIME-SPACE
Function I_can_ask_code_if_is_specific_weapon_type
has a Cognitive Complexity of 60 (exceeds 5 allowed). Consider refactoring. Open
public function I_can_ask_code_if_is_specific_weapon_type()
{
$questions = [
'isAxe', 'isKnifeOrDagger', 'isMaceOrClub', 'isMorningstarOrMorgenstern', 'isSaberOrBowieKnife',
'isStaffOrSpear', 'isSword', 'isVoulgeOrTrident', 'isUnarmed',
- 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
File MeleeWeaponCodeTest.php
has 442 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php declare(strict_types=1);
namespace DrdPlus\Tests\Codes\Armaments;
use DrdPlus\Codes\Armaments\Exceptions\CanNotBeConvertedToRangeWeaponCode;
File MeleeWeaponCode.php
has 438 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php declare(strict_types=1);
namespace DrdPlus\Codes\Armaments;
/**
Method fetchTranslations
has 120 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function fetchTranslations(): array
{
return [
'en' => [
self::LIGHT_AXE => [self::$ONE => 'light axe', self::$FEW => 'light axes', self::$MANY => 'light axes'],
Method I_can_ask_code_if_is_specific_weapon_type
has 107 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function I_can_ask_code_if_is_specific_weapon_type()
{
$questions = [
'isAxe', 'isKnifeOrDagger', 'isMaceOrClub', 'isMorningstarOrMorgenstern', 'isSaberOrBowieKnife',
'isStaffOrSpear', 'isSword', 'isVoulgeOrTrident', 'isUnarmed',
MeleeWeaponCode
has 29 functions (exceeds 20 allowed). Consider refactoring. Open
class MeleeWeaponCode extends WeaponCode implements MeleeWeaponlikeCode
{
private static $customMeleeWeaponCodePerCategory = [];
Function I_can_ask_code_if_is_specific_weapon_type
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
public function I_can_ask_code_if_is_specific_weapon_type()
{
$questions = [
'isBow', 'isCrossbow', 'isThrowingWeapon',
];
- 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
MeleeWeaponCodeTest
has 26 functions (exceeds 20 allowed). Consider refactoring. Open
class MeleeWeaponCodeTest extends WeaponCodeTest
{
use MeleeWeaponlikeCodeTrait;
/**
Method fetchTranslations
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function fetchTranslations(): array
{
return [
'en' => [
self::STRENGTH => [self::$ONE => 'strength', self::$FEW => 'strengths', self::$MANY => 'strengths'],
Method I_can_get_all_codes_at_once_or_by_same_named_constant
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function I_can_get_all_codes_at_once_or_by_same_named_constant()
{
self::assertSame(
$expectedValues = [
// unarmed
Method fetchTranslations
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function fetchTranslations(): array
{
return [
'en' => [
self::ARMOR_WEARING => [self::$ONE => 'armor wearing'],
Function scanForCodeClasses
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
protected function scanForCodeClasses(string $rootDir, string $rootNamespace): array
{
$codeClasses = [];
foreach (\scandir($rootDir, SCANDIR_SORT_NONE) as $folder) {
$folderFullPath = $rootDir . DIRECTORY_SEPARATOR . $folder;
- 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_czech_translation
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public function I_can_get_its_czech_translation()
{
foreach ($this->getTranslatableCodeClasses() as $codeClass) {
$hasSinglesOnly = $this->hasSinglesOnly($codeClass);
$hasMultiplesOnly = $this->hasMultiplesOnly($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
Method fetchTranslations
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function fetchTranslations(): array
{
return [
'en' => [
self::BIG_HANDWORK => [self::$ONE => 'big handwork'],
Method I_can_get_its_czech_translation
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function I_can_get_its_czech_translation()
{
foreach ($this->getTranslatableCodeClasses() as $codeClass) {
$hasSinglesOnly = $this->hasSinglesOnly($codeClass);
$hasMultiplesOnly = $this->hasMultiplesOnly($codeClass);
Function translateTo
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public function translateTo(string $languageCode, $amount = 1): string
{
$code = $this->getValue();
$translations = $this->getTranslations($languageCode);
/** @noinspection ExceptionsAnnotatingAndHandlingInspection */
- 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 fetchTranslations
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function fetchTranslations(): array
{
return [
'en' => [
self::SHORT_BOW => [self::$ONE => 'short bow', self::$FEW => 'short bows', self::$MANY => 'short bows'],
Function checkTranslationsFormat
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
private static function checkTranslationsFormat(array $translations)
{
/**
* @var string $languageCode
* @var array|string[] $languageTranslations
- 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"