compileRowNumber()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 7
rs 10
ccs 2
cts 2
cp 1
cc 1
nc 1
nop 2
crap 1
1
<?php
2
3
namespace Mpyw\ComposhipsEagerLimit\Database\Query\Grammar\Concerns;
4
5
use Staudenmeir\EloquentEagerLimit\Grammars\Traits\CompilesGroupLimit;
6
7
/**
8
 * Trait CompilesGroupLimitByMultipleColumnPartition
9
 */
10
trait CompilesGroupLimitByMultipleColumnPartition
11
{
12
    use CompilesGroupLimit;
13
14
    /**
15
     * Compile a row number clause.
16
     *
17 192
     * @param  array|string $partition
18
     * @param  string       $orders
19 192
     * @return string
20
     */
21 192
    protected function compileRowNumber($partition, $orders)
22
    {
23 192
        $partition = 'partition by ' . implode(', ', array_map([$this, 'wrap'], (array)$partition));
24
25
        $over = trim($partition . ' ' . $orders);
26
27
        return ', row_number() over (' . $over . ') as laravel_row';
28
    }
29
}
30