symplely/dns

View on GitHub

Showing 11 of 17 total issues

Function query has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
Open

    public function query($question, $type = 'A'): Answer
    {
        $this->clearError();

        $typeId = $this->types->getByName($type);
Severity: Minor
Found in dns/Query.php - About 6 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 smartALookup has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    public function smartALookup($hostname, $depth = 0)
    {
        $this->debug('SmartALookup for ' . $hostname . ' depth ' . $depth);

        // avoid recursive lookups
Severity: Minor
Found in dns/Query.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

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

    private function readRecord()
    {
        // First the pesky domain names - maybe not so pesky though I suppose

        $domain = $this->readDomainLabel();
Severity: Minor
Found in dns/Query.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

Function ShowSection has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

function ShowSection(Answer $result)
{
    global $extendanswer;

    foreach ($result as $index => $record) {
Severity: Minor
Found in examples/index.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

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

    private function readDomainLabels($offset, &$counter = 0)
    {
        $labels = [];
        $startOffset = $offset;
        $return = false;
Severity: Minor
Found in dns/Query.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 __construct has 8 arguments (exceeds 4 allowed). Consider refactoring.
Open

    public function __construct($typeId, $type, $class, $ttl, $data, $domain, $string, array $extras)
Severity: Major
Found in dns/Result.php - About 1 hr to fix

    Method __construct has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        public function __construct($server = null, $port = 53, $timeout = 60, $udp = true, $debug = false, $binaryDebug = false)
    Severity: Minor
    Found in dns/Query.php - About 45 mins to fix

      Avoid too many return statements within this method.
      Open

                  return '';
      Severity: Major
      Found in dns/Query.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                    return $best_answer->getData();
        Severity: Major
        Found in dns/Query.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                          return $result->getData();
          Severity: Major
          Found in dns/Query.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                    return $this->smartALookup($newTarget, $depth + 1);
            Severity: Major
            Found in dns/Query.php - About 30 mins to fix
              Severity
              Category
              Status
              Source
              Language