The class Ticks has 22 fields. Consider redesigning Ticks to keep the number of fields under 15. Open
class Ticks
{
public $label_formatstr = ''; // C-style format string to use for labels
public $label_formfunc = '';
public $label_dateformatstr = '';
- Read upRead up
- Exclude checks
TooManyFields
Since: 0.1
Classes that have too many fields could be redesigned to have fewer fields, possibly through some nested object grouping of some of the information. For example, a class with city/state/zip fields could instead have one Address field.
Example
class Person {
protected $one;
private $two;
private $three;
[... many more fields ...]
}
Source https://phpmd.org/rules/codesize.html#toomanyfields
The method SupressMinorTickMarks has a boolean flag argument $aHide, which is a certain sign of a Single Responsibility Principle violation. Open
public function SupressMinorTickMarks($aHide = true)
- 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
The method SupressFirst has a boolean flag argument $aHide, which is a certain sign of a Single Responsibility Principle violation. Open
public function SupressFirst($aHide = true)
- 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
The method SetLabelFormat has a boolean flag argument $aDate, which is a certain sign of a Single Responsibility Principle violation. Open
public function SetLabelFormat($aFormatString, $aDate = 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
The method SupressLast has a boolean flag argument $aHide, which is a certain sign of a Single Responsibility Principle violation. Open
public function SupressLast($aHide = true)
- 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
The method SupressZeroLabel has a boolean flag argument $aFlag, which is a certain sign of a Single Responsibility Principle violation. Open
public function SupressZeroLabel($aFlag = true)
- 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
The method SupressTickMarks has a boolean flag argument $aHide, which is a certain sign of a Single Responsibility Principle violation. Open
public function SupressTickMarks($aHide = true)
- 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
The method SetColor uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$this->mincolor = $aMinorColor;
}
- 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 excessively long variable names like $supress_minor_tickmarks. Keep variable name length under 20. Open
public $supress_minor_tickmarks = false;
- Read upRead up
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Method name "Ticks::SetSide" is not in camel caps format Open
public function SetSide($aSide)
- Exclude checks
Method name "Ticks::SetSize" is not in camel caps format Open
public function SetSize($aMajSize, $aMinSize = 3)
- Exclude checks
Method name "Ticks::GetMajTickAbsSize" is not in camel caps format Open
public function GetMajTickAbsSize()
- Exclude checks
Method name "Ticks::IsSpecified" is not in camel caps format Open
public function IsSpecified()
- Exclude checks
Method name "Ticks::SetMarkColor" is not in camel caps format Open
public function SetMarkColor($aMajorColor, $aMinorColor = '')
- Exclude checks
Method name "Ticks::SetLabelFormat" is not in camel caps format Open
public function SetLabelFormat($aFormatString, $aDate = false)
- Exclude checks
Method name "Ticks::SupressTickMarks" is not in camel caps format Open
public function SupressTickMarks($aHide = true)
- Exclude checks
Method name "Ticks::SetWeight" is not in camel caps format Open
public function SetWeight($aWeight)
- Exclude checks
Method name "Ticks::SupressMinorTickMarks" is not in camel caps format Open
public function SupressMinorTickMarks($aHide = true)
- Exclude checks
Method name "Ticks::SupressFirst" is not in camel caps format Open
public function SupressFirst($aHide = true)
- Exclude checks
Method name "Ticks::SupressZeroLabel" is not in camel caps format Open
public function SupressZeroLabel($aFlag = true)
- Exclude checks
Method name "Ticks::SetDirection" is not in camel caps format Open
public function SetDirection($aSide = SIDE_RIGHT)
- Exclude checks
Method name "Ticks::SetLabelDateFormat" is not in camel caps format Open
public function SetLabelDateFormat($aFormatString)
- Exclude checks
Method name "Ticks::SetFormatCallback" is not in camel caps format Open
public function SetFormatCallback($aCallbackFuncName)
- Exclude checks
Method name "Ticks::SupressLast" is not in camel caps format Open
public function SupressLast($aHide = true)
- Exclude checks
Method name "Ticks::GetMinTickAbsSize" is not in camel caps format Open
public function GetMinTickAbsSize()
- Exclude checks
Method name "Ticks::SetColor" is not in camel caps format Open
public function SetColor($aMajorColor, $aMinorColor = '')
- Exclude checks