marcelog/PAGI

View on GitHub

Showing 227 of 227 total issues

File Node.php has 572 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * A node, used to get input from the user, validate it, play prompt messages,
 * etc.
 *
Severity: Major
Found in src/PAGI/Node/Node.php - About 1 day to fix

    Node has 66 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Node
    {
        /**
         * Any of the available DTMF digits in a classic telephone.
         * @var string
    Severity: Major
    Found in src/PAGI/Node/Node.php - About 1 day to fix

      MockedClientImpl has 64 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class MockedClientImpl extends AbstractClient
      {
          /**
           * Mocked result strings.
           * @var string[]
      Severity: Major
      Found in src/PAGI/Client/Impl/MockedClientImpl.php - About 1 day to fix

        AbstractClient has 62 functions (exceeds 20 allowed). Consider refactoring.
        Open

        abstract class AbstractClient implements IClient
        {
            /**
             * PSR-3 logger.
             * @var LoggerInterface
        Severity: Major
        Found in src/PAGI/Client/AbstractClient.php - About 1 day to fix

          File AbstractClient.php has 515 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          <?php
          /**
           * An abstract AGI client.
           *
           * PHP Version 5
          Severity: Major
          Found in src/PAGI/Client/AbstractClient.php - About 1 day to fix

            File MockedClientImpl.php has 470 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            <?php
            /**
             * An AGI client implementation useful for mocking and testing ivr apps.
             *
             * PHP Version 5
            Severity: Minor
            Found in src/PAGI/Client/Impl/MockedClientImpl.php - About 7 hrs to fix

              Method run has 141 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function run()
                  {
                      $this->log('Run');
                      $client = $this->getAgi();
                      $loggerFacade = $client->getAsteriskLogger();
              Severity: Major
              Found in doc/examples/quickstart/MyPAGIApplication.php - About 5 hrs to fix

                ChannelVariablesFacade has 38 functions (exceeds 20 allowed). Consider refactoring.
                Open

                class ChannelVariablesFacade implements IChannelVariables
                {
                    /**
                     * Channel variables given by asterisk.
                     * @var string[]
                Severity: Minor
                Found in src/PAGI/ChannelVariables/Impl/ChannelVariablesFacade.php - About 5 hrs to fix

                  Function run has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function run()
                      {
                          $this->inputAttemptsUsed = 0;
                          if ($this->executeBeforeRun !== null) {
                              $callback = $this->executeBeforeRun;
                  Severity: Minor
                  Found in src/PAGI/Node/Node.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

                  CallFile has 32 functions (exceeds 20 allowed). Consider refactoring.
                  Open

                  class CallFile
                  {
                      /**
                       * Parameters.
                       * @var string[]
                  Severity: Minor
                  Found in src/PAGI/CallSpool/CallFile.php - About 4 hrs to fix

                    File example.php has 333 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    <?php
                    /**
                     * An example using nodes and node controller. This is a part of a calling card
                     * prepaid system. The nodes will let you enter a pin number, make a transfer
                     * between cards, dial a number, and listen to the help.
                    Severity: Minor
                    Found in doc/examples/nodecontroller/example.php - About 4 hrs to fix

                      Function run has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function run()
                          {
                              $this->log('Run');
                              $client = $this->getAgi();
                              $loggerFacade = $client->getAsteriskLogger();
                      Severity: Minor
                      Found in doc/examples/quickstart/MyPAGIApplication.php - About 3 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 doInput has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
                      Open

                          protected function doInput()
                          {
                              /* @var $result IReadResult */
                              $this->resetInput();
                              $this->inputAttemptsUsed++;
                      Severity: Minor
                      Found in src/PAGI/Node/Node.php - About 3 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

                      The class AbstractClient has 39 public methods. Consider refactoring AbstractClient to keep number of public methods under 10.
                      Open

                      abstract class AbstractClient implements IClient
                      {
                          /**
                           * PSR-3 logger.
                           * @var LoggerInterface
                      Severity: Minor
                      Found in src/PAGI/Client/AbstractClient.php by phpmd

                      TooManyPublicMethods

                      Since: 0.1

                      A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

                      By default it ignores methods starting with 'get' or 'set'.

                      Example

                      Source https://phpmd.org/rules/codesize.html#toomanypublicmethods

                      The class AbstractClient has an overall complexity of 93 which is very high. The configured complexity threshold is 50.
                      Open

                      abstract class AbstractClient implements IClient
                      {
                          /**
                           * PSR-3 logger.
                           * @var LoggerInterface
                      Severity: Minor
                      Found in src/PAGI/Client/AbstractClient.php by phpmd

                      The class AbstractClient has 44 non-getter- and setter-methods. Consider refactoring AbstractClient to keep number of methods under 25.
                      Open

                      abstract class AbstractClient implements IClient
                      {
                          /**
                           * PSR-3 logger.
                           * @var LoggerInterface
                      Severity: Minor
                      Found in src/PAGI/Client/AbstractClient.php by phpmd

                      TooManyMethods

                      Since: 0.1

                      A class with too many methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

                      By default it ignores methods starting with 'get' or 'set'.

                      The default was changed from 10 to 25 in PHPMD 2.3.

                      Example

                      Source https://phpmd.org/rules/codesize.html#toomanymethods

                      The class Node has 37 public methods. Consider refactoring Node to keep number of public methods under 10.
                      Open

                      class Node
                      {
                          /**
                           * Any of the available DTMF digits in a classic telephone.
                           * @var string
                      Severity: Minor
                      Found in src/PAGI/Node/Node.php by phpmd

                      TooManyPublicMethods

                      Since: 0.1

                      A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

                      By default it ignores methods starting with 'get' or 'set'.

                      Example

                      Source https://phpmd.org/rules/codesize.html#toomanypublicmethods

                      The class MockedNode has 11 public methods. Consider refactoring MockedNode to keep number of public methods under 10.
                      Open

                      class MockedNode extends Node
                      {
                          /**
                           * The complete input digit chain for this node.
                           * @var string
                      Severity: Minor
                      Found in src/PAGI/Node/MockedNode.php by phpmd

                      TooManyPublicMethods

                      Since: 0.1

                      A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

                      By default it ignores methods starting with 'get' or 'set'.

                      Example

                      Source https://phpmd.org/rules/codesize.html#toomanypublicmethods

                      The class MockedClientImpl has an overall complexity of 94 which is very high. The configured complexity threshold is 50.
                      Open

                      class MockedClientImpl extends AbstractClient
                      {
                          /**
                           * Mocked result strings.
                           * @var string[]

                      The class MockedClientImpl has 52 non-getter- and setter-methods. Consider refactoring MockedClientImpl to keep number of methods under 25.
                      Open

                      class MockedClientImpl extends AbstractClient
                      {
                          /**
                           * Mocked result strings.
                           * @var string[]

                      TooManyMethods

                      Since: 0.1

                      A class with too many methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

                      By default it ignores methods starting with 'get' or 'set'.

                      The default was changed from 10 to 25 in PHPMD 2.3.

                      Example

                      Source https://phpmd.org/rules/codesize.html#toomanymethods

                      Severity
                      Category
                      Status
                      Source
                      Language