Passed
Pull Request — master (#4)
by Ryosuke
07:16
created

SqlServerGrammar::compileRowNumber()   A

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 2
crap 2
1
<?php
2
3
namespace Mpyw\ComposhipsEagerLimit\Database\Query\Grammar;
4
5
use Staudenmeir\EloquentEagerLimit\Grammars\SqlServerGrammar as EagerLimitSqlServerGrammar;
6
7
class SqlServerGrammar extends EagerLimitSqlServerGrammar
8
{
9
    use Concerns\CompilesGroupLimitByMultipleColumnPartition {
10
        compileRowNumber as compileRowNumberParent;
11
    }
12
13
    /**
14
     * Compile a row number clause.
15
     *
16
     * @param  string $partition
17
     * @param  string $orders
18
     * @return string
19
     */
20 8
    protected function compileRowNumber($partition, $orders)
21
    {
22 8
        if (empty($orders)) {
23 5
            $orders = 'order by (select 0)';
24
        }
25
26 8
        return $this->compileRowNumberParent($partition, $orders);
27
    }
28
}
29