The method getPercentUsed uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
return 0;
}
- 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
Each class must be in a namespace of at least one level (a top-level vendor name) Open
class DiskDevice
- Exclude checks
The property $_mountPoint is not named in camelCase. Open
class DiskDevice
{
/**
* name of the disk device
*
- 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 $_name is not named in camelCase. Open
class DiskDevice
{
/**
* name of the disk device
*
- 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 $_used is not named in camelCase. Open
class DiskDevice
{
/**
* name of the disk device
*
- 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 $_percentInodesUsed is not named in camelCase. Open
class DiskDevice
{
/**
* name of the disk device
*
- 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 $_free is not named in camelCase. Open
class DiskDevice
{
/**
* name of the disk device
*
- 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 $_ignore is not named in camelCase. Open
class DiskDevice
{
/**
* name of the disk device
*
- 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 $_fsType is not named in camelCase. Open
class DiskDevice
{
/**
* name of the disk device
*
- 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 $_total is not named in camelCase. Open
class DiskDevice
{
/**
* name of the disk device
*
- 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 $_options is not named in camelCase. Open
class DiskDevice
{
/**
* name of the disk device
*
- 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
Property name "$_free" should not be prefixed with an underscore to indicate visibility Open
private $_free = 0;
- Exclude checks
Property name "$_fsType" should not be prefixed with an underscore to indicate visibility Open
private $_fsType = "";
- Exclude checks
Property name "$_options" should not be prefixed with an underscore to indicate visibility Open
private $_options = null;
- Exclude checks
Property name "$_ignore" should not be prefixed with an underscore to indicate visibility Open
private $_ignore = 0;
- Exclude checks
Property name "$_mountPoint" should not be prefixed with an underscore to indicate visibility Open
private $_mountPoint = null;
- Exclude checks
Property name "$_total" should not be prefixed with an underscore to indicate visibility Open
private $_total = 0;
- Exclude checks
Property name "$_name" should not be prefixed with an underscore to indicate visibility Open
private $_name = "";
- Exclude checks
Property name "$_percentInodesUsed" should not be prefixed with an underscore to indicate visibility Open
private $_percentInodesUsed = null;
- Exclude checks
Property name "$_used" should not be prefixed with an underscore to indicate visibility Open
private $_used = 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
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