pluf/workflow

View on GitHub

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)
Severity: Major
Found in src/Attributes/State.php - About 1 hr to fix

    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;
    Severity: Minor
    Found in src/Imp/StateMachineImpl.php - About 1 hr to fix

      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;
      Severity: Minor
      Found in src/Imp/StateMachineBuilderImpl.php - About 1 hr to fix

      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)) {
      Severity: Minor
      Found in src/Imp/StateMachineBuilderImpl.php - About 1 hr to fix

      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)) {
      Severity: Minor
      Found in src/Imp/StateMachineBuilderImpl.php - About 1 hr to fix

      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;
      Severity: Minor
      Found in src/Imp/StateMachineImpl.php - About 1 hr to fix

      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());
      Severity: Minor
      Found in src/Imp/StateMachineDataImpl.php - About 1 hr to fix

      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.");
      Severity: Minor
      Found in src/Imp/StateImpl.php - About 1 hr to fix

      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")) {
      Severity: Minor
      Found in src/Imp/StateMachineBuilderImpl.php - About 1 hr to fix

      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.
      Severity: Minor
      Found in src/Imp/TransitionImpl.php - About 1 hr to fix

        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)
        Severity: Major
        Found in src/Exceptions/TransitionException.php - About 1 hr to fix

          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 {
          Severity: Minor
          Found in src/Imp/StateMachineImpl.php - About 55 mins to fix

          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);
          Severity: Minor
          Found in src/Imp/StateMachineImpl.php - About 55 mins to fix

          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;
          Severity: Minor
          Found in src/Imp/TransitionImpl.php - About 55 mins to fix

          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)
          Severity: Major
          Found in src/Imp/StateContextImpl.php - About 50 mins to fix

            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
            Severity: Major
            Found in src/Imp/FSM.php - About 50 mins to fix

              Method __construct has 7 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  public function __construct($action, $from, $to, $event, $context, $stateMachine, int $position)
              Severity: Major
              Found in src/Imp/ActionContext.php - About 50 mins to fix

                Method get has 7 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    public static function get($action, $from, $to, $event, $context, $stateMachine, int $position): ActionContext
                Severity: Major
                Found in src/Imp/ActionContext.php - About 50 mins to fix

                  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)
                  Severity: Minor
                  Found in src/StateMachineConfiguration.php - About 45 mins to fix

                    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 = [], 
                    Severity: Minor
                    Found in src/StateMachineBuilderFactory.php - About 45 mins to fix
                      Severity
                      Category
                      Status
                      Source
                      Language