marcelog/PAGI

View on GitHub

Showing 48 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

                      Function callClientMethods has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
                      Open

                          protected function callClientMethods($methods, $stopWhen = null)
                          {
                              $client = $this->getClient();
                              $logger = $client->getLogger();
                              $result = null;
                      Severity: Minor
                      Found in src/PAGI/Node/MockedNode.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

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

                      class CDRFacade implements ICDR
                      {
                          /**
                           * AGI Client, needed to access cdr data.
                           * @var IClient
                      Severity: Minor
                      Found in src/PAGI/CDR/Impl/CDRFacade.php - About 2 hrs to fix

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

                            protected function processNodeResult(Node $node)
                            {
                                $ret = false;
                                $name = $node->getName();
                                if (isset($this->nodeResults[$name])) {
                        Severity: Minor
                        Found in src/PAGI/Node/NodeController.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 run has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function run()
                            {
                                $this->inputAttemptsUsed = 0;
                                if ($this->executeBeforeRun !== null) {
                                    $callback = $this->executeBeforeRun;
                        Severity: Major
                        Found in src/PAGI/Node/Node.php - About 2 hrs to fix

                          Function unserialize has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public function unserialize($text)
                              {
                                  $lines = explode("\n", $text);
                                  foreach ($lines as $line) {
                                      $data = explode(':', $line);
                          Severity: Minor
                          Found in src/PAGI/CallSpool/CallFile.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 doInput has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              protected function doInput()
                              {
                                  /* @var $result IReadResult */
                                  $this->resetInput();
                                  $this->inputAttemptsUsed++;
                          Severity: Minor
                          Found in src/PAGI/Node/Node.php - About 1 hr to fix

                            Function sayInterruptable has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                            Open

                                protected function sayInterruptable($what, array $arguments)
                                {
                                    $client = $this->getClient();
                                    $logger = $client->getLogger();
                            
                            
                            Severity: Minor
                            Found in src/PAGI/Node/MockedNode.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

                            Severity
                            Category
                            Status
                            Source
                            Language