Showing 2,233 of 2,233 total issues
Avoid excessively long variable names like $chunkActionAppendsPageNumber. Keep variable name length under 20. Open
protected $chunkActionAppendsPageNumber = null;
- 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
Avoid excessively long variable names like $scriptActionParameters. Keep variable name length under 20. Open
public function setScriptAction($scriptAction, array $scriptActionParameters = null)
- 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 prepare
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function prepare(Script $script)
{
$hoverControlId = Builder::escapeText($this->hoverControl->getId());
$tooltipControlId = Builder::escapeText($this->tooltipControl->getId());
Method render
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function render(\DOMDocument $domDocument)
{
$domElement = $domDocument->createElement("style");
if (!empty($this->styleIds)) {
$domElement->setAttribute("id", implode(" ", $this->styleIds));
The class Quad has 24 fields. Consider redesigning Quad to keep the number of fields under 15. Open
class Quad extends Control implements Actionable, BackgroundColorable, BgColorable, Imageable, Linkable, Scriptable, Styleable, SubStyleable
{
/*
* Constants
- 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 class Label has 24 fields. Consider redesigning Label to keep the number of fields under 15. Open
class Label extends Control implements Actionable, Linkable, NewLineable, MultiLineable, Scriptable, Styleable, TextFormatable
{
/**
* @var string $text Text
- 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 class Control has 16 fields. Consider redesigning Control to keep the number of fields under 15. Open
abstract class Control implements Identifiable, Renderable, ScriptFeatureable
{
/*
* Constants
- 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 class TextEdit has 16 fields. Consider redesigning TextEdit to keep the number of fields under 15. Open
class TextEdit extends Control implements MultiLineable, Scriptable, Styleable, TextFormatable
{
/*
* Constants
- 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
Method getMainFunction
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function getMainFunction()
{
$mainFunction = '
Void FML_Dummy() {}
main() {
Method render
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function render(\DOMDocument $domDocument)
{
$style3dXml = $domDocument->createElement("style3d");
$this->checkId();
if ($this->styleId) {
Function render
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function render(\DOMDocument $domDocument)
{
$domElement = $domDocument->createElement("style");
if (!empty($this->styleIds)) {
$domElement->setAttribute("id", implode(" ", $this->styleIds));
- 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 getKeyPressScriptText
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function getKeyPressScriptText()
{
$scriptText = null;
$keyProperty = null;
$keyValue = null;
Function render
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function render(\DOMDocument $domDocument)
{
$style3dXml = $domDocument->createElement("style3d");
$this->checkId();
if ($this->styleId) {
- 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 render
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function render(\DOMDocument $domDocument)
{
$domElement = parent::render($domDocument);
if ($this->data) {
$domElement->setAttribute("data", $this->data);
Method getScriptText
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function getScriptText()
{
$graphId = Builder::escapeText($this->graph->getId(), false);
$scriptText = "
declare Graph <=> (Page.GetFirstChild(\"{$graphId}\") as CMlGraph);
Method render
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function render(\DOMDocument $domDocument)
{
$domElement = parent::render($domDocument);
if ($this->data) {
$domElement->setAttribute("data", $this->data);
The class TMUIProperties has 50 public methods and attributes. Consider reducing the number of public items to less than 45. Open
class TMUIProperties extends UIProperties
{
/**
* @var array $liveInfoProperties Live info properties
- Read upRead up
- Exclude checks
ExcessivePublicCount
Since: 0.1
A large number of public methods and attributes declared in a class can indicate the class may need to be broken up as increased effort will be required to thoroughly test it.
Example
public class Foo {
public $value;
public $something;
public $var;
// [... more more public attributes ...]
public function doWork() {}
public function doMoreWork() {}
public function doWorkAgain() {}
// [... more more public methods ...]
}
Source https://phpmd.org/rules/codesize.html#excessivepubliccount
The class Label has 52 public methods and attributes. Consider reducing the number of public items to less than 45. Open
class Label extends Control implements Actionable, Linkable, NewLineable, MultiLineable, Scriptable, Styleable, TextFormatable
{
/**
* @var string $text Text
- Read upRead up
- Exclude checks
ExcessivePublicCount
Since: 0.1
A large number of public methods and attributes declared in a class can indicate the class may need to be broken up as increased effort will be required to thoroughly test it.
Example
public class Foo {
public $value;
public $something;
public $var;
// [... more more public attributes ...]
public function doWork() {}
public function doMoreWork() {}
public function doWorkAgain() {}
// [... more more public methods ...]
}
Source https://phpmd.org/rules/codesize.html#excessivepubliccount
The class Control has 68 public methods and attributes. Consider reducing the number of public items to less than 45. Open
abstract class Control implements Identifiable, Renderable, ScriptFeatureable
{
/*
* Constants
- Read upRead up
- Exclude checks
ExcessivePublicCount
Since: 0.1
A large number of public methods and attributes declared in a class can indicate the class may need to be broken up as increased effort will be required to thoroughly test it.
Example
public class Foo {
public $value;
public $something;
public $var;
// [... more more public attributes ...]
public function doWork() {}
public function doMoreWork() {}
public function doWorkAgain() {}
// [... more more public methods ...]
}
Source https://phpmd.org/rules/codesize.html#excessivepubliccount
The class Quad has 56 public methods and attributes. Consider reducing the number of public items to less than 45. Open
class Quad extends Control implements Actionable, BackgroundColorable, BgColorable, Imageable, Linkable, Scriptable, Styleable, SubStyleable
{
/*
* Constants
- Read upRead up
- Exclude checks
ExcessivePublicCount
Since: 0.1
A large number of public methods and attributes declared in a class can indicate the class may need to be broken up as increased effort will be required to thoroughly test it.
Example
public class Foo {
public $value;
public $something;
public $var;
// [... more more public attributes ...]
public function doWork() {}
public function doMoreWork() {}
public function doWorkAgain() {}
// [... more more public methods ...]
}