Function Stroke
has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring. Open
public function Stroke($aImg, $aX, $aY)
{
if ($this->iShow) {
$aImg->SetColor($this->iColor);
$aImg->SetFont($this->iFFamily, $this->iFStyle, $this->iFSize);
- 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 GetWidth
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
public function GetWidth($aImg, $aUseTabs = false, $aTabExtraMargin = 1.1)
{
$extra_margin = 4;
$aImg->SetFont($this->iFFamily, $this->iFStyle, $this->iFSize);
if (is_string($this->iText)) {
- 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 TextProperty has an overall complexity of 60 which is very high. The configured complexity threshold is 50. Open
class TextProperty
{
public $iShow = true;
public $csimtarget = '';
public $csimwintarget = '';
- Exclude checks
Method Stroke
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function Stroke($aImg, $aX, $aY)
{
if ($this->iShow) {
$aImg->SetColor($this->iColor);
$aImg->SetFont($this->iFFamily, $this->iFStyle, $this->iFSize);
Function GetColWidth
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public function GetColWidth($aImg, $aMargin = 0)
{
$aImg->SetFont($this->iFFamily, $this->iFStyle, $this->iFSize);
if (is_array($this->iText)) {
$n = safe_count($this->iText);
- 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 GetWidth
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function GetWidth($aImg, $aUseTabs = false, $aTabExtraMargin = 1.1)
{
$extra_margin = 4;
$aImg->SetFont($this->iFFamily, $this->iFStyle, $this->iFSize);
if (is_string($this->iText)) {
Avoid too many return
statements within this method. Open
return $w;
The method GetWidth() has an NPath complexity of 208. The configured NPath complexity threshold is 200. Open
public function GetWidth($aImg, $aUseTabs = false, $aTabExtraMargin = 1.1)
{
$extra_margin = 4;
$aImg->SetFont($this->iFFamily, $this->iFStyle, $this->iFSize);
if (is_string($this->iText)) {
- 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 GetWidth() has a Cyclomatic Complexity of 12. The configured cyclomatic complexity threshold is 10. Open
public function GetWidth($aImg, $aUseTabs = false, $aTabExtraMargin = 1.1)
{
$extra_margin = 4;
$aImg->SetFont($this->iFFamily, $this->iFStyle, $this->iFSize);
if (is_string($this->iText)) {
- 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 Stroke() has a Cyclomatic Complexity of 17. The configured cyclomatic complexity threshold is 10. Open
public function Stroke($aImg, $aX, $aY)
{
if ($this->iShow) {
$aImg->SetColor($this->iColor);
$aImg->SetFont($this->iFFamily, $this->iFStyle, $this->iFSize);
- 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 '$res' which will lead to PHP notices. Open
return [round($tot), $res];
- 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 '$res' which will lead to PHP notices. Open
$res[$i] = $aImg->GetTextWidth($tmp[$i]);
- 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 '$res' which will lead to PHP notices. Open
$tot += $res[$i] * $aTabExtraMargin;
- 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
The method GetWidth has a boolean flag argument $aUseTabs, which is a certain sign of a Single Responsibility Principle violation. Open
public function GetWidth($aImg, $aUseTabs = false, $aTabExtraMargin = 1.1)
- Read upRead up
- Exclude checks
BooleanArgumentFlag
Since: 1.4.0
A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.
Example
class Foo {
public function bar($flag = true) {
}
}
Source https://phpmd.org/rules/cleancode.html#booleanargumentflag
The method Show has a boolean flag argument $aShow, which is a certain sign of a Single Responsibility Principle violation. 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 assigning values to variables in if clauses and the like (line '281', column '54'). Open
public function Stroke($aImg, $aX, $aY)
{
if ($this->iShow) {
$aImg->SetColor($this->iColor);
$aImg->SetFont($this->iFFamily, $this->iFStyle, $this->iFSize);
- 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 '\Amenadiel\JpGraph\Util\JpGraphError' in method 'SetColumnFonts'. Open
Util\JpGraphError::RaiseL(6033);
- 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 Stroke uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$aImg->SetFont($this->iFFamily, $this->iFStyle, $this->iFSize);
}
- 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 Stroke uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$tmp = preg_split('/\t/', $this->iText);
$n = min(safe_count($tmp), safe_count($aX));
for ($i = 0; $i < $n; ++$i) {
if ($i < safe_count($this->iFontArray)) {
- 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 '\Amenadiel\JpGraph\Util\JpGraphError' in method 'GetWidth'. Open
Util\JpGraphError::RaiseL(6012);
- 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 GetWidth uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
if (is_object($tmp) === false) {
Util\JpGraphError::RaiseL(6012);
}
$w += $tmp->GetWidth() + $extra_margin;
- 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 GetColWidth uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
if (is_object($tmp) === false) {
Util\JpGraphError::RaiseL(6012);
}
$w[$i] = $tmp->GetWidth() + $aMargin;
- 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 GetWidth uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$aImg->SetFont($this->iFFamily, $this->iFStyle, $this->iFSize);
}
- 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 Stroke uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$aX = array_fill(0, $n, $aX);
$aY = array_fill(0, $n, $aY);
}
- 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 Stroke uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$aImg->SetFont($this->iFFamily, $this->iFStyle, $this->iFSize);
}
- 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 '\Amenadiel\JpGraph\Util\JpGraphError' in method 'GetWidth'. Open
Util\JpGraphError::RaiseL(6012);
- 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 '\Amenadiel\JpGraph\Util\JpGraphError' in method 'GetColWidth'. Open
Util\JpGraphError::RaiseL(6012);
- 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 GetColWidth uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$aImg->SetFont($this->iFFamily, $this->iFStyle, $this->iFSize);
}
- 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 Stroke uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
if ($i < safe_count($this->iFontArray)) {
$font = $this->iFontArray[$i];
$aImg->SetFont($font[0], $font[1], $font[2]);
} else {
- 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 variables with short names like $w. Configured minimum length is 3. Open
$w = $aImg->GetTextWidth($this->iText);
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
Avoid variables with short names like $n. Configured minimum length is 3. Open
} elseif (is_array($this->iText) && ($n = safe_count($this->iText)) > 0) {
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
Avoid variables with short names like $nf. Configured minimum length is 3. Open
$nf = safe_count($this->iFontArray);
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
Avoid variables with short names like $aY. Configured minimum length is 3. Open
public function Stroke($aImg, $aX, $aY)
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
Avoid variables with short names like $n. Configured minimum length is 3. Open
$n = safe_count($this->iText);
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
Avoid variables with short names like $ax. Configured minimum length is 3. Open
$ax = is_array($aX);
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
Avoid variables with short names like $n. Configured minimum length is 3. Open
$n = safe_count($tmp);
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
Avoid variables with short names like $nf. Configured minimum length is 3. Open
$nf = safe_count($this->iFontArray);
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
Avoid variables with short names like $aX. Configured minimum length is 3. Open
public function Stroke($aImg, $aX, $aY)
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
Avoid variables with short names like $nf. Configured minimum length is 3. Open
$nf = safe_count($this->iFontArray);
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
Avoid variables with short names like $ay. Configured minimum length is 3. Open
$ay = is_array($aY);
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
Method name "TextProperty::SetColor" is not in camel caps format Open
public function SetColor($aColor)
- Exclude checks
Method name "TextProperty::Show" is not in camel caps format Open
public function Show($aShow = true)
- Exclude checks
Method name "TextProperty::Align" is not in camel caps format Open
public function Align($aHAlign, $aVAlign = 'bottom')
- Exclude checks
Method name "TextProperty::SetAlign" is not in camel caps format Open
public function SetAlign($aHAlign, $aVAlign = 'bottom')
- Exclude checks
Method name "TextProperty::GetWidth" is not in camel caps format Open
public function GetWidth($aImg, $aUseTabs = false, $aTabExtraMargin = 1.1)
- Exclude checks
Method name "TextProperty::SetCSIMTarget" is not in camel caps format Open
public function SetCSIMTarget($aTarget, $aAltText = '', $aWinTarget = '')
- Exclude checks
Method name "TextProperty::GetNbrTabs" is not in camel caps format Open
public function GetNbrTabs()
- Exclude checks
Method name "TextProperty::Stroke" is not in camel caps format Open
public function Stroke($aImg, $aX, $aY)
- Exclude checks
Method name "TextProperty::GetHeight" is not in camel caps format Open
public function GetHeight($aImg)
- Exclude checks
Method name "TextProperty::SetColumnFonts" is not in camel caps format Open
public function SetColumnFonts($aFontArray)
- Exclude checks
Method name "TextProperty::GetColWidth" is not in camel caps format Open
public function GetColWidth($aImg, $aMargin = 0)
- Exclude checks
Method name "TextProperty::SetCSIMAlt" is not in camel caps format Open
public function SetCSIMAlt($aAltText)
- Exclude checks
Method name "TextProperty::SetFont" is not in camel caps format Open
public function SetFont($aFFamily, $aFStyle = FS_NORMAL, $aFSize = 10)
- Exclude checks
Method name "TextProperty::HasTabs" is not in camel caps format Open
public function HasTabs()
- Exclude checks
Method name "TextProperty::Set" is not in camel caps format Open
public function Set($aTxt)
- Exclude checks
Method name "TextProperty::IsColumns" is not in camel caps format Open
public function IsColumns()
- Exclude checks