Passed
Push — master ( 0e82ae...7f52e8 )
by Jonas
03:04
created

compileTableExpression()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
ccs 0
cts 2
cp 0
rs 10
cc 1
nc 1
nop 2
crap 2
1
<?php
2
3
namespace Staudenmeir\LaravelCte\Query\Grammars\Traits;
4
5
use Illuminate\Database\Query\Builder;
6
7
trait CompilesSqlServerExpressions
8
{
9
    use CompilesExpressions {
10
        compileSelect as compileSelectParent;
11
    }
12
13
    /**
14
     * Compile a select query into SQL.
15
     *
16
     * @param \Illuminate\Database\Query\Builder $query
17
     * @return string
18
     */
19 46
    public function compileSelect(Builder $query)
20
    {
21 46
        if ($query->offset && empty($query->orders)) {
22 5
            $query->orders[] = ['sql' => '(SELECT 0)'];
23
        }
24
25 46
        return $this->compileSelectParent($query);
26
    }
27
28
    /**
29
     * Compile a common table expression for a query.
30
     *
31
     * @param string $sql
32
     * @param \Illuminate\Database\Query\Builder $query
33
     * @return string
34
     */
35
    protected function compileTableExpression($sql, $query)
36
    {
37
        return $this->compileExpressions($query, $query->expressions).' '.parent::compileTableExpression($sql, $query);
0 ignored issues
show
Bug introduced by
The property expressions does not seem to exist on Illuminate\Database\Query\Builder.
Loading history...
38
    }
39
40
    /**
41
     * Get the "recursive" keyword.
42
     *
43
     * @param array $expressions
44
     * @return string
45
     */
46 36
    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

46
    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...
47
    {
48 36
        return '';
49
    }
50
}
51