marcelog/PAGI

View on GitHub

Showing 227 of 227 total issues

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

      The class AbstractClient has a coupling between objects value of 20. Consider to reduce the number of dependencies under 13.
      Open

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

      CouplingBetweenObjects

      Since: 1.1.0

      A class with too many dependencies has negative impacts on several quality aspects of a class. This includes quality criteria like stability, maintainability and understandability

      Example

      class Foo {
          /**
           * @var \foo\bar\X
           */
          private $x = null;
      
          /**
           * @var \foo\bar\Y
           */
          private $y = null;
      
          /**
           * @var \foo\bar\Z
           */
          private $z = null;
      
          public function setFoo(\Foo $foo) {}
          public function setBar(\Bar $bar) {}
          public function setBaz(\Baz $baz) {}
      
          /**
           * @return \SplObjectStorage
           * @throws \OutOfRangeException
           * @throws \InvalidArgumentException
           * @throws \ErrorException
           */
          public function process(\Iterator $it) {}
      
          // ...
      }

      Source https://phpmd.org/rules/design.html#couplingbetweenobjects

      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

        Each class must be in a file by itself
        Open

        class MyPagiApplication extends PAGIApplication

        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

              Expected 1 space after FUNCTION keyword; 0 found
              Open

                              function(Node $node) {

              Multi-line function declarations must define one parameter per line
              Open

                      $name, $sound, $nextNodeName,

              Multi-line function declarations must define one parameter per line
              Open

                      $name, $sound, $nextNodeName,

              Expected 1 space after FUNCTION keyword; 0 found
              Open

                                  function(Node $node) {

              Expected 1 space after FUNCTION keyword; 0 found
              Open

                                  function(Node $node) {

              Multi-line function declarations must define one parameter per line
              Open

                      NodeController $nodeController, $validators,

              Blank line found at start of control structure
              Open

                      } catch(\Exception $e) {

              Expected 1 blank line at end of file; 2 found
              Open

              }

              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