Showing 20 of 142 total issues
Modifier
has 51 functions (exceeds 20 allowed). Consider refactoring. Open
class Modifier extends StrictObject
{
use ToFlatArrayTrait;
/** @var ModifierCode */
File Formula.php
has 410 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
namespace DrdPlus\Theurgist\Spells;
File Modifier.php
has 375 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
namespace DrdPlus\Theurgist\Spells;
Formula
has 32 functions (exceeds 20 allowed). Consider refactoring. Open
class Formula extends StrictObject
{
use ToFlatArrayTrait;
/** @var FormulaCode */
File ModifiersTable.php
has 303 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types = 1);
namespace DrdPlus\Theurgist\Spells;
ModifiersTable
has 27 functions (exceeds 20 allowed). Consider refactoring. Open
class ModifiersTable extends AbstractFileTable
{
use ToFlatArrayTrait;
/**
FormulasTable
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
class FormulasTable extends AbstractFileTable
{
protected function getDataFileName(): string
{
return __DIR__ . '/data/formulas.csv';
Function getParameterBonusFromModifiers
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
private function getParameterBonusFromModifiers(string $parameterName)
{
$bonusParts = [];
foreach ($this->modifiers as $modifier) {
if ($modifier->getModifierCode()->getValue() === ModifierCode::GATE) {
- 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 getCurrentDifficulty
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getCurrentDifficulty(): FormulaDifficulty
{
$formulaParameters = [
$this->getAttackWithAddition(),
$this->getBrightnessWithAddition(),
Method sanitizeSpellParameterChanges
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function sanitizeSpellParameterChanges(array $spellParameterValues): array
{
$sanitizedChanges = [];
foreach (ModifierMutableSpellParameterCode::getPossibleValues() as $mutableSpellParameter) {
if (!array_key_exists($mutableSpellParameter, $spellParameterValues)) {
Method sanitizeSpellParameterChanges
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function sanitizeSpellParameterChanges(array $spellParameterValues): array
{
$sanitizedChanges = [];
foreach (FormulaMutableSpellParameterCode::getPossibleValues() as $mutableSpellParameter) {
if (!\array_key_exists($mutableSpellParameter, $spellParameterValues)) {
Method getDifficultyChange
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getDifficultyChange(): DifficultyChange
{
$modifierParameters = [
$this->getAttackWithAddition(),
$this->getNumberOfConditionsWithAddition(),
Method getParameterBonusFromModifiers
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function getParameterBonusFromModifiers(string $parameterName)
{
$bonusParts = [];
foreach ($this->modifiers as $modifier) {
if ($modifier->getModifierCode()->getValue() === ModifierCode::GATE) {
Method __construct
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __construct(array $values)
{
try {
$this->minimal = ToInteger::toPositiveInteger($values[0] ?? null);
} catch (\Granam\Integer\Tools\Exceptions\Exception $exception) {
Method getExpectedDataHeaderNamesToTypes
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function getExpectedDataHeaderNamesToTypes(): array
{
return [
self::REALM => self::POSITIVE_INTEGER,
self::REALMS_AFFECTION => self::ARRAY,
Function sanitizeSpellParameterChanges
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private function sanitizeSpellParameterChanges(array $spellParameterValues): array
{
$sanitizedChanges = [];
foreach (ModifierMutableSpellParameterCode::getPossibleValues() as $mutableSpellParameter) {
if (!array_key_exists($mutableSpellParameter, $spellParameterValues)) {
- 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 sanitizeSpellParameterChanges
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private function sanitizeSpellParameterChanges(array $spellParameterValues): array
{
$sanitizedChanges = [];
foreach (FormulaMutableSpellParameterCode::getPossibleValues() as $mutableSpellParameter) {
if (!\array_key_exists($mutableSpellParameter, $spellParameterValues)) {
- 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 __construct
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
FormulaCode $formulaCode,
FormulasTable $formulasTable,
DistanceTable $distanceTable,
array $formulaSpellParameterValues = [],
array $modifiers = [],
Function toFlatArray
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
protected function toFlatArray(array $items): array
{
$flat = [];
foreach ($items as $item) {
if (\is_array($item)) {
- 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 getRealmsAffectionsSum
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function getRealmsAffectionsSum(): array
{
$baseRealmsAffection = $this->formulasTable->getRealmsAffection($this->getFormulaCode());
$realmsAffectionsSum = [
// like daily => -2
- 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"