Function __set
has a Cognitive Complexity of 78 (exceeds 5 allowed). Consider refactoring. Open
public function __set($strName, $mixValue) {
switch ($strName) {
// APPEARANCE
case "BackColor":
try {
- 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 __set
has 301 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __set($strName, $mixValue) {
switch ($strName) {
// APPEARANCE
case "BackColor":
try {
File QDataGridLegacyColumn.class.php
has 588 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* This file contains the QDataGridEgacyColumn and QFilterType class.
*
* @package Controls
Function GetAttributes
has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring. Open
public function GetAttributes() {
$strToReturn = "";
$strStyle = "";
if (!$this->blnWrap)
- 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 FilterSetOperand
has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring. Open
private function FilterSetOperand($mixOperand) {
try {
if(null === $this->objActiveFilter) {
return;
} elseif($this->objActiveFilter instanceof QQConditionComparison) {
- 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 class QDataGridLegacyColumn has an overall complexity of 186 which is very high. The configured complexity threshold is 50. Open
class QDataGridLegacyColumn extends QBaseClass {
// APPEARANCE
/**
* @var null|string Background colour of an element of this column
* null = not specified in rendered HTML (browser or another CSS rule can determine value)
- Exclude checks
Method GetAttributes
has 76 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function GetAttributes() {
$strToReturn = "";
$strStyle = "";
if (!$this->blnWrap)
Function GetActiveFilterValue
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
public function GetActiveFilterValue() {
$value = null;
//for manual queries
if (isset($this->FilterByCommand['value']))
$value = $this->FilterByCommand['value'];
- 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 __get
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __get($strName) {
switch ($strName) {
// APPEARANCE
case "BackColor": return $this->strBackColor;
case "BorderColor": return $this->strBorderColor;
The class QDataGridLegacyColumn has 32 fields. Consider redesigning QDataGridLegacyColumn to keep the number of fields under 15. Open
class QDataGridLegacyColumn extends QBaseClass {
// APPEARANCE
/**
* @var null|string Background colour of an element of this column
* null = not specified in rendered HTML (browser or another CSS rule can determine value)
- 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
Function SetActiveFilterState
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function SetActiveFilterState($mixFilterValue) {
//deal with any manual filters
if ($this->FilterByCommand !== null) {
//update the column's filterByCommand with the user-entered value
$filter = $this->FilterByCommand;
- 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 FilterSetOperand
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function FilterSetOperand($mixOperand) {
try {
if(null === $this->objActiveFilter) {
return;
} elseif($this->objActiveFilter instanceof QQConditionComparison) {
Avoid too many return
statements within this method. Open
case "HorizontalAlign": return $this->strHorizontalAlign;
Avoid too many return
statements within this method. Open
case "FontUnderline": return $this->blnFontUnderline;
Avoid too many return
statements within this method. Open
case "FontSize": return $this->strFontSize;
Avoid too many return
statements within this method. Open
case "FontStrikeout": return $this->blnFontStrikeout;
Avoid too many return
statements within this method. Open
case "FontBold": return $this->blnFontBold;
Avoid too many return
statements within this method. Open
case "CssClass": return $this->strCssClass;
Avoid too many return
statements within this method. Open
case "FontOverline": return $this->blnFontOverline;
Avoid too many return
statements within this method. Open
return null;
Avoid too many return
statements within this method. Open
case "Html": return $this->strHtml;
Avoid too many return
statements within this method. Open
case "ActiveFilter": return $this->objActiveFilter;
Avoid too many return
statements within this method. Open
case "Wrap": return $this->blnWrap;
Avoid too many return
statements within this method. Open
case "VerticalAlign": return $this->strVerticalAlign;
Avoid too many return
statements within this method. Open
case "FilterColId": return $this->intFilterColId;
Avoid too many return
statements within this method. Open
case "FilterConstant": return $this->objFilterConstant;
Avoid too many return
statements within this method. Open
return $filterCommand;
Avoid too many return
statements within this method. Open
case "Name": return $this->strName;
Avoid too many return
statements within this method. Open
case "HasResetButton": return $this->blnHasResetButton;
Avoid too many return
statements within this method. Open
case "ForeColor": return $this->strForeColor;
Avoid too many return
statements within this method. Open
case "FontItalic": return $this->blnFontItalic;
Avoid too many return
statements within this method. Open
case "FontNames": return $this->strFontNames;
Avoid too many return
statements within this method. Open
return parent::__get($strName);
Avoid too many return
statements within this method. Open
case "ReverseOrderByClause": return $this->objReverseOrderByClause;
Avoid too many return
statements within this method. Open
case "FilterByCommand": return $this->arrFilterByCommand;
Avoid too many return
statements within this method. Open
case "FilterPrefix": return $this->strFilterPrefix;
Avoid too many return
statements within this method. Open
case "HtmlEntities": return $this->blnHtmlEntities;
Avoid too many return
statements within this method. Open
case "SortByCommand": return $this->objOrderByClause;
Avoid too many return
statements within this method. Open
case "FilterBoxSize": return $this->intFilterBoxSize;
Avoid too many return
statements within this method. Open
case "FilterType": return $this->strFilterType;
Avoid too many return
statements within this method. Open
case "FilterPostfix": return $this->strFilterPostfix;
Avoid too many return
statements within this method. Open
case "ReverseSortByCommand": return $this->objReverseOrderByClause;
Avoid too many return
statements within this method. Open
case "FilterList": return $this->arrFilterList;
Avoid too many return
statements within this method. Open
case "Width": return $this->strWidth;
Avoid too many return
statements within this method. Open
case "OrderByClause": return $this->objOrderByClause;
The method GetAttributes() has an NPath complexity of 10616832. The configured NPath complexity threshold is 200. Open
public function GetAttributes() {
$strToReturn = "";
$strStyle = "";
if (!$this->blnWrap)
- 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 __set() has 325 lines of code. Current threshold is set to 100. Avoid really long methods. Open
public function __set($strName, $mixValue) {
switch ($strName) {
// APPEARANCE
case "BackColor":
try {
- Exclude checks
The method GetActiveFilterValue() has a Cyclomatic Complexity of 12. The configured cyclomatic complexity threshold is 10. Open
public function GetActiveFilterValue() {
$value = null;
//for manual queries
if (isset($this->FilterByCommand['value']))
$value = $this->FilterByCommand['value'];
- 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 FilterSetOperand() has a Cyclomatic Complexity of 10. The configured cyclomatic complexity threshold is 10. Open
private function FilterSetOperand($mixOperand) {
try {
if(null === $this->objActiveFilter) {
return;
} elseif($this->objActiveFilter instanceof QQConditionComparison) {
- 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 __set() has a Cyclomatic Complexity of 75. The configured cyclomatic complexity threshold is 10. Open
public function __set($strName, $mixValue) {
switch ($strName) {
// APPEARANCE
case "BackColor":
try {
- 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 GetAttributes() has a Cyclomatic Complexity of 30. The configured cyclomatic complexity threshold is 10. Open
public function GetAttributes() {
$strToReturn = "";
$strStyle = "";
if (!$this->blnWrap)
- 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 __get() has a Cyclomatic Complexity of 38. The configured cyclomatic complexity threshold is 10. Open
public function __get($strName) {
switch ($strName) {
// APPEARANCE
case "BackColor": return $this->strBackColor;
case "BorderColor": return $this->strBorderColor;
- 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 class QDataGridLegacyColumn has a coupling between objects value of 15. Consider to reduce the number of dependencies under 13. Open
class QDataGridLegacyColumn extends QBaseClass {
// APPEARANCE
/**
* @var null|string Background colour of an element of this column
* null = not specified in rendered HTML (browser or another CSS rule can determine value)
- Read upRead up
- Exclude checks
CouplingBetweenObjects
Since: 1.1.0
A class with too many dependencies has negative impacts on several quality aspects of a class. This includes quality criteria like stability, maintainability and understandability
Example
class Foo {
/**
* @var \foo\bar\X
*/
private $x = null;
/**
* @var \foo\bar\Y
*/
private $y = null;
/**
* @var \foo\bar\Z
*/
private $z = null;
public function setFoo(\Foo $foo) {}
public function setBar(\Bar $bar) {}
public function setBaz(\Baz $baz) {}
/**
* @return \SplObjectStorage
* @throws \OutOfRangeException
* @throws \InvalidArgumentException
* @throws \ErrorException
*/
public function process(\Iterator $it) {}
// ...
}
Source https://phpmd.org/rules/design.html#couplingbetweenobjects
Missing class import via use statement (line '421', column '17'). Open
throw new QInvalidCastException('Comparison operand cannot be a QQClause', 3);
- 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
Missing class import via use statement (line '424', column '18'). Open
throw new QInvalidCastException('Unable to cast "' . $mixOperand->_Name . '" table to Column-based QQNode', 3);
- 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
Missing class import via use statement (line '419', column '17'). Open
throw new QInvalidCastException('Comparison operand cannot be a QQCondition', 3);
- 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
Missing class import via use statement (line '329', column '15'). Open
throw new Exception("Please specify a name and QQCondition pair OR a name and value pair as parameters.");
- 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
Missing class import via use statement (line '417', column '17'). Open
throw new QInvalidCastException('Comparison operand cannot be an Association-based QQNode', 3);
- 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
Missing class import via use statement (line '432', column '16'). Open
throw new Exception('Trying to set Operand on a filter that does not take operands');
- 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 'QType' in method '__set'. Open
$this->strVerticalAlign = QType::Cast($mixValue, QType::String);
- 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 'QType' in method '__set'. Open
$this->strBorderWidth = QType::Cast($mixValue, QType::String);
- 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 'QType' in method '__set'. Open
$this->strFilterPrefix = QType::Cast($mixValue, QType::String);
- 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 'QType' in method '__set'. Open
$this->blnFontItalic = QType::Cast($mixValue, QType::Boolean);
- 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 'QType' in method '__set'. Open
$this->blnFontOverline = QType::Cast($mixValue, QType::Boolean);
- 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 'QType' in method '__set'. Open
$arr = QType::Cast($mixValue, QType::ArrayType);
- 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 'QType' in method '__set'. Open
$this->strCssClass = QType::Cast($mixValue, QType::String);
- 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 'QType' in method '__set'. Open
$this->blnFontUnderline = QType::Cast($mixValue, QType::Boolean);
- 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 'QType' in method '__set'. Open
$this->strWidth = QType::Cast($mixValue, QType::String);
- 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 'QType' in method '__set'. Open
$this->blnHtmlEntities = QType::Cast($mixValue, QType::Boolean);
- 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 'QType' in method '__set'. Open
$this->strBorderStyle = QType::Cast($mixValue, QType::String);
- 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 'QType' in method '__set'. Open
$this->strFilterPostfix = QType::Cast($mixValue, QType::String);
- 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 'QType' in method '__set'. Open
$this->strName = QType::Cast($mixValue, QType::String);
- 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 'QType' in method '__set'. Open
$this->strForeColor = QType::Cast($mixValue, QType::String);
- 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 FilterAddListItem uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
//else fail the function and let the user know about correct use of parameters
throw new Exception("Please specify a name and QQCondition pair OR a name and value pair as parameters.");
}
- 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 'QType' in method '__set'. Open
$this->blnWrap = QType::Cast($mixValue, QType::Boolean);
- 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 'QType' in method '__set'. Open
$this->objOrderByClause = QType::Cast($mixValue, QType::String);
- 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 'QType' in method '__set'. Open
$this->strFontSize = QType::Cast($mixValue, QType::String);
- 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 'QType' in method '__set'. Open
$this->intFilterBoxSize = QType::Cast($mixValue, QType::Integer);
- 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 'QType' in method '__set'. Open
$this->objReverseOrderByClause = QType::Cast($mixValue, QType::String);
- 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 SetActiveFilterState uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$this->ClearFilter();
}
- 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 'QType' in method '__set'. Open
$this->objReverseOrderByClause = QType::Cast($mixValue, 'QQOrderBy');
- 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 'QType' in method '__set'. Open
$this->blnFontBold = QType::Cast($mixValue, QType::Boolean);
- 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 'QType' in method '__set'. Open
$this->strFilterType= QType::Cast($mixValue, QType::String);
- 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 FilterSetOperand uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
//must be a string, apply the pre and postfix (This also handles custom filters)
$mixOperand = $this->strFilterPrefix . $mixOperand . $this->strFilterPostfix;
$this->objActiveFilter->mixOperand = $mixOperand;
}
- 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 FilterSetOperand uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
throw new Exception('Trying to set Operand on a filter that does not take operands');
}
- 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 'QType' in method '__set'. Open
$this->strBorderColor = QType::Cast($mixValue, QType::String);
- 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 'QType' in method '__set'. Open
$this->strFontNames = QType::Cast($mixValue, QType::String);
- 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 'QType' in method '__set'. Open
$this->intFilterColId = QType::Cast($mixValue, QType::Integer);
- 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 'QType' in method '__set'. Open
$this->strBackColor = QType::Cast($mixValue, QType::String);
- 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 'QType' in method '__set'. Open
$this->blnFontStrikeout = QType::Cast($mixValue, QType::Boolean);
- 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 'QType' in method '__set'. Open
$this->objOrderByClause = QType::Cast($mixValue, 'QQOrderBy');
- 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 'QType' in method '__set'. Open
$this->arrFilterList = QType::Cast($mixValue, QType::ArrayType);
- 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 'QType' in method '__set'. Open
$this->strHtml = QType::Cast($mixValue, QType::String);
- 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 'QType' in method '__set'. Open
$this->blnHasResetButton = QType::Cast($mixValue, QType::Boolean);
- 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 'QType' in method '__set'. Open
$this->strHorizontalAlign = QType::Cast($mixValue, QType::String);
- 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 excessively long variable names like $objOverrideParameters. Keep variable name length under 20. Open
public function __construct($strName, $strHtml = null, $objOverrideParameters = 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 $objReverseOrderByClause. Keep variable name length under 20. Open
protected $objReverseOrderByClause = 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
Constant None should be defined in uppercase Open
const None = '';
- Read upRead up
- Exclude checks
ConstantNamingConventions
Since: 0.2
Class/Interface constant names should always be defined in uppercase.
Example
class Foo {
const MY_NUM = 0; // ok
const myTest = ""; // fail
}
Source https://phpmd.org/rules/naming.html#constantnamingconventions
Constant TextFilter should be defined in uppercase Open
const TextFilter = 'Text';
- Read upRead up
- Exclude checks
ConstantNamingConventions
Since: 0.2
Class/Interface constant names should always be defined in uppercase.
Example
class Foo {
const MY_NUM = 0; // ok
const myTest = ""; // fail
}
Source https://phpmd.org/rules/naming.html#constantnamingconventions
Constant ListFilter should be defined in uppercase Open
const ListFilter = 'List';
- Read upRead up
- Exclude checks
ConstantNamingConventions
Since: 0.2
Class/Interface constant names should always be defined in uppercase.
Example
class Foo {
const MY_NUM = 0; // ok
const myTest = ""; // fail
}
Source https://phpmd.org/rules/naming.html#constantnamingconventions
The method FilterSetOperand is not named in camelCase. Open
private function FilterSetOperand($mixOperand) {
try {
if(null === $this->objActiveFilter) {
return;
} elseif($this->objActiveFilter instanceof QQConditionComparison) {
- 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 HasFilter is not named in camelCase. Open
public function HasFilter() {
return $this->ActiveFilter !== null || $this->FilterByCommand !== null || $this->FilterType != QFilterType::None;
}
- 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 SetActiveFilterState is not named in camelCase. Open
public function SetActiveFilterState($mixFilterValue) {
//deal with any manual filters
if ($this->FilterByCommand !== null) {
//update the column's filterByCommand with the user-entered value
$filter = $this->FilterByCommand;
- 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 ClearFilter is not named in camelCase. Open
public function ClearFilter() {
$this->objActiveFilter = null;
if($this->arrFilterByCommand !== null)
$this->arrFilterByCommand['value'] = 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 FilterAddListItem is not named in camelCase. Open
public function FilterAddListItem($arg1=null, $arg2=null) {
if($this->arrFilterList === null) {
$this->arrFilterList = array();
}
if($arg1 !== null && $arg2 instanceof QQCondition) {
- 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 GetActiveFilterState is not named in camelCase. Open
public function GetActiveFilterState() {
return $this->GetActiveFilterValue();
}
- 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 GetAttributes is not named in camelCase. Open
public function GetAttributes() {
$strToReturn = "";
$strStyle = "";
if (!$this->blnWrap)
- 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 GetActiveFilterValue is not named in camelCase. Open
public function GetActiveFilterValue() {
$value = null;
//for manual queries
if (isset($this->FilterByCommand['value']))
$value = $this->FilterByCommand['value'];
- 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() {
}
}