src/graph/HeaderProperty.php
The class HeaderProperty has 16 fields. Consider redesigning HeaderProperty to keep the number of fields under 15. Open
Open
class HeaderProperty
{
public $grid;
public $iShowLabels = true;
public $iShowGrid = true;
- 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 Show has a boolean flag argument $aShow, which is a certain sign of a Single Responsibility Principle violation. Open
Open
public function Show($aShow = 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
Avoid excessively long variable names like $iWeekendBackgroundColor. Keep variable name length under 20. Open
Open
public $iWeekendBackgroundColor = 'lightgray';
- 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 "HeaderProperty::SetWeekendColor" is not in camel caps format Open
Open
public function SetWeekendColor($aColor)
- Exclude checks
Method name "HeaderProperty::SetFormatString" is not in camel caps format Open
Open
public function SetFormatString($aStr)
- Exclude checks
Method name "HeaderProperty::GetFontHeight" is not in camel caps format Open
Open
public function GetFontHeight($aImg)
- Exclude checks
Method name "HeaderProperty::SetStyle" is not in camel caps format Open
Open
public function SetStyle($aStyle)
- Exclude checks
Method name "HeaderProperty::SetFrameColor" is not in camel caps format Open
Open
public function SetFrameColor($aColor)
- Exclude checks
Method name "HeaderProperty::GetFontWidth" is not in camel caps format Open
Open
public function GetFontWidth($aImg)
- Exclude checks
Method name "HeaderProperty::SetFont" is not in camel caps format Open
Open
public function SetFont($aFFamily, $aFStyle = FS_NORMAL, $aFSize = 10)
- Exclude checks
Method name "HeaderProperty::GetStrWidth" is not in camel caps format Open
Open
public function GetStrWidth($aImg, $aStr)
- Exclude checks
Method name "HeaderProperty::Show" is not in camel caps format Open
Open
public function Show($aShow = true)
- Exclude checks
Method name "HeaderProperty::SetLabelFormatString" is not in camel caps format Open
Open
public function SetLabelFormatString($aStr)
- Exclude checks
Method name "HeaderProperty::GetIntervall" is not in camel caps format Open
Open
public function GetIntervall()
- Exclude checks
Method name "HeaderProperty::SetFrameWeight" is not in camel caps format Open
Open
public function SetFrameWeight($aWeight)
- Exclude checks
Method name "HeaderProperty::SetFontColor" is not in camel caps format Open
Open
public function SetFontColor($aColor)
- Exclude checks
Method name "HeaderProperty::SetBackgroundColor" is not in camel caps format Open
Open
public function SetBackgroundColor($aColor)
- Exclude checks
Method name "HeaderProperty::SetTitleVertMargin" is not in camel caps format Open
Open
public function SetTitleVertMargin($aMargin)
- Exclude checks
Method name "HeaderProperty::SetIntervall" is not in camel caps format Open
Open
public function SetIntervall($aInt)
- Exclude checks
Method name "HeaderProperty::SetInterval" is not in camel caps format Open
Open
public function SetInterval($aInt)
- Exclude checks
Method name "HeaderProperty::SetSundayFontColor" is not in camel caps format Open
Open
public function SetSundayFontColor($aColor)
- Exclude checks