Dopamedia/StateMachine

View on GitHub

Showing 21 of 69 total issues

Method install has 151 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function install(SchemaSetupInterface $setup, ModuleContextInterface $context)
    {
        $installer = $setup;
        $installer->startSetup();

Severity: Major
Found in Setup/InstallSchema.php - About 6 hrs to fix

    State has 25 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class State implements ProcessStateInterface
    {
        /**
         * @var string
         */
    Severity: Minor
    Found in Model/Process/State.php - About 2 hrs to fix

      File Drawer.php has 272 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      /**
       * Created by PhpStorm.
       * User: pandi
       * Date: 25.07.16
      Severity: Minor
      Found in Model/Graph/Drawer.php - About 2 hrs to fix

        Process has 22 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class Process implements ProcessProcessInterface
        {
            /**
             * @var string
             */
        Severity: Minor
        Found in Model/Process/Process.php - About 2 hrs to fix

          Function gatherEvents has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
          Open

              protected function gatherEvents(\DOMElement $parentNode)
              {
                  $events = [];
                  foreach ($this->getChildrenByName($parentNode, 'events') as $eventsNode) {
                      foreach ($this->getAllChildElements($eventsNode) as $eventNode) {
          Severity: Minor
          Found in Model/Configuration/Converter.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 addEdgeEventText has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

              protected function addEdgeEventText(ProcessTransitionInterface $transition, array $label)
              {
                  if ($transition->hasEvent()) {
                      $event = $transition->getEvent();
          
          
          Severity: Minor
          Found in Model/Graph/Drawer.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 addEdgeAttributes has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              protected function addEdgeAttributes(ProcessTransitionInterface $transition, array $attributes, $label, $type = self::EDGE_FULL)
              {
                  $attributes = array_merge($this->attributesTransition, $attributes);
                  $attributes['label'] = '  ' . $label;
          
          
          Severity: Minor
          Found in Model/Graph/Drawer.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 drawTransitionsEvents has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              public function drawTransitionsEvents(ProcessStateInterface $state)
              {
                  $events = $state->getEvents();
                  foreach ($events as $event) {
                      $transitions = $state->getOutgoingTransitionsByEvent($event);
          Severity: Minor
          Found in Model/Graph/Drawer.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 gatherTransitions has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              protected function gatherTransitions(\DOMElement $parentNode)
              {
                  $transitions = [];
                  foreach ($this->getChildrenByName($parentNode, 'transitions') as $transitionsNode) {
                      foreach ($this->getAllChildElements($transitionsNode) as $transitionNode) {
          Severity: Minor
          Found in Model/Configuration/Converter.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 addEdge has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              protected function addEdge(ProcessTransitionInterface $transition, $type = self::EDGE_FULL, $attributes = [], $fromName = null, $toName = null)
          Severity: Minor
          Found in Model/Graph/Drawer.php - About 35 mins to fix

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

                public function __construct(GraphAdapterInterface $adapter, $name, array $attributes = [], $directed = true, $strict = true)
            Severity: Minor
            Found in Model/Graph/Graph.php - About 35 mins to fix

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

                      \Dopamedia\StateMachine\Api\ProcessEventInterface $event,
                      \Dopamedia\StateMachine\Api\ProcessProcessInterface $process,
                      \Dopamedia\StateMachine\Api\ProcessStateInterface $state,
                      \Dopamedia\StateMachine\Api\ProcessTransitionInterface $transition,
                      \Dopamedia\StateMachine\Model\ConfigurationInterface $configuration
              Severity: Minor
              Found in Model/StateMachine/Builder.php - About 35 mins to fix

                Function createEvents has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    protected function createEvents($processName)
                    {
                        $eventMap = [];
                
                        if ($eventsConfiguration = $this->configuration->getEvents($processName)) {
                Severity: Minor
                Found in Model/StateMachine/Builder.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 getOutgoingTransitionsByEvent has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function getOutgoingTransitionsByEvent(ProcessEventInterface $event)
                    {
                        $transitions = [];
                        foreach ($this->outgoingTransitions as $transition) {
                            if ($transition->hasEvent()) {
                Severity: Minor
                Found in Model/Process/State.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 getTimeoutEvents has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function getTimeoutEvents()
                    {
                        $events = [];
                        $transitions = $this->getOutgoingTransitions();
                        foreach ($transitions as $transition) {
                Severity: Minor
                Found in Model/Process/State.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 hasOnEnterEvent has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function hasOnEnterEvent()
                    {
                        $transitions = $this->getOutgoingTransitions();
                        foreach ($transitions as $transition) {
                            if ($transition->hasEvent()) {
                Severity: Minor
                Found in Model/Process/State.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 getEvent has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function getEvent($eventName)
                    {
                        foreach ($this->outgoingTransitions as $transition) {
                            if ($transition->hasEvent()) {
                                $event = $transition->getEvent();
                Severity: Minor
                Found in Model/Process/State.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 hasEvent has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function hasEvent($id)
                    {
                        foreach ($this->outgoingTransitions as $transition) {
                            if ($transition->hasEvent()) {
                                $event = $transition->getEvent();
                Severity: Minor
                Found in Model/Process/State.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 getOnEnterEvent has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function getOnEnterEvent()
                    {
                        $transitions = $this->getOutgoingTransitions();
                        foreach ($transitions as $transition) {
                            if ($transition->hasEvent()) {
                Severity: Minor
                Found in Model/Process/State.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 getManualEvents has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function getManualEvents()
                    {
                        $manuallyExecutableEventList = [];
                        $transitions = $this->getAllTransitions();
                        foreach ($transitions as $transition) {
                Severity: Minor
                Found in Model/Process/Process.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