runcmf/runtracy

View on GitHub
src/RunTracy/Helpers/Console/BaseJsonRpcServer.php

Summary

Maintainability
F
3 days
Test Coverage

Function getServiceMap has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
Open

    private function getServiceMap()
    {
        $result = [
            'transport' => 'POST',
            'envelope' => 'JSON-RPC-2.0',
Severity: Minor
Found in src/RunTracy/Helpers/Console/BaseJsonRpcServer.php - About 5 hrs 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 validateCall has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

    private function validateCall(\stdClass $call)
    {
        $result = null;
        $error = null;
        $data = null;
Severity: Minor
Found in src/RunTracy/Helpers/Console/BaseJsonRpcServer.php - About 4 hrs 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

File BaseJsonRpcServer.php has 316 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace RunTracy\Helpers\Console;

/**
Severity: Minor
Found in src/RunTracy/Helpers/Console/BaseJsonRpcServer.php - About 3 hrs to fix

    Method validateCall has 77 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function validateCall(\stdClass $call)
        {
            $result = null;
            $error = null;
            $data = null;
    Severity: Major
    Found in src/RunTracy/Helpers/Console/BaseJsonRpcServer.php - About 3 hrs to fix

      Function execute has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Open

          public function execute()
          {
              $ret = [];
              do {
                  // check for SMD Discovery request
      Severity: Minor
      Found in src/RunTracy/Helpers/Console/BaseJsonRpcServer.php - About 2 hrs 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 getServiceMap has 53 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function getServiceMap()
          {
              $result = [
                  'transport' => 'POST',
                  'envelope' => 'JSON-RPC-2.0',
      Severity: Major
      Found in src/RunTracy/Helpers/Console/BaseJsonRpcServer.php - About 2 hrs to fix

        Method execute has 41 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function execute()
            {
                $ret = [];
                do {
                    // check for SMD Discovery request
        Severity: Minor
        Found in src/RunTracy/Helpers/Console/BaseJsonRpcServer.php - About 1 hr to fix

          Function getRequest has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

              private function getRequest()
              {
                  $error = null;
          
                  do {
          Severity: Minor
          Found in src/RunTracy/Helpers/Console/BaseJsonRpcServer.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 getRequest has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private function getRequest()
              {
                  $error = null;
          
                  do {
          Severity: Minor
          Found in src/RunTracy/Helpers/Console/BaseJsonRpcServer.php - About 1 hr to fix

            Method processCall has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                private function processCall(\stdClass $call)
                {
                    $id = property_exists($call, 'id') ? $call->id : null;
                    $params = property_exists($call, 'params') ? $call->params : [];
                    $result = null;
            Severity: Minor
            Found in src/RunTracy/Helpers/Console/BaseJsonRpcServer.php - About 1 hr to fix

              Function processCall has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  private function processCall(\stdClass $call)
                  {
                      $id = property_exists($call, 'id') ? $call->id : null;
                      $params = property_exists($call, 'params') ? $call->params : [];
                      $result = null;
              Severity: Minor
              Found in src/RunTracy/Helpers/Console/BaseJsonRpcServer.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

              There are no issues that match your filters.

              Category
              Status