Function doTransitInternal
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
private function doTransitInternal(ImmutableState $source, ImmutableState $target, StateContext $stateContext): void
{
if ($source == $this->getTargetState()) {
// Handles 1.
// Handles 3. after traversing from the source to the target.
- 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
TransitionImpl
has 25 functions (exceeds 20 allowed). Consider refactoring. Open
class TransitionImpl implements MutableTransition
{
public ImmutableState $sourceState;
Method doTransitInternal
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function doTransitInternal(ImmutableState $source, ImmutableState $target, StateContext $stateContext): void
{
if ($source == $this->getTargetState()) {
// Handles 1.
// Handles 3. after traversing from the source to the target.
Function isMatch
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function isMatch($fromState, $toState, $event, int $priority, ?string $condClazz = null, ?string $type = null): bool
{
$flag = true;
if ($toState == null && ! $this->getTargetState()->isFinalState())
$flag = false;
- 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 isMatch
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
public function isMatch($fromState, $toState, $event, int $priority, ?string $condClazz = null, ?string $type = null): bool
Avoid too many return
statements within this method. Open
return true;
Function internalFire
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function internalFire(StateContext $stateContext): void
{
// Fix issue17
if ($this->type == TransitionType::INTERNAL && $stateContext->getSourceState()->getStateId() != $this->targetState->getStateId()) {
return;
- 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"