Showing 47 of 47 total issues
Avoid using short method names like DeleteCapableWpTrait::__(). The configured minimum method name length is 3. Open
abstract protected function __($string, $args = [], $context = null);
- 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 NormalizeWpPostDataArrayCapableTrait::__(). The configured minimum method name length is 3. Open
abstract protected function __($string, $args = [], $context = null);
- 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 ExtractPostIdsFromExpressionCapableTrait::__(). The configured minimum method name length is 3. Open
abstract protected function __($string, $args = [], $context = null);
- 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 UpdateCapableWpTrait::__(). The configured minimum method name length is 3. Open
abstract protected function __($string, $args = [], $context = null);
- 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 WpdbAwareTrait::__(). The configured minimum method name length is 3. Open
abstract protected function __($string, $args = [], $context = null);
- 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 PostFieldKeyMapAwareTrait::__(). The configured minimum method name length is 3. Open
abstract protected function __($string, $args = [], $context = null);
- 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 PostMetaFieldKeyAwareTrait::__(). The configured minimum method name length is 3. Open
abstract protected function __($string, $args = [], $context = null);
- 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 UpdateCapableWpdbTrait::__(). The configured minimum method name length is 3. Open
abstract protected function __($string, $args = [], $context = null);
- 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
Function _generateWpdbExpressionHashMap
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
protected function _generateWpdbExpressionHashMap(&$map, ExpressionInterface $condition, array $ignore)
{
foreach ($condition->getTerms() as $_idx => $_term) {
if ($_term instanceof ExpressionInterface) {
$this->_generateWpdbExpressionHashMap($map, $_term, $ignore);
- 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 _extractRecordData
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
protected function _extractRecordData($record, array &$hashMap = [])
{
// Initialize variable, in case it was declared implicitly during the method call
if ($hashMap === null) {
$hashMap = [];
- 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 _update
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function _update($changeSet, LogicalExpressionInterface $condition = null)
{
if ($condition === null) {
throw $this->_createInvalidArgumentException(
$this->__('Null conditions are not supported for WordPress post updates'),
Method _normalizeWpPostDataValue
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function _normalizeWpPostDataValue($value)
{
if ($value instanceof TermInterface && !($value instanceof LiteralTermInterface)) {
throw $this->_createInvalidArgumentException(
$this->__('Only literal terms are supported for native WP operations'),
Avoid using undefined variables such as '$map' which will lead to PHP notices. Open
$this->postFieldKeyMap = $map;
- 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 '$hashValueMap' which will lead to PHP notices. Open
$changeSet = $this->_preProcessChangeSet($changeSet, $hashValueMap);
- 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 '$hashValueMap' which will lead to PHP notices. Open
$processedRecords = $this->_preProcessRecords($records, $hashValueMap);
- 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 '$results' which will lead to PHP notices. Open
$this->_mapIterable($expression->getTerms(), $callback, null, $count, $results);
- 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 '$results' which will lead to PHP notices. Open
return $results;
- 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 '$hashValueMap' which will lead to PHP notices. Open
$values = array_values($hashValueMap);
- 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 '$hashValueMap' which will lead to PHP notices. Open
$this->_generateWpdbExpressionHashMap($hashValueMap, $condition, $fields);
- 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 '$hashValueMap' which will lead to PHP notices. Open
$values = array_values($hashValueMap);
- 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;
}
}