PostgresGrammar::compileSelect()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 7
ccs 4
cts 4
cp 1
rs 10
cc 2
nc 2
nop 1
crap 2
1
<?php
2
3
namespace Staudenmeir\EloquentEagerLimitXLaravelCte\Query\Grammars;
4
5
use Illuminate\Database\Query\Builder;
6
use Illuminate\Database\Query\Grammars\PostgresGrammar as Base;
7
use Staudenmeir\EloquentEagerLimit\Grammars\Traits\CompilesPostgresGroupLimit;
8
use Staudenmeir\LaravelCte\Query\Grammars\Traits\CompilesPostgresExpressions;
9
10
class PostgresGrammar extends Base
11
{
12
    use CompilesPostgresGroupLimit, CompilesPostgresExpressions {
0 ignored issues
show
Bug introduced by
The trait Staudenmeir\EloquentEage...pilesPostgresGroupLimit requires the property $groupLimit which is not provided by Staudenmeir\EloquentEage...rammars\PostgresGrammar.
Loading history...
introduced by
The trait Staudenmeir\LaravelCte\Q...ilesPostgresExpressions requires some properties which are not provided by Staudenmeir\EloquentEage...rammars\PostgresGrammar: $unionExpressions, $expressions, $recursionLimit, $joins, $limit, $unionRecursionLimit
Loading history...
13
        CompilesPostgresGroupLimit::compileSelect as compileSelect1;
14
        CompilesPostgresExpressions::compileSelect as compileSelect2;
15
    }
16
17
    /**
18
     * Compile a select query into SQL.
19
     *
20
     * @param \Illuminate\Database\Query\Builder $query
21
     * @return string
22
     */
23 43
    public function compileSelect(Builder $query)
24
    {
25 43
        if (isset($query->groupLimit)) {
26 24
            return $this->compileSelect1($query);
27
        }
28
29 43
        return $this->compileSelect2($query);
30
    }
31
}
32