librenms/librenms

View on GitHub
includes/functions.php

Summary

Maintainability
F
5 days
Test Coverage

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

<?php

/**
 * LibreNMS
 *
Severity: Major
Found in includes/functions.php - About 1 day to fix

    Function cache_peeringdb has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
    Open

    function cache_peeringdb()
    {
        if (Config::get('peeringdb.enabled') === true) {
            $peeringdb_url = 'https://peeringdb.com/api';
            // We cache for 71 hours
    Severity: Minor
    Found in includes/functions.php - About 5 hrs to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function is_port_valid has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
    Open

    function is_port_valid($port, $device)
    {
        // check empty values first
        if (empty($port['ifDescr'])) {
            // If these are all empty, we are just going to show blank names in the ui
    Severity: Minor
    Found in includes/functions.php - About 3 hrs to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Method cache_peeringdb has 79 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function cache_peeringdb()
    {
        if (Config::get('peeringdb.enabled') === true) {
            $peeringdb_url = 'https://peeringdb.com/api';
            // We cache for 71 hours
    Severity: Major
    Found in includes/functions.php - About 3 hrs to fix

      Method is_port_valid has 55 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function is_port_valid($port, $device)
      {
          // check empty values first
          if (empty($port['ifDescr'])) {
              // If these are all empty, we are just going to show blank names in the ui
      Severity: Major
      Found in includes/functions.php - About 2 hrs to fix

        Function match_network has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

        function match_network($nets, $ip, $first = false)
        {
            $return = false;
            if (! is_array($nets)) {
                $nets = [$nets];
        Severity: Minor
        Found in includes/functions.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 hytera_h2f has 47 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function hytera_h2f($number, $nd)
        {
            if (strlen(str_replace(' ', '', $number)) == 4) {
                $number = \LibreNMS\Util\StringHelpers::asciiToHex($number, ' ');
            }
        Severity: Minor
        Found in includes/functions.php - About 1 hr to fix

          Method sync_sensor_states has 31 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function sync_sensor_states($state_index_id, $states)
          {
              $new_translations = array_reduce($states, function ($array, $state) use ($state_index_id) {
                  $array[$state['value']] = [
                      'state_index_id' => $state_index_id,
          Severity: Minor
          Found in includes/functions.php - About 1 hr to fix

            Method getCIMCentPhysical has 31 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function getCIMCentPhysical($location, &$entphysical, &$index)
            {
                global $device;
            
                // Level 1 - Does the location exist
            Severity: Minor
            Found in includes/functions.php - About 1 hr to fix

              Method match_network has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function match_network($nets, $ip, $first = false)
              {
                  $return = false;
                  if (! is_array($nets)) {
                      $nets = [$nets];
              Severity: Minor
              Found in includes/functions.php - About 1 hr to fix

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

                function parse_modules($type, $options)
                {
                    $override = false;
                
                    if (! empty($options['m'])) {
                Severity: Minor
                Found in includes/functions.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 hytera_h2f has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                function hytera_h2f($number, $nd)
                {
                    if (strlen(str_replace(' ', '', $number)) == 4) {
                        $number = \LibreNMS\Util\StringHelpers::asciiToHex($number, ' ');
                    }
                Severity: Minor
                Found in includes/functions.php - About 45 mins to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

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

                function log_event($text, $device = null, $type = null, $severity = 2, $reference = null)
                Severity: Minor
                Found in includes/functions.php - About 35 mins to fix

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

                  function q_bridge_bits2indices($hex_data)
                  {
                      /* convert hex string to an array of 1-based indices of the nonzero bits
                       * ie. '9a00' -> '100110100000' -> array(1, 4, 5, 7)
                      */
                  Severity: Minor
                  Found in includes/functions.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 create_sensor_to_state_index has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function create_sensor_to_state_index($device, $state_name, $index)
                  {
                      $sensor_entry = dbFetchRow('SELECT sensor_id FROM `sensors` WHERE `sensor_class` = ? AND `device_id` = ? AND `sensor_type` = ? AND `sensor_index` = ?', [
                          'state',
                          $device['device_id'],
                  Severity: Minor
                  Found in includes/functions.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 sync_sensor_states has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function sync_sensor_states($state_index_id, $states)
                  {
                      $new_translations = array_reduce($states, function ($array, $state) use ($state_index_id) {
                          $array[$state['value']] = [
                              'state_index_id' => $state_index_id,
                  Severity: Minor
                  Found in includes/functions.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 create_state_index has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function create_state_index($state_name, $states = [])
                  {
                      $state_index_id = dbFetchCell('SELECT `state_index_id` FROM state_indexes WHERE state_name = ? LIMIT 1', [$state_name]);
                      if (! is_numeric($state_index_id)) {
                          $state_index_id = dbInsert(['state_name' => $state_name], 'state_indexes');
                  Severity: Minor
                  Found in includes/functions.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 dnslookup has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function dnslookup($device, $type = false, $return = false)
                  {
                      if (filter_var($device['hostname'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV4) == true || filter_var($device['hostname'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV6) == true) {
                          return false;
                      }
                  Severity: Minor
                  Found in includes/functions.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 false;
                  Severity: Major
                  Found in includes/functions.php - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                                return false;
                    Severity: Major
                    Found in includes/functions.php - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                                  return false;
                      Severity: Major
                      Found in includes/functions.php - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                                    return false;
                        Severity: Major
                        Found in includes/functions.php - About 30 mins to fix

                          Avoid too many return statements within this method.
                          Open

                              return true;
                          Severity: Major
                          Found in includes/functions.php - About 30 mins to fix

                            Avoid too many return statements within this method.
                            Open

                                        return false;
                            Severity: Major
                            Found in includes/functions.php - About 30 mins to fix

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

                              function getCIMCentPhysical($location, &$entphysical, &$index)
                              {
                                  global $device;
                              
                                  // Level 1 - Does the location exist
                              Severity: Minor
                              Found in includes/functions.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

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

                              function lock_and_purge($table, $sql)
                              {
                                  $purge_name = $table . '_purge';
                                  $lock = Cache::lock($purge_name, 86000);
                                  if ($lock->get()) {
                              Severity: Minor
                              Found in includes/functions.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

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

                              function validate_device_id($id)
                              {
                                  if (empty($id) || ! is_numeric($id)) {
                                      $return = false;
                                  } else {
                              Severity: Minor
                              Found in includes/functions.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 port_fill_missing_and_trim() has an NPath complexity of 288. The configured NPath complexity threshold is 200.
                              Open

                              function port_fill_missing_and_trim(&$port, $device)
                              {
                                  $port['ifDescr'] = isset($port['ifDescr']) ? trim($port['ifDescr']) : null;
                                  $port['ifAlias'] = isset($port['ifAlias']) ? trim($port['ifAlias']) : null;
                                  $port['ifName'] = isset($port['ifName']) ? trim($port['ifName']) : null;
                              Severity: Minor
                              Found in includes/functions.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 is_port_valid() has an NPath complexity of 10206. The configured NPath complexity threshold is 200.
                              Open

                              function is_port_valid($port, $device)
                              {
                                  // check empty values first
                                  if (empty($port['ifDescr'])) {
                                      // If these are all empty, we are just going to show blank names in the ui
                              Severity: Minor
                              Found in includes/functions.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 hytera_h2f() has an NPath complexity of 256. The configured NPath complexity threshold is 200.
                              Open

                              function hytera_h2f($number, $nd)
                              {
                                  if (strlen(str_replace(' ', '', $number)) == 4) {
                                      $number = \LibreNMS\Util\StringHelpers::asciiToHex($number, ' ');
                                  }
                              Severity: Minor
                              Found in includes/functions.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 port_fill_missing_and_trim() has a Cyclomatic Complexity of 11. The configured cyclomatic complexity threshold is 10.
                              Open

                              function port_fill_missing_and_trim(&$port, $device)
                              {
                                  $port['ifDescr'] = isset($port['ifDescr']) ? trim($port['ifDescr']) : null;
                                  $port['ifAlias'] = isset($port['ifAlias']) ? trim($port['ifAlias']) : null;
                                  $port['ifName'] = isset($port['ifName']) ? trim($port['ifName']) : null;
                              Severity: Minor
                              Found in includes/functions.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 is_port_valid() has a Cyclomatic Complexity of 18. The configured cyclomatic complexity threshold is 10.
                              Open

                              function is_port_valid($port, $device)
                              {
                                  // check empty values first
                                  if (empty($port['ifDescr'])) {
                                      // If these are all empty, we are just going to show blank names in the ui
                              Severity: Minor
                              Found in includes/functions.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 match_network() has a Cyclomatic Complexity of 10. The configured cyclomatic complexity threshold is 10.
                              Open

                              function match_network($nets, $ip, $first = false)
                              {
                                  $return = false;
                                  if (! is_array($nets)) {
                                      $nets = [$nets];
                              Severity: Minor
                              Found in includes/functions.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 cache_peeringdb() has a Cyclomatic Complexity of 10. The configured cyclomatic complexity threshold is 10.
                              Open

                              function cache_peeringdb()
                              {
                                  if (Config::get('peeringdb.enabled') === true) {
                                      $peeringdb_url = 'https://peeringdb.com/api';
                                      // We cache for 71 hours
                              Severity: Minor
                              Found in includes/functions.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 getImageName has a boolean flag argument $use_database, which is a certain sign of a Single Responsibility Principle violation.
                              Open

                              function getImageName($device, $use_database = true, $dir = 'images/os/')
                              Severity: Minor
                              Found in includes/functions.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 match_network has a boolean flag argument $first, which is a certain sign of a Single Responsibility Principle violation.
                              Open

                              function match_network($nets, $ip, $first = false)
                              Severity: Minor
                              Found in includes/functions.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 dnslookup has a boolean flag argument $return, which is a certain sign of a Single Responsibility Principle violation.
                              Open

                              function dnslookup($device, $type = false, $return = false)
                              Severity: Minor
                              Found in includes/functions.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 dnslookup has a boolean flag argument $type, which is a certain sign of a Single Responsibility Principle violation.
                              Open

                              function dnslookup($device, $type = false, $return = false)
                              Severity: Minor
                              Found in includes/functions.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 fix_integer_value uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                              Open

                                  } else {
                                      $return = $value;
                                  }
                              Severity: Minor
                              Found in includes/functions.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 match_network uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                              Open

                                      } else {
                                          if (($ip_long & $mask) == ($net_long & $mask)) {
                                              $return = true;
                                          }
                                          if ($first && $return) {
                              Severity: Minor
                              Found in includes/functions.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 validate_device_id uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                              Open

                                  } else {
                                      $device_id = dbFetchCell('SELECT `device_id` FROM `devices` WHERE `device_id` = ?', [$id]);
                                      if ($device_id == $id) {
                                          $return = true;
                                      } else {
                              Severity: Minor
                              Found in includes/functions.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 device_discovery_trigger uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                              Open

                                  } else {
                                      $message = 'Error rediscovering device';
                                  }
                              Severity: Minor
                              Found in includes/functions.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 validate_device_id 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/functions.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 cache_peeringdb uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                              Open

                                                  } else {
                                                      $insert = [
                                                          'ix_id' => $ixid,
                                                          'name' => $ix->{'name'},
                                                          'asn' => $asn,
                              Severity: Minor
                              Found in includes/functions.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 cache_peeringdb uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                              Open

                                  } else {
                                      echo 'Peering DB integration disabled' . PHP_EOL;
                                  }
                              Severity: Minor
                              Found in includes/functions.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 create_state_index uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                              Open

                                  } else {
                                      sync_sensor_states($state_index_id, $states);
                                  }
                              Severity: Minor
                              Found in includes/functions.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 getCIMCentPhysical uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                              Open

                                  } else {
                                      /*
                                       * No, the entry doesnt exist.
                                       * Find its parent so we can create it.
                                       */
                              Severity: Minor
                              Found in includes/functions.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 cache_peeringdb uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                              Open

                                      } else {
                                          echo 'Cached PeeringDB data found.....' . PHP_EOL;
                                      }
                              Severity: Minor
                              Found in includes/functions.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 dnslookup uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                              Open

                                      } else {
                                          $type = DNS_A;
                                          $return = 'ip';
                                      }
                              Severity: Minor
                              Found in includes/functions.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 cache_peeringdb uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                              Open

                                                      } else {
                                                          $peer_insert = [
                                                              'ix_id' => $ixid,
                                                              'peer_id' => $peer->{'id'},
                                                              'remote_asn' => $peer->{'asn'},
                              Severity: Minor
                              Found in includes/functions.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 cache_peeringdb uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                              Open

                                          } else {
                                              dbDelete('pdb_ix_peers', '`pdb_ix_peers_id` NOT IN ' . dbGenPlaceholders(count($peer_keep)), $peer_keep);
                                          }
                              Severity: Minor
                              Found in includes/functions.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 getCIMCentPhysical uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                              Open

                                      } else {
                                          // Level 2 - No. Need to go deeper.
                                          d_echo('NON-ROOT - ' . $location . "\n");
                                          $shortlocation = array_pop($parts);
                                          $parentlocation = implode('/', $parts);
                              Severity: Minor
                              Found in includes/functions.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 cache_peeringdb uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                              Open

                                          } else {
                                              dbDelete('pdb_ix', '`pdb_ix_id` NOT IN ' . dbGenPlaceholders(count($ix_keep)), $ix_keep);
                                          }
                              Severity: Minor
                              Found in includes/functions.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 sync_sensor_states uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                              Open

                                      } else {
                                          dbDelete('state_translations', '`state_index_id`=? AND `state_value`=?', [$state_index_id, $value]);
                                      }
                              Severity: Minor
                              Found in includes/functions.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 local variables such as '$index'.
                              Open

                                                  foreach ($peers ?? [] as $index => $peer) {
                              Severity: Minor
                              Found in includes/functions.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

                              FIXME found
                              Open

                              // FIXME port to LibreNMS\Util\IPv6 class
                              Severity: Minor
                              Found in includes/functions.php by fixme

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

                                  $error_subcode_message = __($error_subcode_key);
                              Severity: Minor
                              Found in includes/functions.php by phpmd

                              LongVariable

                              Since: 0.2

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

                              Example

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

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

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

                                  $existing_translations = dbFetchRows(
                              Severity: Minor
                              Found in includes/functions.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 $id. Configured minimum length is 3.
                              Open

                              function renamehost($id, $new, $source = 'console')
                              Severity: Minor
                              Found in includes/functions.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 $id. Configured minimum length is 3.
                              Open

                              function device_discovery_trigger($id)
                              Severity: Minor
                              Found in includes/functions.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 $b. Configured minimum length is 3.
                              Open

                                  $b = max(0, 255 - (5 * ($perc + 25)));
                              Severity: Minor
                              Found in includes/functions.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 $fd. Configured minimum length is 3.
                              Open

                                  $fd = fopen($file, 'a');
                              Severity: Minor
                              Found in includes/functions.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 $r. Configured minimum length is 3.
                              Open

                                  $r = min(255, 5 * ($perc - 25));
                              Severity: Minor
                              Found in includes/functions.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 $id. Configured minimum length is 3.
                              Open

                              function delete_device($id)
                              Severity: Minor
                              Found in includes/functions.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 $id. Configured minimum length is 3.
                              Open

                              function validate_device_id($id)
                              Severity: Minor
                              Found in includes/functions.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 $ip. Configured minimum length is 3.
                              Open

                              function match_network($nets, $ip, $first = false)
                              Severity: Minor
                              Found in includes/functions.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 $x. Configured minimum length is 3.
                              Open

                                      $x = ip2long($ip_arr[1]);
                              Severity: Minor
                              Found in includes/functions.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 $r. Configured minimum length is 3.
                              Open

                                  $r = '';
                              Severity: Minor
                              Found in includes/functions.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 $id. Configured minimum length is 3.
                              Open

                                      $id = dbInsert($insert, 'entPhysical');
                              Severity: Minor
                              Found in includes/functions.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 $nd. Configured minimum length is 3.
                              Open

                              function hytera_h2f($number, $nd)
                              Severity: Minor
                              Found in includes/functions.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 $y. Configured minimum length is 3.
                              Open

                                  $y = explode(' ', $number);
                              Severity: Minor
                              Found in includes/functions.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