RebelCode/wp-cqrs-resource-models

View on GitHub

Showing 47 of 47 total issues

Avoid using short method names like ExtractPostIdsFromExpressionCapableTrait::__(). The configured minimum method name length is 3.
Open

    abstract protected function __($string, $args = [], $context = null);

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);
Severity: Minor
Found in src/Wpdb/WpdbAwareTrait.php by phpmd

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);

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);
Severity: Minor
Found in src/Posts/UpdateCapableWpTrait.php by phpmd

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);
Severity: Minor
Found in src/Wpdb/UpdateCapableWpdbTrait.php by phpmd

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);

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 DeleteCapableWpTrait::__(). The configured minimum method name length is 3.
Open

    abstract protected function __($string, $args = [], $context = null);
Severity: Minor
Found in src/Posts/DeleteCapableWpTrait.php by phpmd

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);

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 _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 = [];
Severity: Minor
Found in src/Wpdb/InsertCapableWpdbTrait.php - About 1 hr to fix

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 _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);
Severity: Minor
Found in src/Wpdb/GetWpdbExpressionHashMapCapableTrait.php - About 1 hr to fix

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'),
Severity: Minor
Found in src/Posts/UpdateCapableWpTrait.php - About 1 hr to fix

    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'),
    Severity: Minor
    Found in src/Posts/NormalizeWpPostDataArrayCapableTrait.php - About 1 hr to fix

      Avoid using undefined variables such as '$map' which will lead to PHP notices.
      Open

                  $this->postFieldKeyMap = $map;

      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 '$map' which will lead to PHP notices.
      Open

                  $this->_mapIterable($postFieldKeyMap, [$this, '_validatePostFieldKeyMapping'], null, null, $map);

      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);

      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);
      Severity: Minor
      Found in src/Wpdb/InsertCapableWpdbTrait.php by phpmd

      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);
      Severity: Minor
      Found in src/Wpdb/UpdateCapableWpdbTrait.php by phpmd

      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);
      Severity: Minor
      Found in src/Wpdb/UpdateCapableWpdbTrait.php by phpmd

      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;

      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);
      Severity: Minor
      Found in src/Wpdb/InsertCapableWpdbTrait.php by phpmd

      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

      Severity
      Category
      Status
      Source
      Language