shrink0r/workflux

View on GitHub

Showing 10 of 32 total issues

Method getStateSchema has 58 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function getStateSchema(): array
    {
        return [
            "type" => "assoc" ,
            "required" => false,
Severity: Major
Found in src/Builder/StateMachineSchema.php - About 2 hrs to fix

    Function splat has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

        public function splat(): array
        {
            $initial_state = null;
            $all_states = new StateMap;
            $final_states = new StateMap;
    Severity: Minor
    Found in src/State/StateSet.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 __construct has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        public function __construct(StateMap $states, TransitionSet $transitions)
        {
            $this->internal_map = new Map;
            foreach ($transitions as $transition) {
                $from_state = $transition->getFrom();
    Severity: Minor
    Found in src/Transition/StateTransitions.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 __construct has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function __construct(StateMap $states, TransitionSet $transitions)
        {
            $this->internal_map = new Map;
            foreach ($transitions as $transition) {
                $from_state = $transition->getFrom();
    Severity: Minor
    Found in src/Transition/StateTransitions.php - About 1 hr to fix

      Function realizeConfig has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          private function realizeConfig(array $config): array
          {
              $states = [];
              $transitions = [];
              foreach ($config as $name => $state_config) {
      Severity: Minor
      Found in src/Builder/ArrayStateMachineBuilder.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 realizeConfig has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          private function realizeConfig(array $config): array
          {
              $states = [];
              $transitions = [];
              foreach ($config as $name => $state_config) {
      Severity: Minor
      Found in src/Builder/YamlStateMachineBuilder.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 activateTransition has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          private function activateTransition(InputInterface $input, OutputInterface $output)
          {
              $next_state = null;
              foreach ($this->state_transitions->get($output->getCurrentState()) as $transition) {
                  if ($transition->isActivatedBy($input, $output)) {
      Severity: Minor
      Found in src/StateMachine.php - About 35 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 withParam has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          public function withParam(string $param_name, $param_value, bool $treat_name_as_path = true): ParamHolderInterface
          {
              $param_holder = clone $this;
              if ($treat_name_as_path) {
                  $name_parts = array_reverse(explode('.', $param_name));
      Severity: Minor
      Found in src/Param/ParamHolderTrait.php - About 35 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 resolveStateImplementor has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          private function resolveStateImplementor(Maybe $state): string
          {
              switch (true) {
                  case $state->initial->get():
                      $state_implementor = $this->class_map->get('initial');
      Severity: Minor
      Found in src/Builder/Factory.php - About 25 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 createTransition has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          public function createTransition(string $from, string $to, array $config = null): TransitionInterface
          {
              $transition = Maybe::unit($config);
              if (is_string($transition->when->get())) {
                  $config['when'] = [ $transition->when->get() ];
      Severity: Minor
      Found in src/Builder/Factory.php - About 25 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

      Severity
      Category
      Status
      Source
      Language