librenms/librenms

View on GitHub
includes/html/functions.inc.php

Summary

Maintainability
F
6 days
Test Coverage

get_client_ip accesses the super-global variable $_SERVER.
Open

function get_client_ip()
{
    if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
        $client_ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
    } else {
Severity: Minor
Found in includes/html/functions.inc.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

get_url accesses the super-global variable $_SERVER.
Open

function get_url()
{
    // http://stackoverflow.com/questions/2820723/how-to-get-base-url-with-php
    // http://stackoverflow.com/users/184600/ma%C4%8Dek
    return sprintf(
Severity: Minor
Found in includes/html/functions.inc.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

get_client_ip accesses the super-global variable $_SERVER.
Open

function get_client_ip()
{
    if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
        $client_ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
    } else {
Severity: Minor
Found in includes/html/functions.inc.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

get_url accesses the super-global variable $_SERVER.
Open

function get_url()
{
    // http://stackoverflow.com/questions/2820723/how-to-get-base-url-with-php
    // http://stackoverflow.com/users/184600/ma%C4%8Dek
    return sprintf(
Severity: Minor
Found in includes/html/functions.inc.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

get_client_ip accesses the super-global variable $_SERVER.
Open

function get_client_ip()
{
    if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
        $client_ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
    } else {
Severity: Minor
Found in includes/html/functions.inc.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

get_url accesses the super-global variable $_SERVER.
Open

function get_url()
{
    // http://stackoverflow.com/questions/2820723/how-to-get-base-url-with-php
    // http://stackoverflow.com/users/184600/ma%C4%8Dek
    return sprintf(
Severity: Minor
Found in includes/html/functions.inc.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

get_url accesses the super-global variable $_SERVER.
Open

function get_url()
{
    // http://stackoverflow.com/questions/2820723/how-to-get-base-url-with-php
    // http://stackoverflow.com/users/184600/ma%C4%8Dek
    return sprintf(
Severity: Minor
Found in includes/html/functions.inc.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

File functions.inc.php has 891 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/**
 * LibreNMS
 *
Severity: Major
Found in includes/html/functions.inc.php - About 2 days to fix

    Function alert_details has a Cognitive Complexity of 62 (exceeds 5 allowed). Consider refactoring.
    Open

    function alert_details($details)
    {
        if (is_string($details)) {
            $details = json_decode(gzuncompress($details), true);
        } elseif (! is_array($details)) {
    Severity: Minor
    Found in includes/html/functions.inc.php - About 1 day 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 alert_details has 110 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function alert_details($details)
    {
        if (is_string($details)) {
            $details = json_decode(gzuncompress($details), true);
        } elseif (! is_array($details)) {
    Severity: Major
    Found in includes/html/functions.inc.php - About 4 hrs to fix

      Method generate_port_link has 45 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function generate_port_link($port, $text = null, $type = null, $overlib = 1, $single_graph = 0)
      {
          $graph_array = [];
      
          if (! $text) {
      Severity: Minor
      Found in includes/html/functions.inc.php - About 1 hr to fix

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

        function generate_ap_link($args, $text = null, $type = null)
        {
            $args = cleanPort($args);
            if (! $text) {
                $text = Rewrite::normalizeIfName($args['label']);
        Severity: Minor
        Found in includes/html/functions.inc.php - About 1 hr to fix

          Method get_sensor_label_color has 37 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function get_sensor_label_color($sensor, $type = 'sensors')
          {
              $label_style = 'label-success';
              if (is_null($sensor)) {
                  return 'label-unknown';
          Severity: Minor
          Found in includes/html/functions.inc.php - About 1 hr to fix

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

            function get_ports_from_type($given_types)
            {
                // Make the arg an array if it isn't, so subsequent steps only have to handle arrays.
                if (! is_array($given_types)) {
                    $given_types = [$given_types];
            Severity: Minor
            Found in includes/html/functions.inc.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 get_sensor_label_color has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

            function get_sensor_label_color($sensor, $type = 'sensors')
            {
                $label_style = 'label-success';
                if (is_null($sensor)) {
                    return 'label-unknown';
            Severity: Minor
            Found in includes/html/functions.inc.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 generate_sensor_link has 32 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function generate_sensor_link($args, $text = null, $type = null)
            {
                if (! $text) {
                    $text = $args['sensor_descr'];
                }
            Severity: Minor
            Found in includes/html/functions.inc.php - About 1 hr to fix

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

              function get_ports_from_type($given_types)
              {
                  // Make the arg an array if it isn't, so subsequent steps only have to handle arrays.
                  if (! is_array($given_types)) {
                      $given_types = [$given_types];
              Severity: Minor
              Found in includes/html/functions.inc.php - About 1 hr to fix

                Method print_percentage_bar has 9 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                function print_percentage_bar($width, $height, $percent, $left_text, $left_colour, $left_background, $right_text, $right_colour, $right_background)
                Severity: Major
                Found in includes/html/functions.inc.php - About 1 hr to fix

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

                  function generate_port_link($port, $text = null, $type = null, $overlib = 1, $single_graph = 0)
                  {
                      $graph_array = [];
                  
                      if (! $text) {
                  Severity: Minor
                  Found in includes/html/functions.inc.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

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

                  function time_to_nfsen_subpath($time)
                  {
                      $time = lowest_time($time);
                      $layout = Config::get('nfsen_subdirlayout');
                  
                  
                  Severity: Minor
                  Found in includes/html/functions.inc.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 generate_device_link has 7 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                  function generate_device_link($device, $text = null, $vars = [], $start = 0, $end = 0, $escape_text = 1, $overlib = 1)
                  Severity: Major
                  Found in includes/html/functions.inc.php - About 50 mins to fix

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

                    function generate_port_link($port, $text = null, $type = null, $overlib = 1, $single_graph = 0)
                    Severity: Minor
                    Found in includes/html/functions.inc.php - About 35 mins to fix

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

                      function devclass($device)
                      {
                          if (isset($device['status']) && $device['status'] == '0') {
                              $class = 'list-device-down';
                          } else {
                      Severity: Minor
                      Found in includes/html/functions.inc.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

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

                      function generate_ap_link($args, $text = null, $type = null)
                      {
                          $args = cleanPort($args);
                          if (! $text) {
                              $text = Rewrite::normalizeIfName($args['label']);
                      Severity: Minor
                      Found in includes/html/functions.inc.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

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

                      function get_matching_files($dir, $match = '/\.php$/')
                      {
                          $list = [];
                          if ($handle = opendir($dir)) {
                              while (false !== ($file = readdir($handle))) {
                      Severity: Minor
                      Found in includes/html/functions.inc.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

                      Avoid too many return statements within this method.
                      Open

                              return date('Y\/W\/w\/H\/\n\f\c\a\p\d\.YmdHi', $time);
                      Severity: Major
                      Found in includes/html/functions.inc.php - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                                return "<span class='label $label_style'>" . trim(Number::formatSi($sensor['sensor_current'] * 1000, 2, 3, 'm')) . '</span>';
                        Severity: Major
                        Found in includes/html/functions.inc.php - About 30 mins to fix

                          Avoid too many return statements within this method.
                          Open

                                  return "<span class='label $label_style'>" . trim(Number::formatSi(max(0, $sensor['sensor_current'] - $sensor['sensor_prev']) / Config::get('rrd.step', 300), 2, 3, $unit)) . '</span>';
                          Severity: Major
                          Found in includes/html/functions.inc.php - About 30 mins to fix

                            Avoid too many return statements within this method.
                            Open

                                        return 'label-default'; //Unknown
                            Severity: Major
                            Found in includes/html/functions.inc.php - About 30 mins to fix

                              Avoid too many return statements within this method.
                              Open

                                      return "<span class='label $label_style'>" . trim(Number::formatSi($sensor['sensor_current'] * 1000000, 2, 3, 'Hz')) . '</span>';
                              Severity: Major
                              Found in includes/html/functions.inc.php - About 30 mins to fix

                                Avoid too many return statements within this method.
                                Open

                                        return date('Y\/z\/H\/\n\f\c\a\p\d\.YmdHi', $time);
                                Severity: Major
                                Found in includes/html/functions.inc.php - About 30 mins to fix

                                  Avoid too many return statements within this method.
                                  Open

                                              return 'label-danger'; //Critical
                                  Severity: Major
                                  Found in includes/html/functions.inc.php - About 30 mins to fix

                                    Avoid too many return statements within this method.
                                    Open

                                            return date('Y\/z\/\n\f\c\a\p\d\.YmdHi', $time);
                                    Severity: Major
                                    Found in includes/html/functions.inc.php - About 30 mins to fix

                                      Avoid too many return statements within this method.
                                      Open

                                              return date('Y\-m\-d\/H\/\n\f\c\a\p\d\.YmdHi', $time);
                                      Severity: Major
                                      Found in includes/html/functions.inc.php - About 30 mins to fix

                                        Avoid too many return statements within this method.
                                        Open

                                            return "<span class='label $label_style'>" . trim(Number::formatSi($sensor['sensor_current'], 2, 3, $unit)) . '</span>';
                                        Severity: Major
                                        Found in includes/html/functions.inc.php - About 30 mins to fix

                                          Avoid too many return statements within this method.
                                          Open

                                                  return date('Y\-m\-d\/\n\f\c\a\p\d\.YmdHi', $time);
                                          Severity: Major
                                          Found in includes/html/functions.inc.php - About 30 mins to fix

                                            Function generate_dynamic_graph_tag has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                            Open

                                            function generate_dynamic_graph_tag($args)
                                            {
                                                $urlargs = [];
                                                $width = 0;
                                                foreach ($args as $key => $arg) {
                                            Severity: Minor
                                            Found in includes/html/functions.inc.php - About 25 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

                                            The function alert_details() has 132 lines of code. Current threshold is set to 100. Avoid really long methods.
                                            Open

                                            function alert_details($details)
                                            {
                                                if (is_string($details)) {
                                                    $details = json_decode(gzuncompress($details), true);
                                                } elseif (! is_array($details)) {
                                            Severity: Minor
                                            Found in includes/html/functions.inc.php by phpmd

                                            The function get_sensor_label_color() has an NPath complexity of 34992. The configured NPath complexity threshold is 200.
                                            Open

                                            function get_sensor_label_color($sensor, $type = 'sensors')
                                            {
                                                $label_style = 'label-success';
                                                if (is_null($sensor)) {
                                                    return 'label-unknown';
                                            Severity: Minor
                                            Found in includes/html/functions.inc.php by phpmd

                                            NPathComplexity

                                            Since: 0.1

                                            The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

                                            Example

                                            class Foo {
                                                function bar() {
                                                    // lots of complicated code
                                                }
                                            }

                                            Source https://phpmd.org/rules/codesize.html#npathcomplexity

                                            The function alert_details() has an NPath complexity of 1425603. The configured NPath complexity threshold is 200.
                                            Open

                                            function alert_details($details)
                                            {
                                                if (is_string($details)) {
                                                    $details = json_decode(gzuncompress($details), true);
                                                } elseif (! is_array($details)) {
                                            Severity: Minor
                                            Found in includes/html/functions.inc.php by phpmd

                                            NPathComplexity

                                            Since: 0.1

                                            The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

                                            Example

                                            class Foo {
                                                function bar() {
                                                    // lots of complicated code
                                                }
                                            }

                                            Source https://phpmd.org/rules/codesize.html#npathcomplexity

                                            The function alert_details() has a Cyclomatic Complexity of 28. The configured cyclomatic complexity threshold is 10.
                                            Open

                                            function alert_details($details)
                                            {
                                                if (is_string($details)) {
                                                    $details = json_decode(gzuncompress($details), true);
                                                } elseif (! is_array($details)) {
                                            Severity: Minor
                                            Found in includes/html/functions.inc.php by phpmd

                                            CyclomaticComplexity

                                            Since: 0.1

                                            Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

                                            Example

                                            // Cyclomatic Complexity = 11
                                            class Foo {
                                            1   public function example() {
                                            2       if ($a == $b) {
                                            3           if ($a1 == $b1) {
                                                            fiddle();
                                            4           } elseif ($a2 == $b2) {
                                                            fiddle();
                                                        } else {
                                                            fiddle();
                                                        }
                                            5       } elseif ($c == $d) {
                                            6           while ($c == $d) {
                                                            fiddle();
                                                        }
                                            7        } elseif ($e == $f) {
                                            8           for ($n = 0; $n < $h; $n++) {
                                                            fiddle();
                                                        }
                                                    } else {
                                                        switch ($z) {
                                            9               case 1:
                                                                fiddle();
                                                                break;
                                            10              case 2:
                                                                fiddle();
                                                                break;
                                            11              case 3:
                                                                fiddle();
                                                                break;
                                                            default:
                                                                fiddle();
                                                                break;
                                                        }
                                                    }
                                                }
                                            }

                                            Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

                                            The function time_to_nfsen_subpath() has a Cyclomatic Complexity of 10. The configured cyclomatic complexity threshold is 10.
                                            Open

                                            function time_to_nfsen_subpath($time)
                                            {
                                                $time = lowest_time($time);
                                                $layout = Config::get('nfsen_subdirlayout');
                                            
                                            
                                            Severity: Minor
                                            Found in includes/html/functions.inc.php by phpmd

                                            CyclomaticComplexity

                                            Since: 0.1

                                            Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

                                            Example

                                            // Cyclomatic Complexity = 11
                                            class Foo {
                                            1   public function example() {
                                            2       if ($a == $b) {
                                            3           if ($a1 == $b1) {
                                                            fiddle();
                                            4           } elseif ($a2 == $b2) {
                                                            fiddle();
                                                        } else {
                                                            fiddle();
                                                        }
                                            5       } elseif ($c == $d) {
                                            6           while ($c == $d) {
                                                            fiddle();
                                                        }
                                            7        } elseif ($e == $f) {
                                            8           for ($n = 0; $n < $h; $n++) {
                                                            fiddle();
                                                        }
                                                    } else {
                                                        switch ($z) {
                                            9               case 1:
                                                                fiddle();
                                                                break;
                                            10              case 2:
                                                                fiddle();
                                                                break;
                                            11              case 3:
                                                                fiddle();
                                                                break;
                                                            default:
                                                                fiddle();
                                                                break;
                                                        }
                                                    }
                                                }
                                            }

                                            Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

                                            The function get_sensor_label_color() has a Cyclomatic Complexity of 19. The configured cyclomatic complexity threshold is 10.
                                            Open

                                            function get_sensor_label_color($sensor, $type = 'sensors')
                                            {
                                                $label_style = 'label-success';
                                                if (is_null($sensor)) {
                                                    return 'label-unknown';
                                            Severity: Minor
                                            Found in includes/html/functions.inc.php by phpmd

                                            CyclomaticComplexity

                                            Since: 0.1

                                            Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

                                            Example

                                            // Cyclomatic Complexity = 11
                                            class Foo {
                                            1   public function example() {
                                            2       if ($a == $b) {
                                            3           if ($a1 == $b1) {
                                                            fiddle();
                                            4           } elseif ($a2 == $b2) {
                                                            fiddle();
                                                        } else {
                                                            fiddle();
                                                        }
                                            5       } elseif ($c == $d) {
                                            6           while ($c == $d) {
                                                            fiddle();
                                                        }
                                            7        } elseif ($e == $f) {
                                            8           for ($n = 0; $n < $h; $n++) {
                                                            fiddle();
                                                        }
                                                    } else {
                                                        switch ($z) {
                                            9               case 1:
                                                                fiddle();
                                                                break;
                                            10              case 2:
                                                                fiddle();
                                                                break;
                                            11              case 3:
                                                                fiddle();
                                                                break;
                                                            default:
                                                                fiddle();
                                                                break;
                                                        }
                                                    }
                                                }
                                            }

                                            Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

                                            The function toner2colour() has a Cyclomatic Complexity of 12. The configured cyclomatic complexity threshold is 10.
                                            Open

                                            function toner2colour($descr, $percent)
                                            {
                                                $colour = \LibreNMS\Util\Color::percentage(100 - $percent, null);
                                            
                                                if (substr($descr, -1) == 'C' || stripos($descr, 'cyan') !== false) {
                                            Severity: Minor
                                            Found in includes/html/functions.inc.php by phpmd

                                            CyclomaticComplexity

                                            Since: 0.1

                                            Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

                                            Example

                                            // Cyclomatic Complexity = 11
                                            class Foo {
                                            1   public function example() {
                                            2       if ($a == $b) {
                                            3           if ($a1 == $b1) {
                                                            fiddle();
                                            4           } elseif ($a2 == $b2) {
                                                            fiddle();
                                                        } else {
                                                            fiddle();
                                                        }
                                            5       } elseif ($c == $d) {
                                            6           while ($c == $d) {
                                                            fiddle();
                                                        }
                                            7        } elseif ($e == $f) {
                                            8           for ($n = 0; $n < $h; $n++) {
                                                            fiddle();
                                                        }
                                                    } else {
                                                        switch ($z) {
                                            9               case 1:
                                                                fiddle();
                                                                break;
                                            10              case 2:
                                                                fiddle();
                                                                break;
                                            11              case 3:
                                                                fiddle();
                                                                break;
                                                            default:
                                                                fiddle();
                                                                break;
                                                        }
                                                    }
                                                }
                                            }

                                            Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

                                            The method generate_stacked_graphs has a boolean flag argument $force_stack, which is a certain sign of a Single Responsibility Principle violation.
                                            Open

                                            function generate_stacked_graphs($force_stack = false, $transparency = '88')
                                            Severity: Minor
                                            Found in includes/html/functions.inc.php by phpmd

                                            BooleanArgumentFlag

                                            Since: 1.4.0

                                            A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

                                            Example

                                            class Foo {
                                                public function bar($flag = true) {
                                                }
                                            }

                                            Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

                                            The method generate_stacked_graphs uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                            Open

                                                } else {
                                                    return ['transparency' => '', 'stacked' => '-1'];
                                                }
                                            Severity: Minor
                                            Found in includes/html/functions.inc.php by phpmd

                                            ElseExpression

                                            Since: 1.4.0

                                            An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                                            Example

                                            class Foo
                                            {
                                                public function bar($flag)
                                                {
                                                    if ($flag) {
                                                        // one branch
                                                    } else {
                                                        // another branch
                                                    }
                                                }
                                            }

                                            Source https://phpmd.org/rules/cleancode.html#elseexpression

                                            The method generate_port_link uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                            Open

                                                } else {
                                                    return Rewrite::normalizeIfName($text);
                                                }
                                            Severity: Minor
                                            Found in includes/html/functions.inc.php by phpmd

                                            ElseExpression

                                            Since: 1.4.0

                                            An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                                            Example

                                            class Foo
                                            {
                                                public function bar($flag)
                                                {
                                                    if ($flag) {
                                                        // one branch
                                                    } else {
                                                        // another branch
                                                    }
                                                }
                                            }

                                            Source https://phpmd.org/rules/cleancode.html#elseexpression

                                            The method devclass uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                            Open

                                                } else {
                                                    $class = 'list-device';
                                                }
                                            Severity: Minor
                                            Found in includes/html/functions.inc.php by phpmd

                                            ElseExpression

                                            Since: 1.4.0

                                            An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                                            Example

                                            class Foo
                                            {
                                                public function bar($flag)
                                                {
                                                    if ($flag) {
                                                        // one branch
                                                    } else {
                                                        // another branch
                                                    }
                                                }
                                            }

                                            Source https://phpmd.org/rules/cleancode.html#elseexpression

                                            The method alert_details uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                            Open

                                                        } else {
                                                            // Other sensors
                                                            $details = 'Value: ' . $tmp_alerts['sensor_current'] . ' (' . $tmp_alerts['sensor_class'] . ')<br>  ';
                                                        }
                                            Severity: Minor
                                            Found in includes/html/functions.inc.php by phpmd

                                            ElseExpression

                                            Since: 1.4.0

                                            An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                                            Example

                                            class Foo
                                            {
                                                public function bar($flag)
                                                {
                                                    if ($flag) {
                                                        // one branch
                                                    } else {
                                                        // another branch
                                                    }
                                                }
                                            }

                                            Source https://phpmd.org/rules/cleancode.html#elseexpression

                                            The method generate_sensor_link uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                            Open

                                                } else {
                                                    $args['graph_type'] = 'sensor_' . $type;
                                                }
                                            Severity: Minor
                                            Found in includes/html/functions.inc.php by phpmd

                                            ElseExpression

                                            Since: 1.4.0

                                            An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                                            Example

                                            class Foo
                                            {
                                                public function bar($flag)
                                                {
                                                    if ($flag) {
                                                        // one branch
                                                    } else {
                                                        // another branch
                                                    }
                                                }
                                            }

                                            Source https://phpmd.org/rules/cleancode.html#elseexpression

                                            Avoid assigning values to variables in if clauses and the like (line '584', column '9').
                                            Open

                                            function get_matching_files($dir, $match = '/\.php$/')
                                            {
                                                $list = [];
                                                if ($handle = opendir($dir)) {
                                                    while (false !== ($file = readdir($handle))) {
                                            Severity: Minor
                                            Found in includes/html/functions.inc.php by phpmd

                                            IfStatementAssignment

                                            Since: 2.7.0

                                            Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

                                            Example

                                            class Foo
                                            {
                                                public function bar($flag)
                                                {
                                                    if ($foo = 'bar') { // possible typo
                                                        // ...
                                                    }
                                                    if ($baz = 0) { // always false
                                                        // ...
                                                    }
                                                }
                                            }

                                            Source http://phpmd.org/rules/cleancode.html#ifstatementassignment

                                            The method array_to_htmljson uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                            Open

                                                } else {
                                                    return false;
                                                }
                                            Severity: Minor
                                            Found in includes/html/functions.inc.php by phpmd

                                            ElseExpression

                                            Since: 1.4.0

                                            An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                                            Example

                                            class Foo
                                            {
                                                public function bar($flag)
                                                {
                                                    if ($flag) {
                                                        // one branch
                                                    } else {
                                                        // another branch
                                                    }
                                                }
                                            }

                                            Source https://phpmd.org/rules/cleancode.html#elseexpression

                                            The method generate_ap_link uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                            Open

                                                } else {
                                                    return Rewrite::normalizeIfName($text);
                                                }
                                            Severity: Minor
                                            Found in includes/html/functions.inc.php by phpmd

                                            ElseExpression

                                            Since: 1.4.0

                                            An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                                            Example

                                            class Foo
                                            {
                                                public function bar($flag)
                                                {
                                                    if ($flag) {
                                                        // one branch
                                                    } else {
                                                        // another branch
                                                    }
                                                }
                                            }

                                            Source https://phpmd.org/rules/cleancode.html#elseexpression

                                            The method alert_details uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                            Open

                                                        } else {
                                                            $fault_detail .= ' ' . $tmp_alerts['type'] . ' - ' . $tmp_alerts['label'] . ' - ' . $tmp_alerts['error'] . ';&nbsp;';
                                                        }
                                            Severity: Minor
                                            Found in includes/html/functions.inc.php by phpmd

                                            ElseExpression

                                            Since: 1.4.0

                                            An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                                            Example

                                            class Foo
                                            {
                                                public function bar($flag)
                                                {
                                                    if ($flag) {
                                                        // one branch
                                                    } else {
                                                        // another branch
                                                    }
                                                }
                                            }

                                            Source https://phpmd.org/rules/cleancode.html#elseexpression

                                            The method dynamic_override_config uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                            Open

                                                } else {
                                                    $checked = '';
                                                }
                                            Severity: Minor
                                            Found in includes/html/functions.inc.php by phpmd

                                            ElseExpression

                                            Since: 1.4.0

                                            An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                                            Example

                                            class Foo
                                            {
                                                public function bar($flag)
                                                {
                                                    if ($flag) {
                                                        // one branch
                                                    } else {
                                                        // another branch
                                                    }
                                                }
                                            }

                                            Source https://phpmd.org/rules/cleancode.html#elseexpression

                                            The method get_client_ip uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                            Open

                                                } else {
                                                    $client_ip = $_SERVER['REMOTE_ADDR'];
                                                }
                                            Severity: Minor
                                            Found in includes/html/functions.inc.php by phpmd

                                            ElseExpression

                                            Since: 1.4.0

                                            An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                                            Example

                                            class Foo
                                            {
                                                public function bar($flag)
                                                {
                                                    if ($flag) {
                                                        // one branch
                                                    } else {
                                                        // another branch
                                                    }
                                                }
                                            }

                                            Source https://phpmd.org/rules/cleancode.html#elseexpression

                                            The method get_ports_from_type uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                            Open

                                                        } else {
                                                            $search_types[] = $type_descr;
                                                        }
                                            Severity: Minor
                                            Found in includes/html/functions.inc.php by phpmd

                                            ElseExpression

                                            Since: 1.4.0

                                            An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                                            Example

                                            class Foo
                                            {
                                                public function bar($flag)
                                                {
                                                    if ($flag) {
                                                        // one branch
                                                    } else {
                                                        // another branch
                                                    }
                                                }
                                            }

                                            Source https://phpmd.org/rules/cleancode.html#elseexpression

                                            The method get_ports_from_type uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                            Open

                                                    } else {
                                                        $search_types[] = $type;
                                                    }
                                            Severity: Minor
                                            Found in includes/html/functions.inc.php by phpmd

                                            ElseExpression

                                            Since: 1.4.0

                                            An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                                            Example

                                            class Foo
                                            {
                                                public function bar($flag)
                                                {
                                                    if ($flag) {
                                                        // one branch
                                                    } else {
                                                        // another branch
                                                    }
                                                }
                                            }

                                            Source https://phpmd.org/rules/cleancode.html#elseexpression

                                            The method alert_details uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                            Open

                                                        } else {
                                                            $tmp_alerts = cleanPort($tmp_alerts);
                                                            $fault_detail .= generate_port_link($tmp_alerts) . ';&nbsp;';
                                                        }
                                            Severity: Minor
                                            Found in includes/html/functions.inc.php by phpmd

                                            ElseExpression

                                            Since: 1.4.0

                                            An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                                            Example

                                            class Foo
                                            {
                                                public function bar($flag)
                                                {
                                                    if ($flag) {
                                                        // one branch
                                                    } else {
                                                        // another branch
                                                    }
                                                }
                                            }

                                            Source https://phpmd.org/rules/cleancode.html#elseexpression

                                            The method foldersize uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                            Open

                                                    } else {
                                                        $total_size += filesize($item);
                                                        $total_files++;
                                                    }
                                            Severity: Minor
                                            Found in includes/html/functions.inc.php by phpmd

                                            ElseExpression

                                            Since: 1.4.0

                                            An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                                            Example

                                            class Foo
                                            {
                                                public function bar($flag)
                                                {
                                                    if ($flag) {
                                                        // one branch
                                                    } else {
                                                        // another branch
                                                    }
                                                }
                                            }

                                            Source https://phpmd.org/rules/cleancode.html#elseexpression

                                            Avoid unused parameters such as '$height'.
                                            Open

                                            function print_optionbar_start($height = 0, $width = 0, $marginbottom = 5)
                                            Severity: Minor
                                            Found in includes/html/functions.inc.php by phpmd

                                            UnusedFormalParameter

                                            Since: 0.2

                                            Avoid passing parameters to methods or constructors and then not using those parameters.

                                            Example

                                            class Foo
                                            {
                                                private function bar($howdy)
                                                {
                                                    // $howdy is not used
                                                }
                                            }

                                            Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

                                            Avoid unused parameters such as '$width'.
                                            Open

                                            function print_optionbar_start($height = 0, $width = 0, $marginbottom = 5)
                                            Severity: Minor
                                            Found in includes/html/functions.inc.php by phpmd

                                            UnusedFormalParameter

                                            Since: 0.2

                                            Avoid passing parameters to methods or constructors and then not using those parameters.

                                            Example

                                            class Foo
                                            {
                                                private function bar($howdy)
                                                {
                                                    // $howdy is not used
                                                }
                                            }

                                            Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

                                            Avoid unused local variables such as '$entity_cache'.
                                            Open

                                                global $entity_cache;
                                            Severity: Minor
                                            Found in includes/html/functions.inc.php by phpmd

                                            UnusedLocalVariable

                                            Since: 0.2

                                            Detects when a local variable is declared and/or assigned, but not used.

                                            Example

                                            class Foo {
                                                public function doSomething()
                                                {
                                                    $i = 5; // Unused
                                                }
                                            }

                                            Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable

                                            Avoid unused parameters such as '$marginbottom'.
                                            Open

                                            function print_optionbar_start($height = 0, $width = 0, $marginbottom = 5)
                                            Severity: Minor
                                            Found in includes/html/functions.inc.php by phpmd

                                            UnusedFormalParameter

                                            Since: 0.2

                                            Avoid passing parameters to methods or constructors and then not using those parameters.

                                            Example

                                            class Foo
                                            {
                                                private function bar($howdy)
                                                {
                                                    // $howdy is not used
                                                }
                                            }

                                            Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

                                            TODO found
                                            Open

                                                // TODO: Add sensible defaults
                                            Severity: Minor
                                            Found in includes/html/functions.inc.php by fixme

                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                            Open

                                                switch ($severity) {
                                                    case 'critical':
                                                        $icon = 'exclamation';
                                                        $color = 'danger';
                                                        $background = 'danger';
                                            Severity: Major
                                            Found in includes/html/functions.inc.php and 1 other location - About 1 hr to fix
                                            includes/html/pages/ports.inc.php on lines 100..120

                                            Duplicated Code

                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                            Tuning

                                            This issue has a mass of 102.

                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                            Refactorings

                                            Further Reading

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

                                            function search_oxidized_config($search_in_conf_textbox)
                                            Severity: Minor
                                            Found in includes/html/functions.inc.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 variables with short names like $v. Configured minimum length is 3.
                                            Open

                                            function var_get($v)
                                            Severity: Minor
                                            Found in includes/html/functions.inc.php by phpmd

                                            ShortVariable

                                            Since: 0.2

                                            Detects when a field, local, or parameter has a very short name.

                                            Example

                                            class Something {
                                                private $q = 15; // VIOLATION - Field
                                                public static function main( array $as ) { // VIOLATION - Formal
                                                    $r = 20 + $this->q; // VIOLATION - Local
                                                    for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                                                        $r += $this->q;
                                                    }
                                                }
                                            }

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

                                            Avoid variables with short names like $or. Configured minimum length is 3.
                                            Open

                                                $or = '';
                                            Severity: Minor
                                            Found in includes/html/functions.inc.php by phpmd

                                            ShortVariable

                                            Since: 0.2

                                            Detects when a field, local, or parameter has a very short name.

                                            Example

                                            class Something {
                                                private $q = 15; // VIOLATION - Field
                                                public static function main( array $as ) { // VIOLATION - Formal
                                                    $r = 20 + $this->q; // VIOLATION - Local
                                                    for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                                                        $r += $this->q;
                                                    }
                                                }
                                            }

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

                                            Avoid variables with short names like $t. Configured minimum length is 3.
                                            Open

                                            function var_eq($v, $t)
                                            Severity: Minor
                                            Found in includes/html/functions.inc.php by phpmd

                                            ShortVariable

                                            Since: 0.2

                                            Detects when a field, local, or parameter has a very short name.

                                            Example

                                            class Something {
                                                private $q = 15; // VIOLATION - Field
                                                public static function main( array $as ) { // VIOLATION - Formal
                                                    $r = 20 + $this->q; // VIOLATION - Local
                                                    for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                                                        $r += $this->q;
                                                    }
                                                }
                                            }

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

                                            Avoid variables with short names like $ap. Configured minimum length is 3.
                                            Open

                                            function generate_ap_url($ap, $vars = [])
                                            Severity: Minor
                                            Found in includes/html/functions.inc.php by phpmd

                                            ShortVariable

                                            Since: 0.2

                                            Detects when a field, local, or parameter has a very short name.

                                            Example

                                            class Something {
                                                private $q = 15; // VIOLATION - Field
                                                public static function main( array $as ) { // VIOLATION - Formal
                                                    $r = 20 + $this->q; // VIOLATION - Local
                                                    for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                                                        $r += $this->q;
                                                    }
                                                }
                                            }

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

                                            Avoid variables with short names like $to. Configured minimum length is 3.
                                            Open

                                                $to = (is_numeric($args['to']) ? $args['to'] : 0);
                                            Severity: Minor
                                            Found in includes/html/functions.inc.php by phpmd

                                            ShortVariable

                                            Since: 0.2

                                            Detects when a field, local, or parameter has a very short name.

                                            Example

                                            class Something {
                                                private $q = 15; // VIOLATION - Field
                                                public static function main( array $as ) { // VIOLATION - Formal
                                                    $r = 20 + $this->q; // VIOLATION - Local
                                                    for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                                                        $r += $this->q;
                                                    }
                                                }
                                            }

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

                                            Avoid variables with short names like $n. Configured minimum length is 3.
                                            Open

                                                foreach ($nodes as &$n) {
                                            Severity: Minor
                                            Found in includes/html/functions.inc.php by phpmd

                                            ShortVariable

                                            Since: 0.2

                                            Detects when a field, local, or parameter has a very short name.

                                            Example

                                            class Something {
                                                private $q = 15; // VIOLATION - Field
                                                public static function main( array $as ) { // VIOLATION - Formal
                                                    $r = 20 + $this->q; // VIOLATION - Local
                                                    for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                                                        $r += $this->q;
                                                    }
                                                }
                                            }

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

                                            Avoid variables with short names like $v. Configured minimum length is 3.
                                            Open

                                            function var_eq($v, $t)
                                            Severity: Minor
                                            Found in includes/html/functions.inc.php by phpmd

                                            ShortVariable

                                            Since: 0.2

                                            Detects when a field, local, or parameter has a very short name.

                                            Example

                                            class Something {
                                                private $q = 15; // VIOLATION - Field
                                                public static function main( array $as ) { // VIOLATION - Formal
                                                    $r = 20 + $this->q; // VIOLATION - Local
                                                    for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                                                        $r += $this->q;
                                                    }
                                                }
                                            }

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

                                            There are no issues that match your filters.

                                            Category
                                            Status