File Html.php
has 819 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace HnhDigital\LaravelHtmlGenerator;
use Illuminate\Support\Arr;
Html
has 96 functions (exceeds 20 allowed). Consider refactoring. Open
class Html extends Markup
{
/**
* @param string $tag
* @param array<mixed> $arguments
The class Html has an overall complexity of 228 which is very high. The configured complexity threshold is 50. Open
class Html extends Markup
{
/**
* @param string $tag
* @param array<mixed> $arguments
- Exclude checks
The class Html has 91 non-getter- and setter-methods. Consider refactoring Html to keep number of methods under 25. Open
class Html extends Markup
{
/**
* @param string $tag
* @param array<mixed> $arguments
- Read upRead up
- Exclude checks
TooManyMethods
Since: 0.1
A class with too many methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.
By default it ignores methods starting with 'get' or 'set'.
The default was changed from 10 to 25 in PHPMD 2.3.
Example
Source https://phpmd.org/rules/codesize.html#toomanymethods
The class Html has 90 public methods. Consider refactoring Html to keep number of public methods under 10. Open
class Html extends Markup
{
/**
* @param string $tag
* @param array<mixed> $arguments
- Read upRead up
- Exclude checks
TooManyPublicMethods
Since: 0.1
A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.
By default it ignores methods starting with 'get' or 'set'.
Example
Source https://phpmd.org/rules/codesize.html#toomanypublicmethods
Function addOptionsArray
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
public function addOptionsArray(
array $data,
bool|string $data_value,
bool|string|null $data_name,
array|string|null $selected_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
Function addClass
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function addClass(array|string|null $value = ''): self
{
if (blank($value)) {
return $this;
}
- 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 addOptionsArray
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function addOptionsArray(
array $data,
bool|string $data_value,
bool|string|null $data_name,
array|string|null $selected_value = []
Function createElement
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public static function createElement($tag = '', $attributes1 = [], $attributes2 = []): static
{
$tag_object = parent::createElement($tag);
$tag_object->setTag($tag);
- 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 addClass
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function addClass(array|string|null $value = ''): self
{
if (blank($value)) {
return $this;
}
The class Html has 95 public methods and attributes. Consider reducing the number of public items to less than 45. Open
class Html extends Markup
{
/**
* @param string $tag
* @param array<mixed> $arguments
- Read upRead up
- Exclude checks
ExcessivePublicCount
Since: 0.1
A large number of public methods and attributes declared in a class can indicate the class may need to be broken up as increased effort will be required to thoroughly test it.
Example
public class Foo {
public $value;
public $something;
public $var;
// [... more more public attributes ...]
public function doWork() {}
public function doMoreWork() {}
public function doWorkAgain() {}
// [... more more public methods ...]
}
Source https://phpmd.org/rules/codesize.html#excessivepubliccount
Method icon
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function icon(string $icon, string|int $size = 0, string $tag = 'i'): self
{
$icon = preg_replace('/(")(.*?)(")/', '$2', $icon);
$icon_array = explode(',', $icon, 2);
Function icon
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public static function icon(string $icon, string|int $size = 0, string $tag = 'i'): self
{
$icon = preg_replace('/(")(.*?)(")/', '$2', $icon);
$icon_array = explode(',', $icon, 2);
- 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 routeLink
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public static function routeLink(
?string $text = null,
?string $route = null,
array $parameters = [],
array $link_attributes = [],
- 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 routeLink
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
?string $text = null,
?string $route = null,
array $parameters = [],
array $link_attributes = [],
string $extra_link = ''
The class Html has 1366 lines of code. Current threshold is 1000. Avoid really long classes. Open
class Html extends Markup
{
/**
* @param string $tag
* @param array<mixed> $arguments
- Exclude checks
The method addOptionsArray() has an NPath complexity of 544. The configured NPath complexity threshold is 200. Open
public function addOptionsArray(
array $data,
bool|string $data_value,
bool|string|null $data_name,
array|string|null $selected_value = []
- 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 addOptionsArray() has a Cyclomatic Complexity of 15. The configured cyclomatic complexity threshold is 10. Open
public function addOptionsArray(
array $data,
bool|string $data_value,
bool|string|null $data_name,
array|string|null $selected_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 addClass() has a Cyclomatic Complexity of 10. The configured cyclomatic complexity threshold is 10. Open
public function addClass(array|string|null $value = ''): self
{
if (blank($value)) {
return $this;
}
- 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 s has a boolean flag argument $value, which is a certain sign of a Single Responsibility Principle violation. Open
public function s(\Closure|string|bool|null $value = true): string
- 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 classIf has a boolean flag argument $check, which is a certain sign of a Single Responsibility Principle violation. Open
?bool $check = false,
- 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 rtl has a boolean flag argument $is_rtl, which is a certain sign of a Single Responsibility Principle violation. Open
public function rtl(bool $is_rtl = false): self
- 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 prepareOptions has a boolean flag argument $blank_first_option, which is a certain sign of a Single Responsibility Principle violation. Open
bool $blank_first_option = false,
- 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 addStyleIf has a boolean flag argument $check, which is a certain sign of a Single Responsibility Principle violation. Open
?bool $check = false,
- 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 required has a boolean flag argument $required_value, which is a certain sign of a Single Responsibility Principle violation. Open
public function required(mixed $required = true, mixed $required_value = true): self
- 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 textIf has a boolean flag argument $test, which is a certain sign of a Single Responsibility Principle violation. Open
public function textIf(?bool $test = false, ?string $value = null, ...$args): self
- 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 required has a boolean flag argument $required, which is a certain sign of a Single Responsibility Principle violation. Open
public function required(mixed $required = true, mixed $required_value = true): self
- 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 checked has a boolean flag argument $check_value, which is a certain sign of a Single Responsibility Principle violation. Open
public function checked(?bool $value = true, ?bool $check_value = true): self
- 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 attrIf has a boolean flag argument $check, which is a certain sign of a Single Responsibility Principle violation. Open
public function attrIf(?bool $check = false, mixed ...$attr): self
- 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 checked has a boolean flag argument $value, which is a certain sign of a Single Responsibility Principle violation. Open
public function checked(?bool $value = true, ?bool $check_value = true): self
- 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 openNew has a boolean flag argument $open_normally, which is a certain sign of a Single Responsibility Principle violation. Open
public function openNew(bool $open_normally = false): self
- 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 addClassIf has a boolean flag argument $check, which is a certain sign of a Single Responsibility Principle violation. Open
?bool $check = false,
- 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 addAttrIf has a boolean flag argument $check, which is a certain sign of a Single Responsibility Principle violation. Open
public function addAttrIf(?bool $check = false, mixed ...$attr): self
- 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 style has a boolean flag argument $replace, which is a certain sign of a Single Responsibility Principle violation. Open
public function style(?string $value = null, bool $replace = false): self
- 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 readonly has a boolean flag argument $value, which is a certain sign of a Single Responsibility Principle violation. Open
public function readonly(bool $value = true): self
- 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 disable has a boolean flag argument $value, which is a certain sign of a Single Responsibility Principle violation. Open
public function disable(bool $value = true, bool $check_value = true): self
- 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 disable has a boolean flag argument $check_value, which is a certain sign of a Single Responsibility Principle violation. Open
public function disable(bool $value = true, bool $check_value = true): self
- 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 valueDate uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$value = '';
}
- 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 addClass uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$this->attributeList['class'] = [];
}
- 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 addOptionsArray uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$value = $data_value;
$name = $data_name;
}
- 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 icon uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$type = config('html.icon.default.type', 'l');
}
- 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 short method names like Html::s(). The configured minimum method name length is 3. Open
public function s(\Closure|string|bool|null $value = true): string
{
if (is_callable($value)) {
$value = $value();
}
- Read upRead up
- Exclude checks
ShortMethodName
Since: 0.2
Detects when very short method names are used.
Example
class ShortMethod {
public function a( $index ) { // Violation
}
}
Source https://phpmd.org/rules/naming.html#shortmethodname
Avoid using short method names like Html::id(). The configured minimum method name length is 3. Open
public function id(string|int|null $value = null): self
{
if (is_null($value)) {
return $this;
}
- Read upRead up
- Exclude checks
ShortMethodName
Since: 0.2
Detects when very short method names are used.
Example
class ShortMethod {
public function a( $index ) { // Violation
}
}
Source https://phpmd.org/rules/naming.html#shortmethodname
Avoid using short method names like Html::td(). The configured minimum method name length is 3. Open
public static function td(mixed ...$arguments): self
{
array_unshift($arguments, 'td');
return self::createElement(...$arguments);
- Read upRead up
- Exclude checks
ShortMethodName
Since: 0.2
Detects when very short method names are used.
Example
class ShortMethod {
public function a( $index ) { // Violation
}
}
Source https://phpmd.org/rules/naming.html#shortmethodname
Avoid using short method names like Html::h(). The configured minimum method name length is 3. Open
public static function h(string|int $size, string $text): self
{
return self::createElement('h'.$size, $text);
}
- Read upRead up
- Exclude checks
ShortMethodName
Since: 0.2
Detects when very short method names are used.
Example
class ShortMethod {
public function a( $index ) { // Violation
}
}
Source https://phpmd.org/rules/naming.html#shortmethodname
Avoid using short method names like Html::on(). The configured minimum method name length is 3. Open
public function on(?string $name = null, ?string $value = null): self
{
if (is_null($name) || is_null($value)) {
return $this;
}
- Read upRead up
- Exclude checks
ShortMethodName
Since: 0.2
Detects when very short method names are used.
Example
class ShortMethod {
public function a( $index ) { // Violation
}
}
Source https://phpmd.org/rules/naming.html#shortmethodname
Avoid using short method names like Html::li(). The configured minimum method name length is 3. Open
public static function li(mixed ...$arguments): self
{
array_unshift($arguments, 'li');
return self::createElement(...$arguments);
- Read upRead up
- Exclude checks
ShortMethodName
Since: 0.2
Detects when very short method names are used.
Example
class ShortMethod {
public function a( $index ) { // Violation
}
}
Source https://phpmd.org/rules/naming.html#shortmethodname
Avoid using short method names like Html::a(). The configured minimum method name length is 3. Open
public static function a(mixed ...$arguments): self
{
array_unshift($arguments, 'a');
return self::createElement(...$arguments);
- Read upRead up
- Exclude checks
ShortMethodName
Since: 0.2
Detects when very short method names are used.
Example
class ShortMethod {
public function a( $index ) { // Violation
}
}
Source https://phpmd.org/rules/naming.html#shortmethodname
Avoid using short method names like Html::p(). The configured minimum method name length is 3. Open
public static function p(mixed ...$arguments): self
{
array_unshift($arguments, 'p');
return self::createElement(...$arguments);
- Read upRead up
- Exclude checks
ShortMethodName
Since: 0.2
Detects when very short method names are used.
Example
class ShortMethod {
public function a( $index ) { // Violation
}
}
Source https://phpmd.org/rules/naming.html#shortmethodname
Avoid using short method names like Html::ul(). The configured minimum method name length is 3. Open
public static function ul(mixed ...$arguments): self
{
array_unshift($arguments, 'ul');
return self::createElement(...$arguments);
- Read upRead up
- Exclude checks
ShortMethodName
Since: 0.2
Detects when very short method names are used.
Example
class ShortMethod {
public function a( $index ) { // Violation
}
}
Source https://phpmd.org/rules/naming.html#shortmethodname
Avoid using short method names like Html::tr(). The configured minimum method name length is 3. Open
public static function tr(mixed ...$arguments): self
{
array_unshift($arguments, 'tr');
return self::createElement(...$arguments);
- Read upRead up
- Exclude checks
ShortMethodName
Since: 0.2
Detects when very short method names are used.
Example
class ShortMethod {
public function a( $index ) { // Violation
}
}
Source https://phpmd.org/rules/naming.html#shortmethodname
Avoid variables with short names like $fa. Configured minimum length is 3. Open
$fa = self::$tag()->addClass('fa'.$type.' fa-fw '.$icon.$size)->aria('hidden', 'true');
- 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;
}
}
}