RebelCode/wp-cqrs-resource-models

View on GitHub

Showing 19 of 47 total issues

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

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

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

      Method _buildSelectSql has 9 arguments (exceeds 4 allowed). Consider refactoring.
      Open

              $columns,
              $tables,
              $joins = [],
              LogicalExpressionInterface $where = null,
              $ordering = null,
      Severity: Major
      Found in src/Wpdb/SelectCapableWpdbTrait.php - About 1 hr to fix

        Method _extractPostIdsFromInExpression has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function _extractPostIdsFromInExpression(LogicalExpressionInterface $expression)
            {
                $postIds       = [];
                $isPostIdField = false;
                $pEntity       = $this->_getPostEntityName();
        Severity: Minor
        Found in src/Posts/ExtractPostIdsFromExpressionCapableTrait.php - About 1 hr to fix

          Method _extractPostIdsFromBetweenExpression has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected function _extractPostIdsFromBetweenExpression(LogicalExpressionInterface $expression)
              {
                  $isPostIdField = false;
                  $pEntity       = $this->_getPostEntityName();
                  $pIdField      = $this->_getPostIdFieldName();
          Severity: Minor
          Found in src/Posts/ExtractPostIdsFromExpressionCapableTrait.php - About 1 hr to fix

            Function _normalizeWpPostDataArray has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                protected function _normalizeWpPostDataArray($postData)
                {
                    // If an array or traversable, then meta data can be extracted. Forward to the other method
                    if (is_array($postData) || $postData instanceof Traversable) {
                        return $this->_normalizeWpPostDataAndMeta($postData);
            Severity: Minor
            Found in src/Posts/NormalizeWpPostDataArrayCapableTrait.php - About 55 mins 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 _extractPostIdsFromBetweenExpression has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                protected function _extractPostIdsFromBetweenExpression(LogicalExpressionInterface $expression)
                {
                    $isPostIdField = false;
                    $pEntity       = $this->_getPostEntityName();
                    $pIdField      = $this->_getPostIdFieldName();
            Severity: Minor
            Found in src/Posts/ExtractPostIdsFromExpressionCapableTrait.php - About 55 mins 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 _extractPostIdsFromInExpression has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                protected function _extractPostIdsFromInExpression(LogicalExpressionInterface $expression)
                {
                    $postIds       = [];
                    $isPostIdField = false;
                    $pEntity       = $this->_getPostEntityName();
            Severity: Minor
            Found in src/Posts/ExtractPostIdsFromExpressionCapableTrait.php - About 55 mins 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 __construct has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                    wpdb $wpdb,
                    TemplateInterface $expressionTemplate,
                    MapFactoryInterface $factory,
                    $tables,
                    $fieldColumnMap,
            Severity: Minor
            Found in src/Wpdb/WpdbSelectResourceModel.php - About 45 mins to fix

              Function _normalizeWpPostDataValue has a Cognitive Complexity of 8 (exceeds 5 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 45 mins 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 _extractPostIdsFromEqualsExpression has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  protected function _extractPostIdsFromEqualsExpression(LogicalExpressionInterface $expression = null)
                  {
                      $postIds       = [];
                      $isPostIdField = false;
                      $pEntity       = $this->_getPostEntityName();
              Severity: Minor
              Found in src/Posts/ExtractPostIdsFromExpressionCapableTrait.php - About 45 mins 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 _init has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                      wpdb $wpdb,
                      TemplateInterface $expressionTemplate,
                      MapFactoryInterface $factory,
                      $tables,
                      $fieldColumnMap,
              Severity: Minor
              Found in src/Wpdb/AbstractBaseWpdbSelectResourceModel.php - About 45 mins to fix

                Method _buildDeleteSql has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                        $table,
                        LogicalExpressionInterface $condition = null,
                        $ordering = null,
                        $limit = null,
                        $offset = null,
                Severity: Minor
                Found in src/Wpdb/DeleteCapableWpdbTrait.php - About 45 mins to fix

                  Method _buildUpdateSql has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                          $table,
                          $changeSet,
                          LogicalExpressionInterface $condition = null,
                          $ordering = null,
                          $limit = null,
                  Severity: Minor
                  Found in src/Wpdb/UpdateCapableWpdbTrait.php - About 45 mins to fix

                    Function _preProcessChangeSet has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                        protected function _preProcessChangeSet($changeSet, &$hashMap = [])
                        {
                            if ($hashMap === null) {
                                $hashMap = [];
                            }
                    Severity: Minor
                    Found in src/Wpdb/UpdateCapableWpdbTrait.php - About 45 mins 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 _mapIterable has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                            $iterable,
                            $callback,
                            $start = null,
                            $count = null,
                            array &$results = null
                    Severity: Minor
                    Found in src/Posts/PostFieldKeyMapAwareTrait.php - About 35 mins to fix

                      Method _mapIterable has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                              $iterable,
                              $callback,
                              $start = null,
                              $count = null,
                              array &$results = null
                      Severity: Minor
                      Found in src/Posts/SearchExpressionTermsCapableTrait.php - About 35 mins to fix
                        Severity
                        Category
                        Status
                        Source
                        Language