src/WordPress/WpHookReplacer.php
The class WpHookReplacer has 12 public methods. Consider refactoring WpHookReplacer to keep number of public methods under 10. Open
Open
class WpHookReplacer implements Iterator, ArrayAccess
{
/**
* The original WP_Hook instance to proxy to.
*
- 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
Avoid excessively long variable names like $stoppedPropagationException. Keep variable name length under 20. Open
Open
} catch (StoppedPropagationExceptionInterface $stoppedPropagationException) {
- 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 apply_filters is not named in camelCase. Open
Open
public function apply_filters($value, $args)
{
try {
$value = $this->wpHook->apply_filters($value, $args);
} catch (StoppedPropagationExceptionInterface $stoppedPropagationException) {
- 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() {
}
}