Showing 56 of 58 total issues
Method __construct
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
public function __construct(?string $parent = null, ?string $name = null, ?string $alias = null, ?string $entryCallMethod = null, ?string $exitCallMethod = null, bool $initialState = false, bool $finalState = false, string $historyType = HistoryType::NONE, string $compositeType = StateCompositeType::SEQUENTIAL)
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 installDeferBoundAction
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private function installDeferBoundAction(DeferBoundActionInfo $deferBoundActionInfo)
{
foreach ($this->states as $mutableState) {
if (! $deferBoundActionInfo->isFromStateMatch($mutableState->getStateId())) {
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
Function walkThroughStateMachineClassForState
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private function walkThroughStateMachineClassForState(): void
{
$stack = [];
array_push($stack, new ReflectionClass($this->stateMachineImplClazz));
while (! empty($stack)) {
- 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 walkThroughStateMachineClassForTransition
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private function walkThroughStateMachineClassForTransition(): void
{
$stack = [];
array_push($stack, new ReflectionClass($this->stateMachineImplClazz));
while (! empty($stack)) {
- 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 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 dump
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function dump(StateMachineDataReader $src): void
{
$this->clear();
$this->write()->typeOfStateMachine($src->typeOfStateMachine());
- 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 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 addStateEntryExitMethodCallAction
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private function addStateEntryExitMethodCallAction(string $methodName, $parameterTypes, MutableState $mutableState, bool $isEntryAction): void
{
if ($this->hasMethod($this->stateMachineImplClazz, $methodName)) {
$weight = Action::EXTENSION_WEIGHT;
if (str_starts_with($methodName, "before")) {
- 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 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.
Method __construct
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
public function __construct($message = null, $code = null, $previous = null, $from = null, $to = null, $event = null, $context = null, $actionName = null)
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 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 __construct
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
public function __construct(StateMachine $stateMachine, StateMachineData $stateMachineData, ?ImmutableState $sourceState, $event,
$context = null,
?TransitionResult $transitionResult= null,
?ActionExecutionService $actionExecutionService = null)
Method newStateContext
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
public static function newStateContext(StateMachine $stateMachine, StateMachineData $data, ?ImmutableState $sourceState, $event, $context, ?TransitionResult $result, ActionExecutionService $executor): StateContext
Method __construct
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
public function __construct($action, $from, $to, $event, $context, $stateMachine, int $position)
Method get
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
public static function get($action, $from, $to, $event, $context, $stateMachine, int $position): ActionContext
Method __construct
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
public function __construct(bool $autoStartEnabled = true, bool $autoTerminateEnabled = true, bool $dataIsolateEnabled = false, bool $debugModeEnabled = false, bool $delegatorModeEnabled = false, ?IdProvider $idProvider = null)
Method create
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
public static function create(?string $stateMachineClazz = null,
?string $stateClass = 'string',
?string $eventClass = 'string',
?string $contextClazz = null,
array $extraConstParamTypes = [],