File StateImpl.php
has 485 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace Pluf\Workflow\Imp;
use Pluf\Workflow\HistoryType;
use Pluf\Workflow\ImmutableState;
Function internalFire
has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring. Open
public function internalFire($stateContext): void
{
$currentTransitionResult = $stateContext->getResult();
if ($this->isParallelState()) {
/*
- 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
StateImpl
has 50 functions (exceeds 20 allowed). Consider refactoring. Open
class StateImpl implements MutableState
{
// private static final Logger logger = LoggerFactory.getLogger(StateImpl.class);
protected $stateId;
Function exit
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
public function exit(StateContext $stateContext): void
{
if ($this->isParallelState()) {
$subStates = $this->getSubStatesOn($this, $stateContext->getStateMachineData()
->read());
- 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 internalFire
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function internalFire($stateContext): void
{
$currentTransitionResult = $stateContext->getResult();
if ($this->isParallelState()) {
/*
Function checkConflictTransitions
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public function checkConflictTransitions(ImmutableTransition $target, array $allTransitions): ?ImmutableTransition
{
foreach ($allTransitions as $t) {
if ($target == $t || $t->getCondition()::class == Never::class/* Conditions::Never::class */) {
continue;
- 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 exit
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function exit(StateContext $stateContext): void
{
if ($this->isParallelState()) {
$subStates = $this->getSubStatesOn($this, $stateContext->getStateMachineData()
->read());
Function verify
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function verify(): void
{
if ($this->isFinalState()) {
if ($this->isParallelState()) {
throw new IllegalStateException("Final state cannot be parallel state.");
- 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 enterByHistory
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function enterByHistory($stateContext): ImmutableState
{
if ($this->finalState || $this->isParallelState()) // no historical info
return this;
- 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"