StateMachineImpl
has 75 functions (exceeds 20 allowed). Consider refactoring. Open
class StateMachineImpl implements StateMachine
{
use AssertTrait;
use EventHandlerTrait;
File StateMachineImpl.php
has 595 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace Pluf\Workflow\Imp;
use Pluf\Workflow\ActionExecutionService;
use Pluf\Workflow\ErrorCodes;
Method processEvent
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function processEvent($event, $context, StateMachineData $originalData, ExecutionServiceImpl $executionService, bool $DataIsolateEnabled): bool
{
$localData = $originalData;
$fromState = $localData->read()->getCurrentRawState();
$fromStateId = $fromState->getStateId();
Method internalTest
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function internalTest($event, $context)
{
$this->checkState($this->status != 'ERROR' && $this->status != 'TERMINATED', "Cannot test state machine under " . $this->status . " status.");
$testResult = null;
Function internalTest
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private function internalTest($event, $context)
{
$this->checkState($this->status != 'ERROR' && $this->status != 'TERMINATED', "Cannot test state machine under " . $this->status . " status.");
$testResult = null;
- 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 processEvents
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private function processEvents(): void
{
if ($this->isIdle()) {
$this->setStatus('BUSY');
try {
- 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 fireEvent
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function fireEvent($event, $context = null, bool $insertAtFirst = false): self
{
$isEntryPoint = $this->isEntryPoint();
if ($isEntryPoint) {
StateMachineContext::set($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"
Further reading
Function internalFire
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private function internalFire($event, $context, bool $insertAtFirst = false): void
{
if ($this->getStatus() == 'INITIALIZED') {
if ($this->autoStartEnabled) {
$this->start($context);
- 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 processEvent
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
private function processEvent($event, $context, StateMachineData $originalData, ExecutionServiceImpl $executionService, bool $DataIsolateEnabled): bool
Function processEvent
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function processEvent($event, $context, StateMachineData $originalData, ExecutionServiceImpl $executionService, bool $DataIsolateEnabled): bool
{
$localData = $originalData;
$fromState = $localData->read()->getCurrentRawState();
$fromStateId = $fromState->getStateId();
- 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"