Passed
Push — master ( e1711c...6da277 )
by Jonas
04:38
created

SqlServerGrammar::compileTableExpression()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 2
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Staudenmeir\LaravelCte\Query\Grammars;
4
5
use Illuminate\Database\Query\Builder;
6
use Illuminate\Database\Query\Grammars\SqlServerGrammar as Base;
7
8
class SqlServerGrammar extends Base
9
{
10
    use CompilesExpressions;
0 ignored issues
show
Bug introduced by
The trait Staudenmeir\LaravelCte\Q...ars\CompilesExpressions requires the property $recursionLimit which is not provided by Staudenmeir\LaravelCte\Q...ammars\SqlServerGrammar.
Loading history...
11
12
    /**
13
     * Compile a select query into SQL.
14
     *
15
     * @param \Illuminate\Database\Query\Builder $query
16
     * @return string
17
     */
18 27
    public function compileSelect(Builder $query)
19
    {
20 27
        if (!$query->offset) {
21 27
            return parent::compileSelect($query);
22
        }
23
24 4
        if (is_null($query->columns)) {
0 ignored issues
show
introduced by
The condition is_null($query->columns) is always false.
Loading history...
25 4
            $query->columns = ['*'];
26
        }
27
28 4
        $expressions = $query->expressions;
29
30 4
        $query->expressions = [];
31
32 4
        $components = $this->compileComponents($query);
33
34 4
        $query->expressions = $expressions;
35
36 4
        return $this->compileAnsiOffset($query, $components);
37
    }
38
39
    /**
40
     * Compile a common table expression for a query.
41
     *
42
     * @param string $sql
43
     * @param \Illuminate\Database\Query\Builder $query
44
     * @return string
45
     */
46 4
    protected function compileTableExpression($sql, $query)
47
    {
48 4
        return $this->compileExpressions($query).' '.parent::compileTableExpression($sql, $query);
49
    }
50
51
    /**
52
     * Get the "recursive" keyword.
53
     *
54
     * @param array $expressions
55
     * @return string
56
     */
57 19
    protected function recursiveKeyword(array $expressions)
0 ignored issues
show
Unused Code introduced by
The parameter $expressions is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

57
    protected function recursiveKeyword(/** @scrutinizer ignore-unused */ array $expressions)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
58
    {
59 19
        return '';
60
    }
61
}
62