Showing 9 of 88 total issues
File StaminaTest.php
has 437 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
<?php declare(strict_types=1);
namespace DrdPlus\Tests\Stamina;
use DrdPlus\Properties\Derived\Endurance;
StaminaTest
has 30 functions (exceeds 20 allowed). Consider refactoring. Open
Open
class StaminaTest extends TestWithMockery
{
/**
* @test
*/
Stamina
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
Open
class Stamina extends StrictObject
{
/**
* @var Fatigue
*/
Function calculateFilledHalfRowsFor
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
Open
public function calculateFilledHalfRowsFor($fatigueValue, FatigueBoundary $fatigueBoundary): int
{
$fatiguePerRowMaximum = $this->getFatiguePerRowMaximum($fatigueBoundary);
if ($fatiguePerRowMaximum % 2 === 0) { // odd
$filledHalfRows = SumAndRound::floor($fatigueValue / ($fatiguePerRowMaximum / 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"
Further reading
Method createActivity
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function createActivity(string $usedProperty)
{
$activity = $this->mockery(PropertyBasedActivity::class);
$activity->shouldReceive('usesStrength')
->zeroOrMoreTimes()
Method I_can_rest
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function I_can_rest(): void
{
$fatigueBoundary = $this->createFatigueBoundary(7);
$stamina = $this->createStaminaToTest($fatigueBoundary);
self::assertSame(21, $stamina->getRemainingStaminaAmount($fatigueBoundary));
Avoid too many return
statements within this method. Open
Open
return $activity;
Avoid too many return
statements within this method. Open
Open
return PropertyCode::CHARISMA === $usedProperty;
Avoid too many return
statements within this method. Open
Open
return PropertyCode::INTELLIGENCE === $usedProperty;