timgws/QueryBuilderParser

View on GitHub
src/QueryBuilderParser/QBPFunctions.php

Summary

Maintainability
A
1 hr
Test Coverage

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

    private function makeArrayQueryIn(EloquentBuilder|Builder $query, stdClass $rule, $operator, array $value, $condition)
Severity: Minor
Found in src/QueryBuilderParser/QBPFunctions.php - About 35 mins to fix

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

        protected function makeQueryWhenArray(EloquentBuilder|Builder $query, stdClass $rule, array $sqlOperator, array $value, $condition)
    Severity: Minor
    Found in src/QueryBuilderParser/QBPFunctions.php - About 35 mins to fix

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

          private function makeArrayQueryBetween(EloquentBuilder|Builder $query, stdClass $rule, $operator, array $value, $condition)
      Severity: Minor
      Found in src/QueryBuilderParser/QBPFunctions.php - About 35 mins to fix

        Avoid variables with short names like $v. Configured minimum length is 3.
        Open

                    return array_map(function ($v) {

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

        Source https://phpmd.org/rules/naming.html#shortvariable

        Expected 0 spaces before closing bracket; 1 found
        Open

                if ( $operator == 'NOT BETWEEN' ) {

        Line exceeds 120 characters; contains 135 characters
        Open

            protected function makeQueryWhenArray(EloquentBuilder|Builder $query, stdClass $rule, array $sqlOperator, array $value, $condition)

        Line exceeds 120 characters; contains 127 characters
        Open

            private function makeArrayQueryBetween(EloquentBuilder|Builder $query, stdClass $rule, $operator, array $value, $condition)

        Line exceeds 120 characters; contains 122 characters
        Open

            private function makeArrayQueryIn(EloquentBuilder|Builder $query, stdClass $rule, $operator, array $value, $condition)

        Expected 0 spaces before closing bracket; 1 found
        Open

                    return $query->whereNotBetween( $rule->field, $value, $condition );

        Space after opening parenthesis of function call prohibited
        Open

                    return $query->whereNotBetween( $rule->field, $value, $condition );

        Expected 0 spaces after opening bracket; 1 found
        Open

                if ( $operator == 'NOT BETWEEN' ) {

        There are no issues that match your filters.

        Category
        Status