marcelog/PAGI

View on GitHub

Showing 227 of 227 total issues

The class Node has 55 non-getter- and setter-methods. Consider refactoring Node to keep number of methods under 25.
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

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 MockedClientImpl has 48 public methods. Consider refactoring MockedClientImpl to keep number of public methods under 10.
Open

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

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 Node has an overall complexity of 125 which is very high. The configured complexity threshold is 50.
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

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

        Avoid excessively long variable names like $channelVariablesInstance. Keep variable name length under 20.
        Open

            protected $channelVariablesInstance = false;
        Severity: Minor
        Found in src/PAGI/Client/AbstractClient.php by phpmd

        LongVariable

        Since: 0.2

        Detects when a field, formal or local variable is declared with a long name.

        Example

        class Something {
            protected $reallyLongIntName = -3; // VIOLATION - Field
            public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
                $otherReallyLongName = -5; // VIOLATION - Local
                for ($interestingIntIndex = 0; // VIOLATION - For
                     $interestingIntIndex < 10;
                     $interestingIntIndex++ ) {
                }
            }
        }

        Source https://phpmd.org/rules/naming.html#longvariable

        Avoid excessively long variable names like $prePromptMessagesInterruptable. Keep variable name length under 20.
        Open

            private $prePromptMessagesInterruptable = true;
        Severity: Minor
        Found in src/PAGI/Node/Node.php by phpmd

        LongVariable

        Since: 0.2

        Detects when a field, formal or local variable is declared with a long name.

        Example

        class Something {
            protected $reallyLongIntName = -3; // VIOLATION - Field
            public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
                $otherReallyLongName = -5; // VIOLATION - Local
                for ($interestingIntIndex = 0; // VIOLATION - For
                     $interestingIntIndex < 10;
                     $interestingIntIndex++ ) {
                }
            }
        }

        Source https://phpmd.org/rules/naming.html#longvariable

        Avoid excessively long variable names like $acceptPrePromptInputAsInput. Keep variable name length under 20.
        Open

            private $acceptPrePromptInputAsInput = true;
        Severity: Minor
        Found in src/PAGI/Node/Node.php by phpmd

        LongVariable

        Since: 0.2

        Detects when a field, formal or local variable is declared with a long name.

        Example

        class Something {
            protected $reallyLongIntName = -3; // VIOLATION - Field
            public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
                $otherReallyLongName = -5; // VIOLATION - Local
                for ($interestingIntIndex = 0; // VIOLATION - For
                     $interestingIntIndex < 10;
                     $interestingIntIndex++ ) {
                }
            }
        }

        Source https://phpmd.org/rules/naming.html#longvariable

        Avoid excessively long variable names like $totalAttemptsForInput. Keep variable name length under 20.
        Open

            private $totalAttemptsForInput = 1;
        Severity: Minor
        Found in src/PAGI/Node/Node.php by phpmd

        LongVariable

        Since: 0.2

        Detects when a field, formal or local variable is declared with a long name.

        Example

        class Something {
            protected $reallyLongIntName = -3; // VIOLATION - Field
            public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
                $otherReallyLongName = -5; // VIOLATION - Local
                for ($interestingIntIndex = 0; // VIOLATION - For
                     $interestingIntIndex < 10;
                     $interestingIntIndex++ ) {
                }
            }
        }

        Source https://phpmd.org/rules/naming.html#longvariable

        Avoid excessively long variable names like $promptsCanBeInterrupted. Keep variable name length under 20.
        Open

            private $promptsCanBeInterrupted = true;
        Severity: Minor
        Found in src/PAGI/Node/Node.php by phpmd

        LongVariable

        Since: 0.2

        Detects when a field, formal or local variable is declared with a long name.

        Example

        class Something {
            protected $reallyLongIntName = -3; // VIOLATION - Field
            public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
                $otherReallyLongName = -5; // VIOLATION - Local
                for ($interestingIntIndex = 0; // VIOLATION - For
                     $interestingIntIndex < 10;
                     $interestingIntIndex++ ) {
                }
            }
        }

        Source https://phpmd.org/rules/naming.html#longvariable

        Avoid excessively long variable names like $onMaxValidInputAttempts. Keep variable name length under 20.
        Open

            private $onMaxValidInputAttempts = null;
        Severity: Minor
        Found in src/PAGI/Node/Node.php by phpmd

        LongVariable

        Since: 0.2

        Detects when a field, formal or local variable is declared with a long name.

        Example

        class Something {
            protected $reallyLongIntName = -3; // VIOLATION - Field
            public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
                $otherReallyLongName = -5; // VIOLATION - Local
                for ($interestingIntIndex = 0; // VIOLATION - For
                     $interestingIntIndex < 10;
                     $interestingIntIndex++ ) {
                }
            }
        }

        Source https://phpmd.org/rules/naming.html#longvariable

        Avoid excessively long variable names like $validatorsInformation. Keep variable name length under 20.
        Open

            public function loadValidatorsFrom(array $validatorsInformation)
        Severity: Minor
        Found in src/PAGI/Node/Node.php by phpmd

        LongVariable

        Since: 0.2

        Detects when a field, formal or local variable is declared with a long name.

        Example

        class Something {
            protected $reallyLongIntName = -3; // VIOLATION - Field
            public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
                $otherReallyLongName = -5; // VIOLATION - Local
                for ($interestingIntIndex = 0; // VIOLATION - For
                     $interestingIntIndex < 10;
                     $interestingIntIndex++ ) {
                }
            }
        }

        Source https://phpmd.org/rules/naming.html#longvariable

        Avoid excessively long variable names like $cancelWithInputRetriesInput. Keep variable name length under 20.
        Open

            private $cancelWithInputRetriesInput = false;
        Severity: Minor
        Found in src/PAGI/Node/Node.php by phpmd

        LongVariable

        Since: 0.2

        Detects when a field, formal or local variable is declared with a long name.

        Example

        class Something {
            protected $reallyLongIntName = -3; // VIOLATION - Field
            public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
                $otherReallyLongName = -5; // VIOLATION - Local
                for ($interestingIntIndex = 0; // VIOLATION - For
                     $interestingIntIndex < 10;
                     $interestingIntIndex++ ) {
                }
            }
        }

        Source https://phpmd.org/rules/naming.html#longvariable

        Avoid excessively long variable names like $executeAfterFailedValidation. Keep variable name length under 20.
        Open

            private $executeAfterFailedValidation = null;
        Severity: Minor
        Found in src/PAGI/Node/Node.php by phpmd

        LongVariable

        Since: 0.2

        Detects when a field, formal or local variable is declared with a long name.

        Example

        class Something {
            protected $reallyLongIntName = -3; // VIOLATION - Field
            public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
                $otherReallyLongName = -5; // VIOLATION - Local
                for ($interestingIntIndex = 0; // VIOLATION - For
                     $interestingIntIndex < 10;
                     $interestingIntIndex++ ) {
                }
            }
        }

        Source https://phpmd.org/rules/naming.html#longvariable

        Avoid excessively long variable names like $playOnNoInputInLastAttempt. Keep variable name length under 20.
        Open

            private $playOnNoInputInLastAttempt = false;
        Severity: Minor
        Found in src/PAGI/Node/Node.php by phpmd

        LongVariable

        Since: 0.2

        Detects when a field, formal or local variable is declared with a long name.

        Example

        class Something {
            protected $reallyLongIntName = -3; // VIOLATION - Field
            public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
                $otherReallyLongName = -5; // VIOLATION - Local
                for ($interestingIntIndex = 0; // VIOLATION - For
                     $interestingIntIndex < 10;
                     $interestingIntIndex++ ) {
                }
            }
        }

        Source https://phpmd.org/rules/naming.html#longvariable

        Severity
        Category
        Status
        Source
        Language