ParsePostData accesses the super-global variable $_POST. Open
public function ParsePostData() {
if (array_key_exists($this->strControlId, $_POST)) {
if (is_array($_POST[$this->strControlId])) {
// Multi-Select, so find them all.
$this->SetSelectedItemsById($_POST[$this->strControlId], false);
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
ParsePostData accesses the super-global variable $_POST. Open
public function ParsePostData() {
if (array_key_exists($this->strControlId, $_POST)) {
if (is_array($_POST[$this->strControlId])) {
// Multi-Select, so find them all.
$this->SetSelectedItemsById($_POST[$this->strControlId], false);
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
ParsePostData accesses the super-global variable $_POST. Open
public function ParsePostData() {
if (array_key_exists($this->strControlId, $_POST)) {
if (is_array($_POST[$this->strControlId])) {
// Multi-Select, so find them all.
$this->SetSelectedItemsById($_POST[$this->strControlId], false);
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
ParsePostData accesses the super-global variable $_POST. Open
public function ParsePostData() {
if (array_key_exists($this->strControlId, $_POST)) {
if (is_array($_POST[$this->strControlId])) {
// Multi-Select, so find them all.
$this->SetSelectedItemsById($_POST[$this->strControlId], false);
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
ParsePostData accesses the super-global variable $_POST. Open
public function ParsePostData() {
if (array_key_exists($this->strControlId, $_POST)) {
if (is_array($_POST[$this->strControlId])) {
// Multi-Select, so find them all.
$this->SetSelectedItemsById($_POST[$this->strControlId], false);
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
The class QListBoxBase has an overall complexity of 60 which is very high. The configured complexity threshold is 50. Open
abstract class QListBoxBase extends QListControl {
///////////////////////////
// Private Member Variables
///////////////////////////
- Exclude checks
Function RenderInnerHtml
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
protected function RenderInnerHtml() {
$strHtml = '';
$intItemCount = $this->GetItemCount();
if (!$intItemCount) return '';
$groups = array();
- 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 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __set($strName, $mixValue) {
switch ($strName) {
// APPEARANCE
case "Rows":
try {
Function Validate
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function Validate() {
if ($this->blnRequired) {
if ($this->SelectedIndex == -1) {
if ($this->strName)
$this->ValidationError = sprintf($this->strLabelForRequired, $this->strName);
- 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 __set
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function __set($strName, $mixValue) {
switch ($strName) {
// APPEARANCE
case "Rows":
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 RenderInnerHtml
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function RenderInnerHtml() {
$strHtml = '';
$intItemCount = $this->GetItemCount();
if (!$intItemCount) return '';
$groups = array();
Function ParsePostData
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function ParsePostData() {
if (array_key_exists($this->strControlId, $_POST)) {
if (is_array($_POST[$this->strControlId])) {
// Multi-Select, so find them all.
$this->SetSelectedItemsById($_POST[$this->strControlId], false);
- 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
Avoid too many return
statements within this method. Open
return parent::__get($strName);
Function GetControlHtml
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function GetControlHtml() {
// If no selection is specified, we select the first item, because once we draw this, that is what the browser
// will consider selected on the screen.
// We need to make sure that what we draw is mirrored in our current state
if ($this->SelectionMode == QSelectionMode::Single &&
- 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 method __set() has a Cyclomatic Complexity of 11. The configured cyclomatic complexity threshold is 10. Open
public function __set($strName, $mixValue) {
switch ($strName) {
// APPEARANCE
case "Rows":
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
Avoid using undefined variables such as '$attrOverride' which will lead to PHP notices. Open
$attrOverride['name'] = $this->strControlId;
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$attrOverride' which will lead to PHP notices. Open
$attrOverride['name'] = $this->strControlId . "[]";
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$attrOverride' which will lead to PHP notices. Open
$strToReturn = $this->RenderTag('select', $attrOverride, null, $this->RenderInnerHtml());
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Missing class import via use statement (line '325', column '9'). Open
new QModelConnectorParam (get_called_class(), 'SelectionMode', 'Single or multiple selections', QModelConnectorParam::SelectionList,
- 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 '81', column '22'). Open
$objStyler = new QListItemStyle();
- 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 '324', column '9'). Open
new QModelConnectorParam (get_called_class(), 'Rows', 'Height of field for multirow field', QType::Integer),
- 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 '44', column '30'). Open
$this->objItemStyle = new QListItemStyle();
- 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->strLabelForRequiredUnnamed = 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 'QApplication' in method '__construct'. Open
$this->strLabelForRequiredUnnamed = QApplication::Translate('Required');
- 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 ParsePostData uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
// Multiselect forms with nothing passed via $_POST means that everything was DE selected
if ($this->SelectionMode == QSelectionMode::Multiple) {
$this->UnselectAllItems(false);
}
- 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 GetControlHtml uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$attrOverride['name'] = $this->strControlId;
}
- 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 'QApplication' in method '__construct'. Open
$this->strLabelForRequired = QApplication::Translate('%s is required');
- 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 ParsePostData uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
else {
// Single-select
$this->SetSelectedItemsById(array($_POST[$this->strControlId]), false);
}
- 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 GetItemHtml uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$objStyler = new QListItemStyle();
}
- 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 'QHtml' in method 'RenderInnerHtml'. Open
$strHtml .= QHtml::RenderTag('optgroup', ['label' => QApplication::HtmlEntities($strGroup)], $strGroupHtml);
- 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 assigning values to variables in if clauses and the like (line '141', column '9'). Open
protected function RenderInnerHtml() {
$strHtml = '';
$intItemCount = $this->GetItemCount();
if (!$intItemCount) return '';
$groups = array();
- Read upRead up
- Exclude checks
IfStatementAssignment
Since: 2.7.0
Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.
Example
class Foo
{
public function bar($flag)
{
if ($foo = 'bar') { // possible typo
// ...
}
if ($baz = 0) { // always false
// ...
}
}
}
Source http://phpmd.org/rules/cleancode.html#ifstatementassignment
The method RenderInnerHtml uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$groups[''][] = $objItem;
}
- 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 'QApplication' in method 'RenderInnerHtml'. Open
$strHtml .= QHtml::RenderTag('optgroup', ['label' => QApplication::HtmlEntities($strGroup)], $strGroupHtml);
- 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->SetHtmlAttribute('size', 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 'QApplication' in method 'GetItemHtml'. Open
$strHtml = QHtml::RenderTag('option', $objStyler->RenderHtmlAttributes(), QApplication::HtmlEntities($objItem->Name), false, true) . _nl();
- 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->strLabelForRequired = 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 __set uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$this->RemoveHtmlAttribute('multiple');
}
- 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 'QHtml' in method 'GetItemHtml'. Open
$strHtml = QHtml::RenderTag('option', $objStyler->RenderHtmlAttributes(), QApplication::HtmlEntities($objItem->Name), false, true) . _nl();
- 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 assigning values to variables in if clauses and the like (line '85', column '8'). Open
protected function GetItemHtml(QListItem $objItem) {
// The Default Item Style
if ($this->objItemStyle) {
$objStyler = clone ($this->objItemStyle);
} else {
- Read upRead up
- Exclude checks
IfStatementAssignment
Since: 2.7.0
Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.
Example
class Foo
{
public function bar($flag)
{
if ($foo = 'bar') { // possible typo
// ...
}
if ($baz = 0) { // always false
// ...
}
}
}
Source http://phpmd.org/rules/cleancode.html#ifstatementassignment
Avoid using static access to class 'QApplication' in method 'RefreshSelection'. Open
QApplication::ExecuteControlCommand($this->ControlId, 'val', $values);
- 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
if (QType::Cast($mixValue, QType::String) == QSelectionMode::Multiple) {
- 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 RenderInnerHtml uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
else {
$strGroupHtml = '';
foreach ($items as $objItem) {
$strGroupHtml .= $this->GetItemHtml($objItem);
}
- 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 $strLabelForRequiredUnnamed. Keep variable name length under 20. Open
protected $strLabelForRequiredUnnamed;
- 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
The method GetModelConnectorParams is not named in camelCase. Open
public static function GetModelConnectorParams() {
return array_merge(parent::GetModelConnectorParams(), array(
new QModelConnectorParam (get_called_class(), 'Rows', 'Height of field for multirow field', QType::Integer),
new QModelConnectorParam (get_called_class(), 'SelectionMode', 'Single or multiple selections', QModelConnectorParam::SelectionList,
array (null=>'Default',
- 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 ParsePostData is not named in camelCase. Open
public function ParsePostData() {
if (array_key_exists($this->strControlId, $_POST)) {
if (is_array($_POST[$this->strControlId])) {
// Multi-Select, so find them all.
$this->SetSelectedItemsById($_POST[$this->strControlId], false);
- 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 PutState is not named in camelCase. Open
public function PutState($state) {
if (!empty($state['SelectedValues'])) {
// assume only one selection in list
$strValue = reset($state['SelectedValues']);
if ($this->FindItemByValue($strValue)) {
- 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 GetControlHtml is not named in camelCase. Open
protected function GetControlHtml() {
// If no selection is specified, we select the first item, because once we draw this, that is what the browser
// will consider selected on the screen.
// We need to make sure that what we draw is mirrored in our current state
if ($this->SelectionMode == QSelectionMode::Single &&
- 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 GetItemHtml is not named in camelCase. Open
protected function GetItemHtml(QListItem $objItem) {
// The Default Item Style
if ($this->objItemStyle) {
$objStyler = clone ($this->objItemStyle);
} else {
- 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 Validate is not named in camelCase. Open
public function Validate() {
if ($this->blnRequired) {
if ($this->SelectedIndex == -1) {
if ($this->strName)
$this->ValidationError = sprintf($this->strLabelForRequired, $this->strName);
- 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 RenderInnerHtml is not named in camelCase. Open
protected function RenderInnerHtml() {
$strHtml = '';
$intItemCount = $this->GetItemCount();
if (!$intItemCount) return '';
$groups = array();
- 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 GetResetButtonHtml is not named in camelCase. Open
abstract protected function GetResetButtonHtml();
- 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 RefreshSelection is not named in camelCase. Open
protected function RefreshSelection() {
$items = $this->SelectedItems;
$values = [];
foreach ($items as $objItem) {
$values[] = $objItem->Id;
- 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() {
}
}