The method _buildFilesystems() contains an eval expression. Open
$hideMounts = eval(PSI_HIDE_MOUNTS);
- Read upRead up
- Exclude checks
EvalExpression
Since: 0.2
An eval-expression is untestable, a security risk and bad practice. Therefore it should be avoided. Consider to replace the eval-expression with regular code.
Example
class Foo {
public function bar($param) {
if ($param === 42) {
eval('$param = 23;');
}
}
}
Source https://phpmd.org/rules/design.html#evalexpression
The method _buildFilesystems() contains an eval expression. Open
$hideFstypes = eval(PSI_HIDE_FS_TYPES);
- Read upRead up
- Exclude checks
EvalExpression
Since: 0.2
An eval-expression is untestable, a security risk and bad practice. Therefore it should be avoided. Consider to replace the eval-expression with regular code.
Example
class Foo {
public function bar($param) {
if ($param === 42) {
eval('$param = 23;');
}
}
}
Source https://phpmd.org/rules/design.html#evalexpression
The method _buildFilesystems() contains an eval expression. Open
$ignoreThreshold = eval(PSI_IGNORE_THRESHOLD_FS_TYPES);
- Read upRead up
- Exclude checks
EvalExpression
Since: 0.2
An eval-expression is untestable, a security risk and bad practice. Therefore it should be avoided. Consider to replace the eval-expression with regular code.
Example
class Foo {
public function bar($param) {
if ($param === 42) {
eval('$param = 23;');
}
}
}
Source https://phpmd.org/rules/design.html#evalexpression
The method _buildNetwork() contains an eval expression. Open
$hideDevices = eval(PSI_HIDE_NETWORK_INTERFACE);
- Read upRead up
- Exclude checks
EvalExpression
Since: 0.2
An eval-expression is untestable, a security risk and bad practice. Therefore it should be avoided. Consider to replace the eval-expression with regular code.
Example
class Foo {
public function bar($param) {
if ($param === 42) {
eval('$param = 23;');
}
}
}
Source https://phpmd.org/rules/design.html#evalexpression
The method _buildFilesystems() contains an eval expression. Open
$ignoreUsage = eval(PSI_IGNORE_USAGE);
- Read upRead up
- Exclude checks
EvalExpression
Since: 0.2
An eval-expression is untestable, a security risk and bad practice. Therefore it should be avoided. Consider to replace the eval-expression with regular code.
Example
class Foo {
public function bar($param) {
if ($param === 42) {
eval('$param = 23;');
}
}
}
Source https://phpmd.org/rules/design.html#evalexpression
The method _buildFilesystems() contains an eval expression. Open
$hideDisks = eval(PSI_HIDE_DISKS);
- Read upRead up
- Exclude checks
EvalExpression
Since: 0.2
An eval-expression is untestable, a security risk and bad practice. Therefore it should be avoided. Consider to replace the eval-expression with regular code.
Example
class Foo {
public function bar($param) {
if ($param === 42) {
eval('$param = 23;');
}
}
}
Source https://phpmd.org/rules/design.html#evalexpression
The method _buildFilesystems() contains an eval expression. Open
$ignoreFree = eval(PSI_IGNORE_FREE);
- Read upRead up
- Exclude checks
EvalExpression
Since: 0.2
An eval-expression is untestable, a security risk and bad practice. Therefore it should be avoided. Consider to replace the eval-expression with regular code.
Example
class Foo {
public function bar($param) {
if ($param === 42) {
eval('$param = 23;');
}
}
}
Source https://phpmd.org/rules/design.html#evalexpression
Function _buildMbinfo
has a Cognitive Complexity of 152 (exceeds 5 allowed). Consider refactoring. Open
private function _buildMbinfo()
{
$mbinfo = $this->_xml->addChild('MBInfo');
$temp = $fan = $volt = $power = $current = $other = null;
- Read upRead up
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 _buildHardware
has a Cognitive Complexity of 107 (exceeds 5 allowed). Consider refactoring. Open
private function _buildHardware()
{
$hardware = $this->_xml->addChild('Hardware');
if ($this->_sys->getMachine() != "") {
$hardware->addAttribute('Name', $this->_sys->getMachine());
- Read upRead up
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
File class.XML.inc.php
has 649 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* XML Generation class
*
* PHP version 5
Function _buildUpsinfo
has a Cognitive Complexity of 64 (exceeds 5 allowed). Consider refactoring. Open
private function _buildUpsinfo()
{
$upsinfo = $this->_xml->addChild('UPSInfo');
if (defined('PSI_UPS_APCUPSD_CGI_ENABLE') && PSI_UPS_APCUPSD_CGI_ENABLE) {
$upsinfo->addAttribute('ApcupsdCgiLinks', true);
- Read upRead up
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 _buildXml
has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring. Open
private function _buildXml()
{
if (!$this->_plugin_request || $this->_complete_request) {
if ($this->_sys === null) {
if (PSI_DEBUG === true) {
- Read upRead up
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 _buildHardware
has 148 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function _buildHardware()
{
$hardware = $this->_xml->addChild('Hardware');
if ($this->_sys->getMachine() != "") {
$hardware->addAttribute('Name', $this->_sys->getMachine());
Function _buildFilesystems
has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring. Open
private function _buildFilesystems()
{
$hideMounts = $hideFstypes = $hideDisks = $ignoreFree = $ignoreUsage = $ignoreThreshold = array();
$i = 1;
if (defined('PSI_HIDE_MOUNTS') && is_string(PSI_HIDE_MOUNTS)) {
- Read upRead up
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 _buildVitals
has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring. Open
private function _buildVitals()
{
$vitals = $this->_xml->addChild('Vitals');
$vitals->addAttribute('Hostname', $this->_sys->getHostname());
$vitals->addAttribute('IPAddr', $this->_sys->getIp());
- Read upRead up
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 _buildMbinfo
has 95 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function _buildMbinfo()
{
$mbinfo = $this->_xml->addChild('MBInfo');
$temp = $fan = $volt = $power = $current = $other = null;
The class XML has an overall complexity of 266 which is very high. The configured complexity threshold is 50. Open
class XML
{
/**
* Sysinfo object where the information retrieval methods are included
*
- Exclude checks
Method _buildFilesystems
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function _buildFilesystems()
{
$hideMounts = $hideFstypes = $hideDisks = $ignoreFree = $ignoreUsage = $ignoreThreshold = array();
$i = 1;
if (defined('PSI_HIDE_MOUNTS') && is_string(PSI_HIDE_MOUNTS)) {
Method _buildUpsinfo
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function _buildUpsinfo()
{
$upsinfo = $this->_xml->addChild('UPSInfo');
if (defined('PSI_UPS_APCUPSD_CGI_ENABLE') && PSI_UPS_APCUPSD_CGI_ENABLE) {
$upsinfo->addAttribute('ApcupsdCgiLinks', true);
Method _buildVitals
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function _buildVitals()
{
$vitals = $this->_xml->addChild('Vitals');
$vitals->addAttribute('Hostname', $this->_sys->getHostname());
$vitals->addAttribute('IPAddr', $this->_sys->getIp());
Function _buildNetwork
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
private function _buildNetwork()
{
$hideDevices = array();
$network = $this->_xml->addChild('Network');
if (defined('PSI_HIDE_NETWORK_INTERFACE')) {
- Read upRead up
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 _xmlbody
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
private function _xmlbody()
{
$dom = new DOMDocument('1.0', 'UTF-8');
$root = $dom->createElement("tns:phpsysinfo");
$root->setAttribute('xmlns:tns', 'http://phpsysinfo.sourceforge.net/');
- Read upRead up
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 _xmlbody
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function _xmlbody()
{
$dom = new DOMDocument('1.0', 'UTF-8');
$root = $dom->createElement("tns:phpsysinfo");
$root->setAttribute('xmlns:tns', 'http://phpsysinfo.sourceforge.net/');
Method _buildXml
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function _buildXml()
{
if (!$this->_plugin_request || $this->_complete_request) {
if ($this->_sys === null) {
if (PSI_DEBUG === true) {
Function _buildPlugins
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
private function _buildPlugins()
{
$pluginroot = $this->_xml->addChild("Plugins");
if (($this->_plugin_request || $this->_complete_request) && count($this->_plugins) > 0) {
$plugins = array();
- Read upRead up
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 _buildMemory
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function _buildMemory()
{
$memory = $this->_xml->addChild('Memory');
$memory->addAttribute('Free', $this->_sys->getMemFree());
$memory->addAttribute('Used', $this->_sys->getMemUsed());
Function _buildMemory
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
private function _buildMemory()
{
$memory = $this->_xml->addChild('Memory');
$memory->addAttribute('Free', $this->_sys->getMemFree());
$memory->addAttribute('Used', $this->_sys->getMemUsed());
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Avoid deeply nested control flow statements. Open
if (preg_match("/^\.$/m", $include_path)) {
$include_path = ".";
}
Function _fillDevice
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function _fillDevice(SimpleXMLExtended $mount, DiskDevice $dev, $i)
{
$mount->addAttribute('MountPointID', $i);
if ($dev->getFsType()!=="") $mount->addAttribute('FSType', $dev->getFsType());
$mount->addAttribute('Name', $dev->getName());
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
The method _buildHardware() has an NPath complexity of 28986191121250. The configured NPath complexity threshold is 200. Open
private function _buildHardware()
{
$hardware = $this->_xml->addChild('Hardware');
if ($this->_sys->getMachine() != "") {
$hardware->addAttribute('Name', $this->_sys->getMachine());
- Read upRead up
- Exclude checks
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 _buildMbinfo() has an NPath complexity of 92425027. The configured NPath complexity threshold is 200. Open
private function _buildMbinfo()
{
$mbinfo = $this->_xml->addChild('MBInfo');
$temp = $fan = $volt = $power = $current = $other = null;
- Read upRead up
- Exclude checks
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 _buildUpsinfo() has an NPath complexity of 49161. The configured NPath complexity threshold is 200. Open
private function _buildUpsinfo()
{
$upsinfo = $this->_xml->addChild('UPSInfo');
if (defined('PSI_UPS_APCUPSD_CGI_ENABLE') && PSI_UPS_APCUPSD_CGI_ENABLE) {
$upsinfo->addAttribute('ApcupsdCgiLinks', true);
- Read upRead up
- Exclude checks
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 _buildXml() has an NPath complexity of 848560. The configured NPath complexity threshold is 200. Open
private function _buildXml()
{
if (!$this->_plugin_request || $this->_complete_request) {
if ($this->_sys === null) {
if (PSI_DEBUG === true) {
- Read upRead up
- Exclude checks
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 _buildMbinfo() has 105 lines of code. Current threshold is set to 100. Avoid really long methods. Open
private function _buildMbinfo()
{
$mbinfo = $this->_xml->addChild('MBInfo');
$temp = $fan = $volt = $power = $current = $other = null;
- Exclude checks
The method _buildVitals() has an NPath complexity of 7856. The configured NPath complexity threshold is 200. Open
private function _buildVitals()
{
$vitals = $this->_xml->addChild('Vitals');
$vitals->addAttribute('Hostname', $this->_sys->getHostname());
$vitals->addAttribute('IPAddr', $this->_sys->getIp());
- Read upRead up
- Exclude checks
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 _buildFilesystems() has an NPath complexity of 40960. The configured NPath complexity threshold is 200. Open
private function _buildFilesystems()
{
$hideMounts = $hideFstypes = $hideDisks = $ignoreFree = $ignoreUsage = $ignoreThreshold = array();
$i = 1;
if (defined('PSI_HIDE_MOUNTS') && is_string(PSI_HIDE_MOUNTS)) {
- Read upRead up
- Exclude checks
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 _buildHardware() has 157 lines of code. Current threshold is set to 100. Avoid really long methods. Open
private function _buildHardware()
{
$hardware = $this->_xml->addChild('Hardware');
if ($this->_sys->getMachine() != "") {
$hardware->addAttribute('Name', $this->_sys->getMachine());
- Exclude checks
The method _xmlbody() has an NPath complexity of 320. The configured NPath complexity threshold is 200. Open
private function _xmlbody()
{
$dom = new DOMDocument('1.0', 'UTF-8');
$root = $dom->createElement("tns:phpsysinfo");
$root->setAttribute('xmlns:tns', 'http://phpsysinfo.sourceforge.net/');
- Read upRead up
- Exclude checks
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 _buildHardware() has a Cyclomatic Complexity of 67. The configured cyclomatic complexity threshold is 10. Open
private function _buildHardware()
{
$hardware = $this->_xml->addChild('Hardware');
if ($this->_sys->getMachine() != "") {
$hardware->addAttribute('Name', $this->_sys->getMachine());
- Read upRead up
- Exclude checks
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 _buildVitals() has a Cyclomatic Complexity of 21. The configured cyclomatic complexity threshold is 10. Open
private function _buildVitals()
{
$vitals = $this->_xml->addChild('Vitals');
$vitals->addAttribute('Hostname', $this->_sys->getHostname());
$vitals->addAttribute('IPAddr', $this->_sys->getIp());
- Read upRead up
- Exclude checks
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 _xmlbody() has a Cyclomatic Complexity of 12. The configured cyclomatic complexity threshold is 10. Open
private function _xmlbody()
{
$dom = new DOMDocument('1.0', 'UTF-8');
$root = $dom->createElement("tns:phpsysinfo");
$root->setAttribute('xmlns:tns', 'http://phpsysinfo.sourceforge.net/');
- Read upRead up
- Exclude checks
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 _buildXml() has a Cyclomatic Complexity of 29. The configured cyclomatic complexity threshold is 10. Open
private function _buildXml()
{
if (!$this->_plugin_request || $this->_complete_request) {
if ($this->_sys === null) {
if (PSI_DEBUG === true) {
- Read upRead up
- Exclude checks
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 _buildNetwork() has a Cyclomatic Complexity of 10. The configured cyclomatic complexity threshold is 10. Open
private function _buildNetwork()
{
$hideDevices = array();
$network = $this->_xml->addChild('Network');
if (defined('PSI_HIDE_NETWORK_INTERFACE')) {
- Read upRead up
- Exclude checks
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 _buildMbinfo() has a Cyclomatic Complexity of 52. The configured cyclomatic complexity threshold is 10. Open
private function _buildMbinfo()
{
$mbinfo = $this->_xml->addChild('MBInfo');
$temp = $fan = $volt = $power = $current = $other = null;
- Read upRead up
- Exclude checks
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 _buildUpsinfo() has a Cyclomatic Complexity of 20. The configured cyclomatic complexity threshold is 10. Open
private function _buildUpsinfo()
{
$upsinfo = $this->_xml->addChild('UPSInfo');
if (defined('PSI_UPS_APCUPSD_CGI_ENABLE') && PSI_UPS_APCUPSD_CGI_ENABLE) {
$upsinfo->addAttribute('ApcupsdCgiLinks', true);
- Read upRead up
- Exclude checks
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 _buildFilesystems() has a Cyclomatic Complexity of 27. The configured cyclomatic complexity threshold is 10. Open
private function _buildFilesystems()
{
$hideMounts = $hideFstypes = $hideDisks = $ignoreFree = $ignoreUsage = $ignoreThreshold = array();
$i = 1;
if (defined('PSI_HIDE_MOUNTS') && is_string(PSI_HIDE_MOUNTS)) {
- Read upRead up
- Exclude checks
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
Remove error control operator '@' on line 715. Open
private function _buildXml()
{
if (!$this->_plugin_request || $this->_complete_request) {
if ($this->_sys === null) {
if (PSI_DEBUG === true) {
- Read upRead up
- Exclude checks
ErrorControlOperator
Error suppression should be avoided if possible as it doesn't just suppress the error, that you are trying to stop, but will also suppress errors that you didn't predict would ever occur. Consider changing error_reporting() level and/or setting up your own error handler.
Example
function foo($filePath) {
$file = @fopen($filPath); // hides exceptions
$key = @$array[$notExistingKey]; // assigns null to $key
}
Source http://phpmd.org/rules/cleancode.html#errorcontroloperator
Missing class import via use statement (line '796', column '27'). Open
$this->_xml = new SimpleXMLExtended(simplexml_import_dom($dom), $this->_sysinfo->getEncoding());
- Read upRead up
- Exclude checks
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
The method __construct has a boolean flag argument $blockname, which is a certain sign of a Single Responsibility Principle violation. Open
public function __construct($complete = false, $pluginname = "", $blockname = false)
- Read upRead up
- Exclude checks
BooleanArgumentFlag
Since: 1.4.0
A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.
Example
class Foo {
public function bar($flag = true) {
}
}
Source https://phpmd.org/rules/cleancode.html#booleanargumentflag
Remove error control operator '@' on line 358. Open
private function _buildHardware()
{
$hardware = $this->_xml->addChild('Hardware');
if ($this->_sys->getMachine() != "") {
$hardware->addAttribute('Name', $this->_sys->getMachine());
- Read upRead up
- Exclude checks
ErrorControlOperator
Error suppression should be avoided if possible as it doesn't just suppress the error, that you are trying to stop, but will also suppress errors that you didn't predict would ever occur. Consider changing error_reporting() level and/or setting up your own error handler.
Example
function foo($filePath) {
$file = @fopen($filPath); // hides exceptions
$key = @$array[$notExistingKey]; // assigns null to $key
}
Source http://phpmd.org/rules/cleancode.html#errorcontroloperator
Remove error control operator '@' on line 710. Open
private function _buildXml()
{
if (!$this->_plugin_request || $this->_complete_request) {
if ($this->_sys === null) {
if (PSI_DEBUG === true) {
- Read upRead up
- Exclude checks
ErrorControlOperator
Error suppression should be avoided if possible as it doesn't just suppress the error, that you are trying to stop, but will also suppress errors that you didn't predict would ever occur. Consider changing error_reporting() level and/or setting up your own error handler.
Example
function foo($filePath) {
$file = @fopen($filPath); // hides exceptions
$key = @$array[$notExistingKey]; // assigns null to $key
}
Source http://phpmd.org/rules/cleancode.html#errorcontroloperator
The method __construct has a boolean flag argument $complete, which is a certain sign of a Single Responsibility Principle violation. Open
public function __construct($complete = false, $pluginname = "", $blockname = false)
- Read upRead up
- Exclude checks
BooleanArgumentFlag
Since: 1.4.0
A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.
Example
class Foo {
public function bar($flag = true) {
}
}
Source https://phpmd.org/rules/cleancode.html#booleanargumentflag
Missing class import via use statement (line '790', column '20'). Open
$dom = new DOMDocument('1.0', 'UTF-8');
- Read upRead up
- Exclude checks
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 'System' in method '_buildHardware'. Open
foreach (System::removeDupsAndCount($this->_sys->getScsiDevices()) as $dev) {
- Read upRead up
- Exclude checks
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
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 {
$this->_plugin_request = true;
$this->_plugin = $pluginname;
}
- Read upRead up
- Exclude checks
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 '162', column '50'). Open
private function _buildVitals()
{
$vitals = $this->_xml->addChild('Vitals');
$vitals->addAttribute('Hostname', $this->_sys->getHostname());
$vitals->addAttribute('IPAddr', $this->_sys->getIp());
- Read upRead up
- Exclude checks
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 '166', column '26'). Open
private function _buildVitals()
{
$vitals = $this->_xml->addChild('Vitals');
$vitals->addAttribute('Hostname', $this->_sys->getHostname());
$vitals->addAttribute('IPAddr', $this->_sys->getIp());
- Read upRead up
- Exclude checks
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 using static access to class 'System' in method '_buildHardware'. Open
foreach (System::removeDupsAndCount($this->_sys->getUsbDevices()) as $dev) {
- Read upRead up
- Exclude checks
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 using static access to class 'System' in method '_buildHardware'. Open
foreach (System::removeDupsAndCount($this->_sys->getNvmeDevices()) as $dev) {
- Read upRead up
- Exclude checks
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 using static access to class 'CommonFunctions' in method '__construct'. Open
$this->_plugins = CommonFunctions::getPlugins();
- Read upRead up
- Exclude checks
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
The method _buildFilesystems uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$hideFstypes = array(PSI_HIDE_FS_TYPES);
}
- Read upRead up
- Exclude checks
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 '154', column '50'). Open
private function _buildVitals()
{
$vitals = $this->_xml->addChild('Vitals');
$vitals->addAttribute('Hostname', $this->_sys->getHostname());
$vitals->addAttribute('IPAddr', $this->_sys->getIp());
- Read upRead up
- Exclude checks
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 _buildNetwork uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$hideDevices = array(PSI_HIDE_NETWORK_INTERFACE);
}
- Read upRead up
- Exclude checks
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 '142', column '42'). Open
private function _buildVitals()
{
$vitals = $this->_xml->addChild('Vitals');
$vitals->addAttribute('Hostname', $this->_sys->getHostname());
$vitals->addAttribute('IPAddr', $this->_sys->getIp());
- Read upRead up
- Exclude checks
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 _buildFilesystems uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$hideMounts = array(PSI_HIDE_MOUNTS);
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
The method _xmlbody uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$options->addAttribute('refresh', 60000);
}
- Read upRead up
- Exclude checks
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 'PSI_Error' in method '__construct'. Open
$this->_errors = PSI_Error::singleton();
- Read upRead up
- Exclude checks
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 '158', column '50'). Open
private function _buildVitals()
{
$vitals = $this->_xml->addChild('Vitals');
$vitals->addAttribute('Hostname', $this->_sys->getHostname());
$vitals->addAttribute('IPAddr', $this->_sys->getIp());
- Read upRead up
- Exclude checks
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 _buildFilesystems uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$ignoreUsage = array(PSI_IGNORE_USAGE);
}
- Read upRead up
- Exclude checks
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 'System' in method '_buildHardware'. Open
foreach (System::removeDupsAndCount($this->_sys->getPciDevices()) as $dev) {
- Read upRead up
- Exclude checks
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 '811', column '19'). Open
private function _xmlbody()
{
$dom = new DOMDocument('1.0', 'UTF-8');
$root = $dom->createElement("tns:phpsysinfo");
$root->setAttribute('xmlns:tns', 'http://phpsysinfo.sourceforge.net/');
- Read upRead up
- Exclude checks
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 _buildFilesystems uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$ignoreFree = array(PSI_IGNORE_FREE);
}
- Read upRead up
- Exclude checks
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 'System' in method '_buildHardware'. Open
foreach (System::removeDupsAndCount($this->_sys->getIdeDevices()) as $dev) {
- Read upRead up
- Exclude checks
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
The method _buildFilesystems uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$hideDisks = array(PSI_HIDE_DISKS);
}
- Read upRead up
- Exclude checks
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 '141', column '14'). Open
private function _buildVitals()
{
$vitals = $this->_xml->addChild('Vitals');
$vitals->addAttribute('Hostname', $this->_sys->getHostname());
$vitals->addAttribute('IPAddr', $this->_sys->getIp());
- Read upRead up
- Exclude checks
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 '146', column '50'). Open
private function _buildVitals()
{
$vitals = $this->_xml->addChild('Vitals');
$vitals->addAttribute('Hostname', $this->_sys->getHostname());
$vitals->addAttribute('IPAddr', $this->_sys->getIp());
- Read upRead up
- Exclude checks
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 using static access to class 'System' in method '_buildHardware'. Open
foreach (System::removeDupsAndCount($this->_sys->getTbDevices()) as $dev) {
- Read upRead up
- Exclude checks
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 using static access to class 'System' in method '_buildHardware'. Open
foreach (System::removeDupsAndCount($this->_sys->getI2cDevices()) as $dev) {
- Read upRead up
- Exclude checks
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 '150', column '50'). Open
private function _buildVitals()
{
$vitals = $this->_xml->addChild('Vitals');
$vitals->addAttribute('Hostname', $this->_sys->getHostname());
$vitals->addAttribute('IPAddr', $this->_sys->getIp());
- Read upRead up
- Exclude checks
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 _buildFilesystems uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$ignoreThreshold = array(PSI_IGNORE_THRESHOLD_FS_TYPES);
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
The method __construct uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$this->_complete_request = false;
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
The method _xmlbody uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$options->addAttribute('threshold', 90);
}
- Read upRead up
- Exclude checks
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
Similar blocks of code found in 2 locations. Consider refactoring. Open
if (!$this->_sysinfo->getBlockName() || $this->_sysinfo->getBlockName()==='voltage') foreach ($mbinfo_detail->getMbVolt() as $dev) {
if ($volt == null) {
$volt = $mbinfo->addChild('Voltage');
}
$item = $volt->addChild('Item');
- Read upRead up
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 207.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
if (!$this->_sysinfo->getBlockName() || $this->_sysinfo->getBlockName()==='current') foreach ($mbinfo_detail->getMbCurrent() as $dev) {
if ($current == null) {
$current = $mbinfo->addChild('Current');
}
$item = $current->addChild('Item');
- Read upRead up
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 207.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 3 locations. Consider refactoring. Open
foreach (System::removeDupsAndCount($this->_sys->getScsiDevices()) as $dev) {
if ($scsi === null) $scsi = $hardware->addChild('SCSI');
$tmp = $scsi->addChild('Device');
$tmp->addAttribute('Name', $dev->getName());
if (defined('PSI_SHOW_DEVICES_INFOS') && PSI_SHOW_DEVICES_INFOS) {
- Read upRead up
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 195.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 3 locations. Consider refactoring. Open
foreach (System::removeDupsAndCount($this->_sys->getNvmeDevices()) as $dev) {
if ($nvme === null) $nvme = $hardware->addChild('NVMe');
$tmp = $nvme->addChild('Device');
$tmp->addAttribute('Name', $dev->getName());
if (defined('PSI_SHOW_DEVICES_INFOS') && PSI_SHOW_DEVICES_INFOS) {
- Read upRead up
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 195.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 3 locations. Consider refactoring. Open
foreach (System::removeDupsAndCount($this->_sys->getIdeDevices()) as $dev) {
if ($ide === null) $ide = $hardware->addChild('IDE');
$tmp = $ide->addChild('Device');
$tmp->addAttribute('Name', $dev->getName());
if (defined('PSI_SHOW_DEVICES_INFOS') && PSI_SHOW_DEVICES_INFOS) {
- Read upRead up
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 195.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 3 locations. Consider refactoring. Open
if (!$this->_sysinfo->getBlockName() || $this->_sysinfo->getBlockName()==='temperature') foreach ($mbinfo_detail->getMbTemp() as $dev) {
if ($temp == null) {
$temp = $mbinfo->addChild('Temperature');
}
$item = $temp->addChild('Item');
- Read upRead up
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 177.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 3 locations. Consider refactoring. Open
if (!$this->_sysinfo->getBlockName() || $this->_sysinfo->getBlockName()==='power') foreach ($mbinfo_detail->getMbPower() as $dev) {
if ($power == null) {
$power = $mbinfo->addChild('Power');
}
$item = $power->addChild('Item');
- Read upRead up
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 177.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 3 locations. Consider refactoring. Open
if (!$this->_sysinfo->getBlockName() || $this->_sysinfo->getBlockName()==='fans') foreach ($mbinfo_detail->getMbFan() as $dev) {
if ($fan == null) {
$fan = $mbinfo->addChild('Fans');
}
$item = $fan->addChild('Item');
- Read upRead up
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 177.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
foreach (System::removeDupsAndCount($this->_sys->getI2cDevices()) as $dev) {
if ($i2c === null) $i2c = $hardware->addChild('I2C');
$tmp = $i2c->addChild('Device');
$tmp->addAttribute('Name', $dev->getName());
if ($dev->getCount() > 1) {
- Read upRead up
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 98.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
foreach (System::removeDupsAndCount($this->_sys->getTbDevices()) as $dev) {
if ($tb === null) $tb = $hardware->addChild('TB');
$tmp = $tb->addChild('Device');
$tmp->addAttribute('Name', $dev->getName());
if ($dev->getCount() > 1) {
- Read upRead up
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 98.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
if (defined('PSI_HIDE_NETWORK_INTERFACE')) {
if (is_string(PSI_HIDE_NETWORK_INTERFACE)) {
if (preg_match(ARRAY_EXP, PSI_HIDE_NETWORK_INTERFACE)) {
$hideDevices = eval(PSI_HIDE_NETWORK_INTERFACE);
} else {
- Read upRead up
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 92.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
if (defined('PSI_HIDE_DISKS')) {
if (is_string(PSI_HIDE_DISKS)) {
if (preg_match(ARRAY_EXP, PSI_HIDE_DISKS)) {
$hideDisks = eval(PSI_HIDE_DISKS);
} else {
- Read upRead up
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 92.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Each class must be in a namespace of at least one level (a top-level vendor name) Open
class XML
- Exclude checks
The property $_errors is not named in camelCase. Open
class XML
{
/**
* Sysinfo object where the information retrieval methods are included
*
- Read upRead up
- Exclude checks
CamelCasePropertyName
Since: 0.2
It is considered best practice to use the camelCase notation to name attributes.
Example
class ClassName {
protected $property_name;
}
Source
The property $_plugin is not named in camelCase. Open
class XML
{
/**
* Sysinfo object where the information retrieval methods are included
*
- Read upRead up
- Exclude checks
CamelCasePropertyName
Since: 0.2
It is considered best practice to use the camelCase notation to name attributes.
Example
class ClassName {
protected $property_name;
}
Source
Avoid variables with short names like $fs. Configured minimum length is 3. Open
$fs = $this->_xml->addChild('FileSystem');
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
The property $_sys is not named in camelCase. Open
class XML
{
/**
* Sysinfo object where the information retrieval methods are included
*
- Read upRead up
- Exclude checks
CamelCasePropertyName
Since: 0.2
It is considered best practice to use the camelCase notation to name attributes.
Example
class ClassName {
protected $property_name;
}
Source
The property $_sysinfo is not named in camelCase. Open
class XML
{
/**
* Sysinfo object where the information retrieval methods are included
*
- Read upRead up
- Exclude checks
CamelCasePropertyName
Since: 0.2
It is considered best practice to use the camelCase notation to name attributes.
Example
class ClassName {
protected $property_name;
}
Source
The property $_plugin_request is not named in camelCase. Open
class XML
{
/**
* Sysinfo object where the information retrieval methods are included
*
- Read upRead up
- Exclude checks
CamelCasePropertyName
Since: 0.2
It is considered best practice to use the camelCase notation to name attributes.
Example
class ClassName {
protected $property_name;
}
Source
Avoid variables with short names like $tb. Configured minimum length is 3. Open
$tb = null;
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
Avoid variables with short names like $i. Configured minimum length is 3. Open
$i = 1;
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
Avoid variables with short names like $i. Configured minimum length is 3. Open
private function _fillDevice(SimpleXMLExtended $mount, DiskDevice $dev, $i)
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
The property $_xml is not named in camelCase. Open
class XML
{
/**
* Sysinfo object where the information retrieval methods are included
*
- Read upRead up
- Exclude checks
CamelCasePropertyName
Since: 0.2
It is considered best practice to use the camelCase notation to name attributes.
Example
class ClassName {
protected $property_name;
}
Source
The property $_complete_request is not named in camelCase. Open
class XML
{
/**
* Sysinfo object where the information retrieval methods are included
*
- Read upRead up
- Exclude checks
CamelCasePropertyName
Since: 0.2
It is considered best practice to use the camelCase notation to name attributes.
Example
class ClassName {
protected $property_name;
}
Source
Avoid variables with short names like $os. Configured minimum length is 3. Open
$os = PSI_OS;
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
The property $_plugins is not named in camelCase. Open
class XML
{
/**
* Sysinfo object where the information retrieval methods are included
*
- Read upRead up
- Exclude checks
CamelCasePropertyName
Since: 0.2
It is considered best practice to use the camelCase notation to name attributes.
Example
class ClassName {
protected $property_name;
}
Source
Avoid variables with short names like $i. Configured minimum length is 3. Open
$i = 1;
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
Method name "_buildHardware" should not be prefixed with an underscore to indicate visibility Open
private function _buildHardware()
- Exclude checks
Property name "$_xml" should not be prefixed with an underscore to indicate visibility Open
private $_xml;
- Exclude checks
Property name "$_plugins" should not be prefixed with an underscore to indicate visibility Open
private $_plugins;
- Exclude checks
Method name "_buildVitals" should not be prefixed with an underscore to indicate visibility Open
private function _buildVitals()
- Exclude checks
Property name "$_complete_request" should not be prefixed with an underscore to indicate visibility Open
private $_complete_request = false;
- Exclude checks
Property name "$_plugin" should not be prefixed with an underscore to indicate visibility Open
private $_plugin = '';
- Exclude checks
Method name "_buildNetwork" should not be prefixed with an underscore to indicate visibility Open
private function _buildNetwork()
- Exclude checks
Property name "$_plugin_request" should not be prefixed with an underscore to indicate visibility Open
private $_plugin_request = false;
- Exclude checks
Property name "$_sysinfo" should not be prefixed with an underscore to indicate visibility Open
private $_sysinfo;
- Exclude checks
Property name "$_errors" should not be prefixed with an underscore to indicate visibility Open
private $_errors;
- Exclude checks
Property name "$_sys" should not be prefixed with an underscore to indicate visibility Open
private $_sys = null;
- Exclude checks
Method name "_buildMemory" should not be prefixed with an underscore to indicate visibility Open
private function _buildMemory()
- Exclude checks
Method name "_fillDevice" should not be prefixed with an underscore to indicate visibility Open
private function _fillDevice(SimpleXMLExtended $mount, DiskDevice $dev, $i)
- Exclude checks
Method name "_buildXml" should not be prefixed with an underscore to indicate visibility Open
private function _buildXml()
- Exclude checks
Method name "_buildMbinfo" should not be prefixed with an underscore to indicate visibility Open
private function _buildMbinfo()
- Exclude checks
Method name "_buildPlugins" should not be prefixed with an underscore to indicate visibility Open
private function _buildPlugins()
- Exclude checks
Method name "_xmlbody" should not be prefixed with an underscore to indicate visibility Open
private function _xmlbody()
- Exclude checks
Method name "_buildUpsinfo" should not be prefixed with an underscore to indicate visibility Open
private function _buildUpsinfo()
- Exclude checks
Method name "_buildFilesystems" should not be prefixed with an underscore to indicate visibility Open
private function _buildFilesystems()
- Exclude checks
Expected 1 space after comma in function call; 2 found Open
$options->addAttribute('refresh', max(intval(PSI_REFRESH), 0));
- Exclude checks
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
- Exclude checks
Inline control structures are not allowed Open
if ($tb === null) $tb = $hardware->addChild('TB');
- Exclude checks
Inline control structures are not allowed Open
if ($ide === null) $ide = $hardware->addChild('IDE');
- Exclude checks
Inline control structures are not allowed Open
if ($i2c === null) $i2c = $hardware->addChild('I2C');
- Exclude checks
Inline control structures are not allowed Open
if ($scsi === null) $scsi = $hardware->addChild('SCSI');
- Exclude checks
Inline control structures are not allowed Open
if ($nvme === null) $nvme = $hardware->addChild('NVMe');
- Exclude checks
Inline control structures are not allowed Open
if ($cpu === null) $cpu = $hardware->addChild('CPU');
- Exclude checks
Inline control structures are not allowed Open
if ($pci === null) $pci = $hardware->addChild('PCI');
- Exclude checks
Line exceeds 120 characters; contains 141 characters Open
if (($this->_sys->getMemApplication() !== null) || ($this->_sys->getMemBuffer() !== null) || ($this->_sys->getMemCache() !== null)) {
- Exclude checks
Inline control structures are not allowed Open
if ($vendortab === null) $vendortab = @parse_ini_file(PSI_APP_ROOT."/data/cpus.ini", true);
- Exclude checks
Inline control structures are not allowed Open
if ($usb === null) $usb = $hardware->addChild('USB');
- Exclude checks
Inline control structures are not allowed Open
if (defined('PSI_SHOW_NETWORK_INFOS') && PSI_SHOW_NETWORK_INFOS && $dev->getInfo())
- Exclude checks
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
- Exclude checks
Line exceeds 120 characters; contains 148 characters Open
if (!$this->_sysinfo->getBlockName() || $this->_sysinfo->getBlockName()==='voltage') foreach ($mbinfo_detail->getMbVolt() as $dev) {
- Exclude checks
Inline control structures are not allowed Open
if (!$this->_sysinfo->getBlockName() || $this->_sysinfo->getBlockName()==='power') foreach ($mbinfo_detail->getMbPower() as $dev) {
- Exclude checks
Line exceeds 120 characters; contains 122 characters Open
if (!$this->_sysinfo->getBlockName() || $this->_sysinfo->getBlockName()==='hardware') $this->_buildHardware();
- Exclude checks
Line exceeds 120 characters; contains 121 characters Open
$this->_errors->addError("WARN", "PhpSysInfo requires '.' inside the 'include_path' in php.ini");
- Exclude checks
Inline control structures are not allowed Open
if (!$this->_sysinfo->getBlockName()) $this->_buildPlugins();
- Exclude checks
Line exceeds 120 characters; contains 147 characters Open
if (!$this->_sysinfo->getBlockName() || $this->_sysinfo->getBlockName()==='other') foreach ($mbinfo_detail->getMbOther() as $dev) {
- Exclude checks
Line exceeds 120 characters; contains 127 characters Open
if (!$this->_sysinfo->getBlockName() || $this->_sysinfo->getBlockName()==='filesystem') $this->_buildFilesystems();
- Exclude checks
Inline control structures are not allowed Open
if (!$this->_sysinfo->getBlockName() || in_array($this->_sysinfo->getBlockName(), array('voltage','current','temperature','fans','power','other'))) $this->_buildMbinfo();
- Exclude checks
Line exceeds 120 characters; contains 173 characters Open
if (!in_array($disk->getMountPoint(), $hideMounts, true) && !in_array($disk->getFsType(), $hideFstypes, true) && !in_array($disk->getName(), $hideDisks, true)) {
- Exclude checks
Inline control structures are not allowed Open
if (!$this->_sysinfo->getBlockName() || $this->_sysinfo->getBlockName()==='temperature') foreach ($mbinfo_detail->getMbTemp() as $dev) {
- Exclude checks
Line exceeds 120 characters; contains 138 characters Open
$this->_errors->addError("WARN", "This is an unstable version of phpSysInfo, some things may not work correctly");
- Exclude checks
Inline control structures are not allowed Open
if (!$this->_sysinfo->getBlockName() || $this->_sysinfo->getBlockName()==='filesystem') $this->_buildFilesystems();
- Exclude checks
Line exceeds 120 characters; contains 152 characters Open
if (!$this->_sysinfo->getBlockName() || $this->_sysinfo->getBlockName()==='temperature') foreach ($mbinfo_detail->getMbTemp() as $dev) {
- Exclude checks
Inline control structures are not allowed Open
if (!$this->_sysinfo->getBlockName() || $this->_sysinfo->getBlockName()==='fans') foreach ($mbinfo_detail->getMbFan() as $dev) {
- Exclude checks
Line exceeds 120 characters; contains 140 characters Open
$this->_errors->addError("WARN", "Installed version of PHP does not support proc_open() function, popen() is used");
- Exclude checks
Inline control structures are not allowed Open
if (!$this->_sysinfo->getBlockName() || $this->_sysinfo->getBlockName()==='network') $this->_buildNetwork();
- Exclude checks
Inline control structures are not allowed Open
if ($dev->getFsType()!=="") $mount->addAttribute('FSType', $dev->getFsType());
- Exclude checks
Inline control structures are not allowed Open
if (!$this->_sysinfo->getBlockName() || $this->_sysinfo->getBlockName()==='hardware') $this->_buildHardware();
- Exclude checks
Inline control structures are not allowed Open
if (!$this->_sysinfo->getBlockName() || $this->_sysinfo->getBlockName()==='ups') $this->_buildUpsinfo();
- Exclude checks
Inline control structures are not allowed Open
if (!$this->_sysinfo->getBlockName() || $this->_sysinfo->getBlockName()==='current') foreach ($mbinfo_detail->getMbCurrent() as $dev) {
- Exclude checks
Line exceeds 120 characters; contains 151 characters Open
if (!$this->_sysinfo->getBlockName() || $this->_sysinfo->getBlockName()==='current') foreach ($mbinfo_detail->getMbCurrent() as $dev) {
- Exclude checks
Inline control structures are not allowed Open
if (!$this->_sysinfo->getBlockName() || $this->_sysinfo->getBlockName()==='vitals') $this->_buildVitals();
- Exclude checks
Line exceeds 120 characters; contains 147 characters Open
if (!$this->_sysinfo->getBlockName() || $this->_sysinfo->getBlockName()==='power') foreach ($mbinfo_detail->getMbPower() as $dev) {
- Exclude checks
Line exceeds 120 characters; contains 182 characters Open
if (!$this->_sysinfo->getBlockName() || in_array($this->_sysinfo->getBlockName(), array('voltage','current','temperature','fans','power','other'))) $this->_buildMbinfo();
- Exclude checks
Line exceeds 120 characters; contains 123 characters Open
$options->addAttribute('datetimeFormat', defined('PSI_DATETIME_FORMAT') ? strtolower(PSI_DATETIME_FORMAT) : 'utc');
- Exclude checks
Line exceeds 120 characters; contains 144 characters Open
if (!$this->_sysinfo->getBlockName() || $this->_sysinfo->getBlockName()==='fans') foreach ($mbinfo_detail->getMbFan() as $dev) {
- Exclude checks
Inline control structures are not allowed Open
if (!$this->_sysinfo->getBlockName() || $this->_sysinfo->getBlockName()==='other') foreach ($mbinfo_detail->getMbOther() as $dev) {
- Exclude checks
Inline control structures are not allowed Open
if (!$this->_sysinfo->getBlockName() || $this->_sysinfo->getBlockName()==='memory') $this->_buildMemory();
- Exclude checks
Inline control structures are not allowed Open
if ($dev->getIgnore() > 0) $mount->addAttribute('Ignore', $dev->getIgnore());
- Exclude checks
Inline control structures are not allowed Open
if (!$this->_sysinfo->getBlockName() || $this->_sysinfo->getBlockName()==='voltage') foreach ($mbinfo_detail->getMbVolt() as $dev) {
- Exclude checks
The variable $upsinfo_data is not named in camelCase. Open
private function _buildUpsinfo()
{
$upsinfo = $this->_xml->addChild('UPSInfo');
if (defined('PSI_UPS_APCUPSD_CGI_ENABLE') && PSI_UPS_APCUPSD_CGI_ENABLE) {
$upsinfo->addAttribute('ApcupsdCgiLinks', true);
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $mbinfo_detail is not named in camelCase. Open
private function _buildMbinfo()
{
$mbinfo = $this->_xml->addChild('MBInfo');
$temp = $fan = $volt = $power = $current = $other = null;
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $mbinfo_detail is not named in camelCase. Open
private function _buildMbinfo()
{
$mbinfo = $this->_xml->addChild('MBInfo');
$temp = $fan = $volt = $power = $current = $other = null;
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $include_path is not named in camelCase. Open
private function _buildXml()
{
if (!$this->_plugin_request || $this->_complete_request) {
if ($this->_sys === null) {
if (PSI_DEBUG === true) {
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $mbinfo_detail is not named in camelCase. Open
private function _buildMbinfo()
{
$mbinfo = $this->_xml->addChild('MBInfo');
$temp = $fan = $volt = $power = $current = $other = null;
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $mbinfo_detail is not named in camelCase. Open
private function _buildMbinfo()
{
$mbinfo = $this->_xml->addChild('MBInfo');
$temp = $fan = $volt = $power = $current = $other = null;
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $upsinfo_detail is not named in camelCase. Open
private function _buildUpsinfo()
{
$upsinfo = $this->_xml->addChild('UPSInfo');
if (defined('PSI_UPS_APCUPSD_CGI_ENABLE') && PSI_UPS_APCUPSD_CGI_ENABLE) {
$upsinfo->addAttribute('ApcupsdCgiLinks', true);
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $safe_mode is not named in camelCase. Open
private function _buildXml()
{
if (!$this->_plugin_request || $this->_complete_request) {
if ($this->_sys === null) {
if (PSI_DEBUG === true) {
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $include_path is not named in camelCase. Open
private function _buildXml()
{
if (!$this->_plugin_request || $this->_complete_request) {
if ($this->_sys === null) {
if (PSI_DEBUG === true) {
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $mbinfo_data is not named in camelCase. Open
private function _buildMbinfo()
{
$mbinfo = $this->_xml->addChild('MBInfo');
$temp = $fan = $volt = $power = $current = $other = null;
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $safe_mode is not named in camelCase. Open
private function _buildXml()
{
if (!$this->_plugin_request || $this->_complete_request) {
if ($this->_sys === null) {
if (PSI_DEBUG === true) {
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $upsinfo_data is not named in camelCase. Open
private function _buildUpsinfo()
{
$upsinfo = $this->_xml->addChild('UPSInfo');
if (defined('PSI_UPS_APCUPSD_CGI_ENABLE') && PSI_UPS_APCUPSD_CGI_ENABLE) {
$upsinfo->addAttribute('ApcupsdCgiLinks', true);
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $include_path is not named in camelCase. Open
private function _buildXml()
{
if (!$this->_plugin_request || $this->_complete_request) {
if ($this->_sys === null) {
if (PSI_DEBUG === true) {
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $include_path is not named in camelCase. Open
private function _buildXml()
{
if (!$this->_plugin_request || $this->_complete_request) {
if ($this->_sys === null) {
if (PSI_DEBUG === true) {
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $include_path is not named in camelCase. Open
private function _buildXml()
{
if (!$this->_plugin_request || $this->_complete_request) {
if ($this->_sys === null) {
if (PSI_DEBUG === true) {
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $include_path is not named in camelCase. Open
private function _buildXml()
{
if (!$this->_plugin_request || $this->_complete_request) {
if ($this->_sys === null) {
if (PSI_DEBUG === true) {
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $mbinfo_detail is not named in camelCase. Open
private function _buildMbinfo()
{
$mbinfo = $this->_xml->addChild('MBInfo');
$temp = $fan = $volt = $power = $current = $other = null;
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $include_path is not named in camelCase. Open
private function _buildXml()
{
if (!$this->_plugin_request || $this->_complete_request) {
if ($this->_sys === null) {
if (PSI_DEBUG === true) {
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $upsinfo_detail is not named in camelCase. Open
private function _buildUpsinfo()
{
$upsinfo = $this->_xml->addChild('UPSInfo');
if (defined('PSI_UPS_APCUPSD_CGI_ENABLE') && PSI_UPS_APCUPSD_CGI_ENABLE) {
$upsinfo->addAttribute('ApcupsdCgiLinks', true);
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $mbinfo_detail is not named in camelCase. Open
private function _buildMbinfo()
{
$mbinfo = $this->_xml->addChild('MBInfo');
$temp = $fan = $volt = $power = $current = $other = null;
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $mbinfo_data is not named in camelCase. Open
private function _buildMbinfo()
{
$mbinfo = $this->_xml->addChild('MBInfo');
$temp = $fan = $volt = $power = $current = $other = null;
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $mbinfo_detail is not named in camelCase. Open
private function _buildMbinfo()
{
$mbinfo = $this->_xml->addChild('MBInfo');
$temp = $fan = $volt = $power = $current = $other = null;
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $include_path is not named in camelCase. Open
private function _buildXml()
{
if (!$this->_plugin_request || $this->_complete_request) {
if ($this->_sys === null) {
if (PSI_DEBUG === true) {
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The method _buildVitals is not named in camelCase. Open
private function _buildVitals()
{
$vitals = $this->_xml->addChild('Vitals');
$vitals->addAttribute('Hostname', $this->_sys->getHostname());
$vitals->addAttribute('IPAddr', $this->_sys->getIp());
- Read upRead up
- Exclude checks
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 _buildNetwork is not named in camelCase. Open
private function _buildNetwork()
{
$hideDevices = array();
$network = $this->_xml->addChild('Network');
if (defined('PSI_HIDE_NETWORK_INTERFACE')) {
- Read upRead up
- Exclude checks
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 _buildMbinfo is not named in camelCase. Open
private function _buildMbinfo()
{
$mbinfo = $this->_xml->addChild('MBInfo');
$temp = $fan = $volt = $power = $current = $other = null;
- Read upRead up
- Exclude checks
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 _xmlbody is not named in camelCase. Open
private function _xmlbody()
{
$dom = new DOMDocument('1.0', 'UTF-8');
$root = $dom->createElement("tns:phpsysinfo");
$root->setAttribute('xmlns:tns', 'http://phpsysinfo.sourceforge.net/');
- Read upRead up
- Exclude checks
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 _fillDevice is not named in camelCase. Open
private function _fillDevice(SimpleXMLExtended $mount, DiskDevice $dev, $i)
{
$mount->addAttribute('MountPointID', $i);
if ($dev->getFsType()!=="") $mount->addAttribute('FSType', $dev->getFsType());
$mount->addAttribute('Name', $dev->getName());
- Read upRead up
- Exclude checks
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 _buildUpsinfo is not named in camelCase. Open
private function _buildUpsinfo()
{
$upsinfo = $this->_xml->addChild('UPSInfo');
if (defined('PSI_UPS_APCUPSD_CGI_ENABLE') && PSI_UPS_APCUPSD_CGI_ENABLE) {
$upsinfo->addAttribute('ApcupsdCgiLinks', true);
- Read upRead up
- Exclude checks
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 _buildHardware is not named in camelCase. Open
private function _buildHardware()
{
$hardware = $this->_xml->addChild('Hardware');
if ($this->_sys->getMachine() != "") {
$hardware->addAttribute('Name', $this->_sys->getMachine());
- Read upRead up
- Exclude checks
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 _buildXml is not named in camelCase. Open
private function _buildXml()
{
if (!$this->_plugin_request || $this->_complete_request) {
if ($this->_sys === null) {
if (PSI_DEBUG === true) {
- Read upRead up
- Exclude checks
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 _buildPlugins is not named in camelCase. Open
private function _buildPlugins()
{
$pluginroot = $this->_xml->addChild("Plugins");
if (($this->_plugin_request || $this->_complete_request) && count($this->_plugins) > 0) {
$plugins = array();
- Read upRead up
- Exclude checks
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 _buildMemory is not named in camelCase. Open
private function _buildMemory()
{
$memory = $this->_xml->addChild('Memory');
$memory->addAttribute('Free', $this->_sys->getMemFree());
$memory->addAttribute('Used', $this->_sys->getMemUsed());
- Read upRead up
- Exclude checks
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 _buildFilesystems is not named in camelCase. Open
private function _buildFilesystems()
{
$hideMounts = $hideFstypes = $hideDisks = $ignoreFree = $ignoreUsage = $ignoreThreshold = array();
$i = 1;
if (defined('PSI_HIDE_MOUNTS') && is_string(PSI_HIDE_MOUNTS)) {
- Read upRead up
- Exclude checks
CamelCaseMethodName
Since: 0.2
It is considered best practice to use the camelCase notation to name methods.
Example
class ClassName {
public function get_name() {
}
}