XoopsModules25x/xoopsinfo

View on GitHub
phpsysinfo/includes/mb/class.ipmitool.inc.php

Summary

Maintainability
F
1 wk
Test Coverage

Function __construct has a Cognitive Complexity of 81 (exceeds 5 allowed). Consider refactoring.
Open

    public function __construct()
    {
        parent::__construct();
        $lines = "";
        switch (defined('PSI_SENSOR_IPMITOOL_ACCESS')?strtolower(PSI_SENSOR_IPMITOOL_ACCESS):'command') {
Severity: Minor
Found in phpsysinfo/includes/mb/class.ipmitool.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 __construct has 107 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function __construct()
    {
        parent::__construct();
        $lines = "";
        switch (defined('PSI_SENSOR_IPMITOOL_ACCESS')?strtolower(PSI_SENSOR_IPMITOOL_ACCESS):'command') {
Severity: Major
Found in phpsysinfo/includes/mb/class.ipmitool.inc.php - About 4 hrs to fix

    The class IPMItool has an overall complexity of 111 which is very high. The configured complexity threshold is 50.
    Open

    class IPMItool extends Sensors
    {
        /**
         * content to parse
         *

    File class.ipmitool.inc.php has 252 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    /**
     * ipmitool sensor class, getting information from ipmitool
     *
     * PHP version 5
    Severity: Minor
    Found in phpsysinfo/includes/mb/class.ipmitool.inc.php - About 2 hrs to fix

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

          private function _current()
          {
              foreach ($this->_buf as $sensor) {
                  if (((isset($sensor['Sensor Type (Threshold)']) && ($sensor['Sensor Type (Threshold)'] == 'Current'))
                      ||(isset($sensor['Sensor Type (Analog)']) && ($sensor['Sensor Type (Analog)'] == 'Current')))
      Severity: Minor
      Found in phpsysinfo/includes/mb/class.ipmitool.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 _voltage has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

          private function _voltage()
          {
              foreach ($this->_buf as $sensor) {
                  if (((isset($sensor['Sensor Type (Threshold)']) && ($sensor['Sensor Type (Threshold)'] == 'Voltage'))
                      ||(isset($sensor['Sensor Type (Analog)']) && ($sensor['Sensor Type (Analog)'] == 'Voltage')))
      Severity: Minor
      Found in phpsysinfo/includes/mb/class.ipmitool.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 _fans has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

          private function _fans()
          {
              foreach ($this->_buf as $sensor) {
                  if (((isset($sensor['Sensor Type (Threshold)']) && ($sensor['Sensor Type (Threshold)'] == 'Fan'))
                      ||(isset($sensor['Sensor Type (Analog)']) && ($sensor['Sensor Type (Analog)'] == 'Fan')))
      Severity: Minor
      Found in phpsysinfo/includes/mb/class.ipmitool.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 _temperature has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          private function _temperature()
          {
              foreach ($this->_buf as $sensor) {
                  if (((isset($sensor['Sensor Type (Threshold)']) && ($sensor['Sensor Type (Threshold)'] == 'Temperature'))
                      ||(isset($sensor['Sensor Type (Analog)']) && ($sensor['Sensor Type (Analog)'] == 'Temperature')))
      Severity: Minor
      Found in phpsysinfo/includes/mb/class.ipmitool.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 _power has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          private function _power()
          {
              foreach ($this->_buf as $sensor) {
                  if (((isset($sensor['Sensor Type (Threshold)']) && ($sensor['Sensor Type (Threshold)'] == 'Current'))
                      ||(isset($sensor['Sensor Type (Analog)']) && ($sensor['Sensor Type (Analog)'] == 'Current')))
      Severity: Minor
      Found in phpsysinfo/includes/mb/class.ipmitool.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 _other has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          private function _other()
          {
              foreach ($this->_buf as $sensor) {
                  if (isset($sensor['Sensor Type (Discrete)'])) {
                      $dev = new SensorDevice();
      Severity: Minor
      Found in phpsysinfo/includes/mb/class.ipmitool.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

      Consider simplifying this complex logical expression.
      Open

                  if (((isset($sensor['Sensor Type (Threshold)']) && ($sensor['Sensor Type (Threshold)'] == 'Temperature'))
                      ||(isset($sensor['Sensor Type (Analog)']) && ($sensor['Sensor Type (Analog)'] == 'Temperature')))
                     && isset($sensor['Unit']) && ($sensor['Unit'] == 'degrees C')
                     && isset($sensor['Value'])) {
                      $dev = new SensorDevice();
      Severity: Major
      Found in phpsysinfo/includes/mb/class.ipmitool.inc.php - About 1 hr to fix

        Consider simplifying this complex logical expression.
        Open

                    if (((isset($sensor['Sensor Type (Threshold)']) && ($sensor['Sensor Type (Threshold)'] == 'Fan'))
                        ||(isset($sensor['Sensor Type (Analog)']) && ($sensor['Sensor Type (Analog)'] == 'Fan')))
                       && isset($sensor['Unit']) && ($sensor['Unit'] == 'RPM')
                       && isset($sensor['Value'])) {
                        $dev = new SensorDevice();
        Severity: Major
        Found in phpsysinfo/includes/mb/class.ipmitool.inc.php - About 1 hr to fix

          Consider simplifying this complex logical expression.
          Open

                      if (((isset($sensor['Sensor Type (Threshold)']) && ($sensor['Sensor Type (Threshold)'] == 'Voltage'))
                          ||(isset($sensor['Sensor Type (Analog)']) && ($sensor['Sensor Type (Analog)'] == 'Voltage')))
                         && isset($sensor['Unit']) && ($sensor['Unit'] == 'Volts')
                         && isset($sensor['Value'])) {
                          $dev = new SensorDevice();
          Severity: Major
          Found in phpsysinfo/includes/mb/class.ipmitool.inc.php - About 1 hr to fix

            Consider simplifying this complex logical expression.
            Open

                        if (((isset($sensor['Sensor Type (Threshold)']) && ($sensor['Sensor Type (Threshold)'] == 'Current'))
                            ||(isset($sensor['Sensor Type (Analog)']) && ($sensor['Sensor Type (Analog)'] == 'Current')))
                           && isset($sensor['Unit']) && ($sensor['Unit'] == 'Watts')
                           && isset($sensor['Value'])) {
                            $dev = new SensorDevice();
            Severity: Major
            Found in phpsysinfo/includes/mb/class.ipmitool.inc.php - About 1 hr to fix

              Consider simplifying this complex logical expression.
              Open

                          if (((isset($sensor['Sensor Type (Threshold)']) && ($sensor['Sensor Type (Threshold)'] == 'Current'))
                              ||(isset($sensor['Sensor Type (Analog)']) && ($sensor['Sensor Type (Analog)'] == 'Current')))
                             && isset($sensor['Unit']) && ($sensor['Unit'] == 'Amps')
                             && isset($sensor['Value'])) {
                              $dev = new SensorDevice();
              Severity: Major
              Found in phpsysinfo/includes/mb/class.ipmitool.inc.php - About 1 hr to fix

                Avoid deeply nested control flow statements.
                Open

                                                switch ($buffer[2]) {
                                                case 'degrees C':
                                                    $sens['Value'] = $buffer[1];
                                                    $sens['Unit'] = $buffer[2];
                                                    $sens['Upper Critical'] = $buffer[8];
                Severity: Major
                Found in phpsysinfo/includes/mb/class.ipmitool.inc.php - About 45 mins to fix

                  The method __construct() has 112 lines of code. Current threshold is set to 100. Avoid really long methods.
                  Open

                      public function __construct()
                      {
                          parent::__construct();
                          $lines = "";
                          switch (defined('PSI_SENSOR_IPMITOOL_ACCESS')?strtolower(PSI_SENSOR_IPMITOOL_ACCESS):'command') {

                  The method __construct() has an NPath complexity of 320. The configured NPath complexity threshold is 200.
                  Open

                      public function __construct()
                      {
                          parent::__construct();
                          $lines = "";
                          switch (defined('PSI_SENSOR_IPMITOOL_ACCESS')?strtolower(PSI_SENSOR_IPMITOOL_ACCESS):'command') {

                  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 method _power() has a Cyclomatic Complexity of 13. The configured cyclomatic complexity threshold is 10.
                  Open

                      private function _power()
                      {
                          foreach ($this->_buf as $sensor) {
                              if (((isset($sensor['Sensor Type (Threshold)']) && ($sensor['Sensor Type (Threshold)'] == 'Current'))
                                  ||(isset($sensor['Sensor Type (Analog)']) && ($sensor['Sensor Type (Analog)'] == 'Current')))

                  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 _temperature() has a Cyclomatic Complexity of 13. The configured cyclomatic complexity threshold is 10.
                  Open

                      private function _temperature()
                      {
                          foreach ($this->_buf as $sensor) {
                              if (((isset($sensor['Sensor Type (Threshold)']) && ($sensor['Sensor Type (Threshold)'] == 'Temperature'))
                                  ||(isset($sensor['Sensor Type (Analog)']) && ($sensor['Sensor Type (Analog)'] == 'Temperature')))

                  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 _current() has a Cyclomatic Complexity of 15. The configured cyclomatic complexity threshold is 10.
                  Open

                      private function _current()
                      {
                          foreach ($this->_buf as $sensor) {
                              if (((isset($sensor['Sensor Type (Threshold)']) && ($sensor['Sensor Type (Threshold)'] == 'Current'))
                                  ||(isset($sensor['Sensor Type (Analog)']) && ($sensor['Sensor Type (Analog)'] == 'Current')))

                  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 _voltage() has a Cyclomatic Complexity of 15. The configured cyclomatic complexity threshold is 10.
                  Open

                      private function _voltage()
                      {
                          foreach ($this->_buf as $sensor) {
                              if (((isset($sensor['Sensor Type (Threshold)']) && ($sensor['Sensor Type (Threshold)'] == 'Voltage'))
                                  ||(isset($sensor['Sensor Type (Analog)']) && ($sensor['Sensor Type (Analog)'] == 'Voltage')))

                  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 _fans() has a Cyclomatic Complexity of 16. The configured cyclomatic complexity threshold is 10.
                  Open

                      private function _fans()
                      {
                          foreach ($this->_buf as $sensor) {
                              if (((isset($sensor['Sensor Type (Threshold)']) && ($sensor['Sensor Type (Threshold)'] == 'Fan'))
                                  ||(isset($sensor['Sensor Type (Analog)']) && ($sensor['Sensor Type (Analog)'] == 'Fan')))

                  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 __construct() has a Cyclomatic Complexity of 33. The configured cyclomatic complexity threshold is 10.
                  Open

                      public function __construct()
                      {
                          parent::__construct();
                          $lines = "";
                          switch (defined('PSI_SENSOR_IPMITOOL_ACCESS')?strtolower(PSI_SENSOR_IPMITOOL_ACCESS):'command') {

                  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

                  Missing class import via use statement (line '152', column '28').
                  Open

                                  $dev = new SensorDevice();

                  MissingImport

                  Since: 2.7.0

                  Importing all external classes in a file through use statements makes them clearly visible.

                  Example

                  function make() {
                      return new \stdClass();
                  }

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

                  Missing class import via use statement (line '236', column '28').
                  Open

                                  $dev = new SensorDevice();

                  MissingImport

                  Since: 2.7.0

                  Importing all external classes in a file through use statements makes them clearly visible.

                  Example

                  function make() {
                      return new \stdClass();
                  }

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

                  Missing class import via use statement (line '288', column '28').
                  Open

                                  $dev = new SensorDevice();

                  MissingImport

                  Since: 2.7.0

                  Importing all external classes in a file through use statements makes them clearly visible.

                  Example

                  function make() {
                      return new \stdClass();
                  }

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

                  Missing class import via use statement (line '178', column '28').
                  Open

                                  $dev = new SensorDevice();

                  MissingImport

                  Since: 2.7.0

                  Importing all external classes in a file through use statements makes them clearly visible.

                  Example

                  function make() {
                      return new \stdClass();
                  }

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

                  Missing class import via use statement (line '262', column '28').
                  Open

                                  $dev = new SensorDevice();

                  MissingImport

                  Since: 2.7.0

                  Importing all external classes in a file through use statements makes them clearly visible.

                  Example

                  function make() {
                      return new \stdClass();
                  }

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

                  Missing class import via use statement (line '207', column '28').
                  Open

                                  $dev = new SensorDevice();

                  MissingImport

                  Since: 2.7.0

                  Importing all external classes in a file through use statements makes them clearly visible.

                  Example

                  function make() {
                      return new \stdClass();
                  }

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

                  Avoid using static access to class 'CommonFunctions' in method '__construct'.
                  Open

                              CommonFunctions::executeProgram('ipmitool', 'sensor -v', $lines);

                  StaticAccess

                  Since: 1.4.0

                  Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

                  Example

                  class Foo
                  {
                      public function bar()
                      {
                          Bar::baz();
                      }
                  }

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

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

                      private function _voltage()
                      {
                          foreach ($this->_buf as $sensor) {
                              if (((isset($sensor['Sensor Type (Threshold)']) && ($sensor['Sensor Type (Threshold)'] == 'Voltage'))
                                  ||(isset($sensor['Sensor Type (Analog)']) && ($sensor['Sensor Type (Analog)'] == 'Voltage')))

                  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

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

                      private function _power()
                      {
                          foreach ($this->_buf as $sensor) {
                              if (((isset($sensor['Sensor Type (Threshold)']) && ($sensor['Sensor Type (Threshold)'] == 'Current'))
                                  ||(isset($sensor['Sensor Type (Analog)']) && ($sensor['Sensor Type (Analog)'] == 'Current')))

                  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

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

                      public function __construct()
                      {
                          parent::__construct();
                          $lines = "";
                          switch (defined('PSI_SENSOR_IPMITOOL_ACCESS')?strtolower(PSI_SENSOR_IPMITOOL_ACCESS):'command') {

                  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

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

                      private function _temperature()
                      {
                          foreach ($this->_buf as $sensor) {
                              if (((isset($sensor['Sensor Type (Threshold)']) && ($sensor['Sensor Type (Threshold)'] == 'Temperature'))
                                  ||(isset($sensor['Sensor Type (Analog)']) && ($sensor['Sensor Type (Analog)'] == 'Temperature')))

                  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

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

                      private function _fans()
                      {
                          foreach ($this->_buf as $sensor) {
                              if (((isset($sensor['Sensor Type (Threshold)']) && ($sensor['Sensor Type (Threshold)'] == 'Fan'))
                                  ||(isset($sensor['Sensor Type (Analog)']) && ($sensor['Sensor Type (Analog)'] == 'Fan')))

                  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

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

                      private function _current()
                      {
                          foreach ($this->_buf as $sensor) {
                              if (((isset($sensor['Sensor Type (Threshold)']) && ($sensor['Sensor Type (Threshold)'] == 'Current'))
                                  ||(isset($sensor['Sensor Type (Analog)']) && ($sensor['Sensor Type (Analog)'] == 'Current')))

                  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

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

                      public function __construct()
                      {
                          parent::__construct();
                          $lines = "";
                          switch (defined('PSI_SENSOR_IPMITOOL_ACCESS')?strtolower(PSI_SENSOR_IPMITOOL_ACCESS):'command') {

                  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

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

                      public function __construct()
                      {
                          parent::__construct();
                          $lines = "";
                          switch (defined('PSI_SENSOR_IPMITOOL_ACCESS')?strtolower(PSI_SENSOR_IPMITOOL_ACCESS):'command') {

                  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

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

                      public function __construct()
                      {
                          parent::__construct();
                          $lines = "";
                          switch (defined('PSI_SENSOR_IPMITOOL_ACCESS')?strtolower(PSI_SENSOR_IPMITOOL_ACCESS):'command') {

                  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 __construct uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                  Open

                                                  } else {
                                                      $sens['State'] = $buffer1;
                                                  }

                  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 '155', column '59').
                  Open

                      private function _temperature()
                      {
                          foreach ($this->_buf as $sensor) {
                              if (((isset($sensor['Sensor Type (Threshold)']) && ($sensor['Sensor Type (Threshold)'] == 'Temperature'))
                                  ||(isset($sensor['Sensor Type (Analog)']) && ($sensor['Sensor Type (Analog)'] == 'Temperature')))

                  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

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

                      private function _power()
                      {
                          foreach ($this->_buf as $sensor) {
                              if (((isset($sensor['Sensor Type (Threshold)']) && ($sensor['Sensor Type (Threshold)'] == 'Current'))
                                  ||(isset($sensor['Sensor Type (Analog)']) && ($sensor['Sensor Type (Analog)'] == 'Current')))

                  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 _other uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                  Open

                                  } else {
                                      $dev->setValue('0x0');
                                  }

                  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 '187', column '51').
                  Open

                      private function _voltage()
                      {
                          foreach ($this->_buf as $sensor) {
                              if (((isset($sensor['Sensor Type (Threshold)']) && ($sensor['Sensor Type (Threshold)'] == 'Voltage'))
                                  ||(isset($sensor['Sensor Type (Analog)']) && ($sensor['Sensor Type (Analog)'] == 'Voltage')))

                  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

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

                      private function _current()
                      {
                          foreach ($this->_buf as $sensor) {
                              if (((isset($sensor['Sensor Type (Threshold)']) && ($sensor['Sensor Type (Threshold)'] == 'Current'))
                                  ||(isset($sensor['Sensor Type (Analog)']) && ($sensor['Sensor Type (Analog)'] == 'Current')))

                  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

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

                      public function __construct()
                      {
                          parent::__construct();
                          $lines = "";
                          switch (defined('PSI_SENSOR_IPMITOOL_ACCESS')?strtolower(PSI_SENSOR_IPMITOOL_ACCESS):'command') {

                  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 __construct uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                  Open

                              } else {
                                  $lines = preg_split("/\r?\n/", $lines, -1, PREG_SPLIT_NO_EMPTY);
                                  if (count($lines)>0) {
                                      $buffer = preg_split("/\s*\|\s*/", $lines[0]);
                                      if (count($buffer)>8) { //old data format ('ipmitool sensor')

                  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 '181', column '59').
                  Open

                      private function _voltage()
                      {
                          foreach ($this->_buf as $sensor) {
                              if (((isset($sensor['Sensor Type (Threshold)']) && ($sensor['Sensor Type (Threshold)'] == 'Voltage'))
                                  ||(isset($sensor['Sensor Type (Analog)']) && ($sensor['Sensor Type (Analog)'] == 'Voltage')))

                  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 _other uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                  Open

                                  } else {
                                      $dev->setName($sensor['Sensor']);
                                  }

                  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 using static access to class 'CommonFunctions' in method '__construct'.
                  Open

                              CommonFunctions::rfts(PSI_APP_ROOT.'/data/ipmitool.txt', $lines);

                  StaticAccess

                  Since: 1.4.0

                  Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

                  Example

                  class Foo
                  {
                      public function bar()
                      {
                          Bar::baz();
                      }
                  }

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

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

                      private function _fans()
                      {
                          foreach ($this->_buf as $sensor) {
                              if (((isset($sensor['Sensor Type (Threshold)']) && ($sensor['Sensor Type (Threshold)'] == 'Fan'))
                                  ||(isset($sensor['Sensor Type (Analog)']) && ($sensor['Sensor Type (Analog)'] == 'Fan')))

                  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

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

                      private function _fans()
                      {
                          foreach ($this->_buf as $sensor) {
                              if (((isset($sensor['Sensor Type (Threshold)']) && ($sensor['Sensor Type (Threshold)'] == 'Fan'))
                                  ||(isset($sensor['Sensor Type (Analog)']) && ($sensor['Sensor Type (Analog)'] == 'Fan')))

                  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

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

                      private function _current()
                      {
                          foreach ($this->_buf as $sensor) {
                              if (((isset($sensor['Sensor Type (Threshold)']) && ($sensor['Sensor Type (Threshold)'] == 'Current'))
                                  ||(isset($sensor['Sensor Type (Analog)']) && ($sensor['Sensor Type (Analog)'] == 'Current')))

                  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

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

                      private function _current()
                      {
                          foreach ($this->_buf as $sensor) {
                              if (((isset($sensor['Sensor Type (Threshold)']) && ($sensor['Sensor Type (Threshold)'] == 'Current'))
                                  ||(isset($sensor['Sensor Type (Analog)']) && ($sensor['Sensor Type (Analog)'] == 'Current')))
                  Severity: Major
                  Found in phpsysinfo/includes/mb/class.ipmitool.inc.php and 1 other location - About 1 day to fix
                  phpsysinfo/includes/mb/class.ipmitool.inc.php on lines 171..193

                  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 245.

                  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

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

                      private function _voltage()
                      {
                          foreach ($this->_buf as $sensor) {
                              if (((isset($sensor['Sensor Type (Threshold)']) && ($sensor['Sensor Type (Threshold)'] == 'Voltage'))
                                  ||(isset($sensor['Sensor Type (Analog)']) && ($sensor['Sensor Type (Analog)'] == 'Voltage')))
                  Severity: Major
                  Found in phpsysinfo/includes/mb/class.ipmitool.inc.php and 1 other location - About 1 day to fix
                  phpsysinfo/includes/mb/class.ipmitool.inc.php on lines 255..277

                  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 245.

                  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

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

                      private function _temperature()
                      {
                          foreach ($this->_buf as $sensor) {
                              if (((isset($sensor['Sensor Type (Threshold)']) && ($sensor['Sensor Type (Threshold)'] == 'Temperature'))
                                  ||(isset($sensor['Sensor Type (Analog)']) && ($sensor['Sensor Type (Analog)'] == 'Temperature')))
                  Severity: Major
                  Found in phpsysinfo/includes/mb/class.ipmitool.inc.php and 1 other location - About 6 hrs to fix
                  phpsysinfo/includes/mb/class.ipmitool.inc.php on lines 229..248

                  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 209.

                  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

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

                      private function _power()
                      {
                          foreach ($this->_buf as $sensor) {
                              if (((isset($sensor['Sensor Type (Threshold)']) && ($sensor['Sensor Type (Threshold)'] == 'Current'))
                                  ||(isset($sensor['Sensor Type (Analog)']) && ($sensor['Sensor Type (Analog)'] == 'Current')))
                  Severity: Major
                  Found in phpsysinfo/includes/mb/class.ipmitool.inc.php and 1 other location - About 6 hrs to fix
                  phpsysinfo/includes/mb/class.ipmitool.inc.php on lines 145..164

                  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 209.

                  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

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

                          switch (defined('PSI_SENSOR_IPMITOOL_ACCESS')?strtolower(PSI_SENSOR_IPMITOOL_ACCESS):'command') {
                          case 'command':
                              CommonFunctions::executeProgram('ipmitool', 'sensor -v', $lines);
                              break;
                          case 'data':
                  Severity: Minor
                  Found in phpsysinfo/includes/mb/class.ipmitool.inc.php and 1 other location - About 30 mins to fix
                  phpsysinfo/includes/mb/class.lmsensors.inc.php on lines 31..41

                  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 90.

                  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

                  Each class must be in a namespace of at least one level (a top-level vendor name)
                  Open

                  class IPMItool extends Sensors

                  The property $_buf is not named in camelCase.
                  Open

                  class IPMItool extends Sensors
                  {
                      /**
                       * content to parse
                       *

                  CamelCasePropertyName

                  Since: 0.2

                  It is considered best practice to use the camelCase notation to name attributes.

                  Example

                  class ClassName {
                      protected $property_name;
                  }

                  Source

                  Terminating statement must be indented to the same level as the CASE body
                  Open

                                                      break;

                  Terminating statement must be indented to the same level as the CASE body
                  Open

                                                      break;

                  Terminating statement must be indented to the same level as the CASE body
                  Open

                                                      break;

                  Method name "_current" should not be prefixed with an underscore to indicate visibility
                  Open

                      private function _current()

                  Terminating statement must be indented to the same level as the CASE body
                  Open

                              break;

                  Terminating statement must be indented to the same level as the CASE body
                  Open

                              break;

                  Terminating statement must be indented to the same level as the CASE body
                  Open

                                                      break;

                  Terminating statement must be indented to the same level as the CASE body
                  Open

                                                      break;

                  Terminating statement must be indented to the same level as the CASE body
                  Open

                              break;

                  Method name "_fans" should not be prefixed with an underscore to indicate visibility
                  Open

                      private function _fans()

                  Terminating statement must be indented to the same level as the CASE body
                  Open

                                                      break;

                  Method name "_power" should not be prefixed with an underscore to indicate visibility
                  Open

                      private function _power()

                  Method name "_other" should not be prefixed with an underscore to indicate visibility
                  Open

                      private function _other()

                  Method name "_temperature" should not be prefixed with an underscore to indicate visibility
                  Open

                      private function _temperature()

                  Property name "$_buf" should not be prefixed with an underscore to indicate visibility
                  Open

                      private $_buf = array();

                  Method name "_voltage" should not be prefixed with an underscore to indicate visibility
                  Open

                      private function _voltage()

                  Line exceeds 120 characters; contains 129 characters
                  Open

                                              if (preg_match("/^\s+\[(.+)\]$/", $sensorvalue, $buffer) && (($buffer1 = trim($buffer[1])) !== "")) {

                  Line exceeds 120 characters; contains 132 characters
                  Open

                   * @license   http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version

                  Line exceeds 120 characters; contains 129 characters
                  Open

                                      if (preg_match("/^:\s*(.+)\s\((0x[a-f\d]+)\)\r?\n/", $sensor, $name) && (($name1 = trim($name[1])) !== "")) {

                  Line indented incorrectly; expected at least 40 spaces, found 36
                  Open

                                                      $sens['Upper Critical'] = $buffer[8];

                  Line indented incorrectly; expected 36 spaces, found 32
                  Open

                                                  case 'Watts':

                  Line indented incorrectly; expected at least 40 spaces, found 36
                  Open

                                                      $sens['Value'] = $buffer[1];

                  Line indented incorrectly; expected at least 40 spaces, found 36
                  Open

                                                      $sens['Lower Critical'] = $buffer[5];

                  Line indented incorrectly; expected 36 spaces, found 32
                  Open

                                                  case 'discrete':

                  Line indented incorrectly; expected 40 spaces, found 36
                  Open

                                                      if (($buffer[1]==='0x0') || ($buffer[1]==='0x1')) {

                  Line indented incorrectly; expected at least 16 spaces, found 12
                  Open

                              CommonFunctions::rfts(PSI_APP_ROOT.'/data/ipmitool.txt', $lines);

                  Line indented incorrectly; expected at least 40 spaces, found 36
                  Open

                                                      $sens['Unit'] = $buffer[2];

                  Line indented incorrectly; expected 36 spaces, found 32
                  Open

                                                  case 'Amps':

                  Line indented incorrectly; expected at least 40 spaces, found 36
                  Open

                                                      $sens['Sensor Type (Threshold)'] = 'Current';

                  Line indented incorrectly; expected 40 spaces, found 36
                  Open

                                                      }

                  Line indented incorrectly; expected 36 spaces, found 32
                  Open

                                                  case 'Volts':

                  Line indented incorrectly; expected at least 40 spaces, found 36
                  Open

                                                      $sens['Value'] = $buffer[1];

                  Line indented incorrectly; expected at least 40 spaces, found 36
                  Open

                                                      $sens['Sensor Type (Threshold)'] = 'Fan';

                  Line indented incorrectly; expected 12 spaces, found 8
                  Open

                          case 'command':

                  Line indented incorrectly; expected at least 40 spaces, found 36
                  Open

                                                      $sens['Unit'] = $buffer[2];

                  Line indented incorrectly; expected 12 spaces, found 8
                  Open

                          case 'data':

                  Line indented incorrectly; expected 36 spaces, found 32
                  Open

                                                  case 'degrees C':

                  Line indented incorrectly; expected at least 40 spaces, found 36
                  Open

                                                      $sens['Unit'] = $buffer[2];

                  Line indented incorrectly; expected at least 40 spaces, found 36
                  Open

                                                      $sens['Value'] = $buffer[1];

                  Line indented incorrectly; expected at least 40 spaces, found 36
                  Open

                                                      $sens['Upper Critical'] = $buffer[8];

                  Line indented incorrectly; expected at least 40 spaces, found 36
                  Open

                                                      $sens['Lower Critical'] = $buffer[5];

                  Line indented incorrectly; expected at least 40 spaces, found 36
                  Open

                                                      $sens['Unit'] = $buffer[2];

                  Line indented incorrectly; expected at least 40 spaces, found 36
                  Open

                                                      $sens['Upper Critical'] = $buffer[8];

                  Line indented incorrectly; expected at least 40 spaces, found 36
                  Open

                                                      $sens['Unit'] = $buffer[2];

                  Line indented incorrectly; expected 12 spaces, found 8
                  Open

                          default:

                  Line indented incorrectly; expected at least 40 spaces, found 36
                  Open

                                                      $sens['Upper Critical'] = $buffer[8];

                  Line indented incorrectly; expected at least 16 spaces, found 12
                  Open

                              $this->error->addConfigError('__construct()', '[sensor_ipmitool] ACCESS');

                  Line indented incorrectly; expected at least 40 spaces, found 36
                  Open

                                                      $sens['Sensor Type (Threshold)'] = 'Current';

                  Line indented incorrectly; expected at least 40 spaces, found 36
                  Open

                                                      $sens['Lower Critical'] = $buffer[5];

                  Line indented incorrectly; expected at least 40 spaces, found 36
                  Open

                                                      $sens['Value'] = $buffer[1];

                  Line indented incorrectly; expected at least 40 spaces, found 36
                  Open

                                                      $sens['Upper Critical'] = $buffer[8];

                  Line indented incorrectly; expected 36 spaces, found 32
                  Open

                                                  case 'RPM':

                  Line indented incorrectly; expected at least 16 spaces, found 12
                  Open

                              CommonFunctions::executeProgram('ipmitool', 'sensor -v', $lines);

                  Line indented incorrectly; expected at least 40 spaces, found 36
                  Open

                                                      $sens['Sensor Type (Threshold)'] = 'Temperature';

                  Line indented incorrectly; expected at least 40 spaces, found 36
                  Open

                                                      $sens['Value'] = $buffer[1];

                  Line indented incorrectly; expected at least 44 spaces, found 40
                  Open

                                                          $sens['State'] = $buffer[1];

                  Line indented incorrectly; expected at least 44 spaces, found 40
                  Open

                                                          $sens['Sensor Type (Discrete)'] = '';

                  Line indented incorrectly; expected at least 40 spaces, found 36
                  Open

                                                      $sens['Sensor Type (Threshold)'] = 'Voltage';

                  Line indented incorrectly; expected at least 44 spaces, found 40
                  Open

                                                          $sens['State'] = $buffer[1];

                  The method _temperature is not named in camelCase.
                  Open

                      private function _temperature()
                      {
                          foreach ($this->_buf as $sensor) {
                              if (((isset($sensor['Sensor Type (Threshold)']) && ($sensor['Sensor Type (Threshold)'] == 'Temperature'))
                                  ||(isset($sensor['Sensor Type (Analog)']) && ($sensor['Sensor Type (Analog)'] == 'Temperature')))

                  CamelCaseMethodName

                  Since: 0.2

                  It is considered best practice to use the camelCase notation to name methods.

                  Example

                  class ClassName {
                      public function get_name() {
                      }
                  }

                  Source

                  The method _other is not named in camelCase.
                  Open

                      private function _other()
                      {
                          foreach ($this->_buf as $sensor) {
                              if (isset($sensor['Sensor Type (Discrete)'])) {
                                  $dev = new SensorDevice();

                  CamelCaseMethodName

                  Since: 0.2

                  It is considered best practice to use the camelCase notation to name methods.

                  Example

                  class ClassName {
                      public function get_name() {
                      }
                  }

                  Source

                  The method _fans is not named in camelCase.
                  Open

                      private function _fans()
                      {
                          foreach ($this->_buf as $sensor) {
                              if (((isset($sensor['Sensor Type (Threshold)']) && ($sensor['Sensor Type (Threshold)'] == 'Fan'))
                                  ||(isset($sensor['Sensor Type (Analog)']) && ($sensor['Sensor Type (Analog)'] == 'Fan')))

                  CamelCaseMethodName

                  Since: 0.2

                  It is considered best practice to use the camelCase notation to name methods.

                  Example

                  class ClassName {
                      public function get_name() {
                      }
                  }

                  Source

                  The method _voltage is not named in camelCase.
                  Open

                      private function _voltage()
                      {
                          foreach ($this->_buf as $sensor) {
                              if (((isset($sensor['Sensor Type (Threshold)']) && ($sensor['Sensor Type (Threshold)'] == 'Voltage'))
                                  ||(isset($sensor['Sensor Type (Analog)']) && ($sensor['Sensor Type (Analog)'] == 'Voltage')))

                  CamelCaseMethodName

                  Since: 0.2

                  It is considered best practice to use the camelCase notation to name methods.

                  Example

                  class ClassName {
                      public function get_name() {
                      }
                  }

                  Source

                  The method _current is not named in camelCase.
                  Open

                      private function _current()
                      {
                          foreach ($this->_buf as $sensor) {
                              if (((isset($sensor['Sensor Type (Threshold)']) && ($sensor['Sensor Type (Threshold)'] == 'Current'))
                                  ||(isset($sensor['Sensor Type (Analog)']) && ($sensor['Sensor Type (Analog)'] == 'Current')))

                  CamelCaseMethodName

                  Since: 0.2

                  It is considered best practice to use the camelCase notation to name methods.

                  Example

                  class ClassName {
                      public function get_name() {
                      }
                  }

                  Source

                  The method _power is not named in camelCase.
                  Open

                      private function _power()
                      {
                          foreach ($this->_buf as $sensor) {
                              if (((isset($sensor['Sensor Type (Threshold)']) && ($sensor['Sensor Type (Threshold)'] == 'Current'))
                                  ||(isset($sensor['Sensor Type (Analog)']) && ($sensor['Sensor Type (Analog)'] == 'Current')))

                  CamelCaseMethodName

                  Since: 0.2

                  It is considered best practice to use the camelCase notation to name methods.

                  Example

                  class ClassName {
                      public function get_name() {
                      }
                  }

                  Source

                  There are no issues that match your filters.

                  Category
                  Status