marcelog/PAGI

View on GitHub

Showing 48 of 227 total issues

Method buildMainMenu has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function buildMainMenu(NodeController $nodeController)
    {
        $this->buildGenericNode('mainMenu', $nodeController)
            ->saySound('pp/3')
            ->maxAttemptsForInput(3)
Severity: Minor
Found in doc/examples/nodecontroller/example.php - About 1 hr to fix

    Method init has 38 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function init()
        {
            $this->logger->info('Init');
            $this->agi = $this->getAgi();
            $this->asteriskLogger = $this->agi->getAsteriskLogger();
    Severity: Minor
    Found in doc/examples/nodecontroller/example.php - About 1 hr to fix

      Method callClientMethods has 36 lines of code (exceeds 25 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 1 hr to fix

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

            public function validate()
            {
                foreach ($this->inputValidations as $name => $data) {
                    $validator = $data['callback'];
                    $result = $validator($this);
        Severity: Minor
        Found in src/PAGI/Node/Node.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 spool has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function spool(CallFile $call, $schedule = null)
            {
                $filename = tempnam($this->tmpDir, 'PAGICallFile');
                if ($filename === false) {
                    throw new CallSpoolException('Could generate temporary filename');
        Severity: Minor
        Found in src/PAGI/CallSpool/Impl/CallSpoolImpl.php - About 1 hr to fix

          Method getCommonCallingCardValidations has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function getCommonCallingCardValidations()
              {
                  return array(
                      'cardExists' => Node::createValidatorInfo(
                          function(Node $node) {
          Severity: Minor
          Found in doc/examples/nodecontroller/example.php - About 1 hr to fix

            Method processNodeResult has 29 lines of code (exceeds 25 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 1 hr to fix

              Method sayInterruptable has 28 lines of code (exceeds 25 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

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

                    protected function callClientMethods($methods, $stopWhen = null)
                    {
                        $result = null;
                        foreach ($methods as $callInfo) {
                            foreach ($callInfo as $name => $arguments) {
                Severity: Minor
                Found in src/PAGI/Node/Node.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 buildConfirmTransferToCard has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    protected function buildConfirmTransferToCard(
                        NodeController $nodeController, \Closure $onInit
                    ) {
                        $this->buildGenericNode('confirmTransferToCard', $nodeController)
                            ->cancelWith(Node::DTMF_STAR)
                Severity: Minor
                Found in doc/examples/nodecontroller/example.php - About 1 hr to fix

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

                      public function spool(CallFile $call, $schedule = null)
                      {
                          $filename = tempnam($this->tmpDir, 'PAGICallFile');
                          if ($filename === false) {
                              throw new CallSpoolException('Could generate temporary filename');
                  Severity: Minor
                  Found in src/PAGI/CallSpool/Impl/CallSpoolImpl.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 buildPinEntry has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                          $name, $sound, $nextNodeName,
                          NodeController $nodeController, $validators,
                          $onInit = null
                  Severity: Minor
                  Found in doc/examples/nodecontroller/example.php - About 45 mins to fix

                    Function open has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                        protected function open()
                        {
                            if (isset($this->options['stdin'])) {
                                $this->input = $this->options['stdin'];
                            } else {
                    Severity: Minor
                    Found in src/PAGI/Client/Impl/ClientImpl.php - About 45 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 run has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function run()
                        {
                            $result = parent::run();
                            foreach ($this->expectedSay as $semiHash => $times) {
                                $data = unserialize($semiHash);
                    Severity: Minor
                    Found in src/PAGI/Node/MockedNode.php - About 45 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 onDial has 6 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                            $success,
                            $peerName,
                            $peerNumber,
                            $answeredTime,
                            $dialStatus,
                    Severity: Minor
                    Found in src/PAGI/Client/Impl/MockedClientImpl.php - About 45 mins to fix

                      Consider simplifying this complex logical expression.
                      Open

                              if ($node->wasCancelled()
                                  && $this->result == self::NODE_RESULT_CANCEL
                              ) {
                                  return true;
                              } elseif ($node->isComplete()
                      Severity: Major
                      Found in src/PAGI/Node/NodeActionCommand.php - About 40 mins to fix

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

                            public function record($file, $format, $escapeDigits, $maxRecordTime = -1, $silence = false);
                        Severity: Minor
                        Found in src/PAGI/Client/IClient.php - About 35 mins to fix

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

                              public function record($file, $format, $escapeDigits, $maxRecordTime = -1, $silence = false)
                          Severity: Minor
                          Found in src/PAGI/Client/Impl/MockedClientImpl.php - About 35 mins to fix

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

                                public function record($file, $format, $escapeDigits, $maxRecordTime = -1, $silence = false)
                            Severity: Minor
                            Found in src/PAGI/Client/AbstractClient.php - About 35 mins to fix

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

                                  public function appliesTo(Node $node)
                                  {
                                      if ($node->wasCancelled()
                                          && $this->result == self::NODE_RESULT_CANCEL
                                      ) {
                              Severity: Minor
                              Found in src/PAGI/Node/NodeActionCommand.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

                              Severity
                              Category
                              Status
                              Source
                              Language