CompilesGroupLimitByMultipleColumnPartition   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
eloc 5
c 1
b 0
f 0
dl 0
loc 18
rs 10
ccs 4
cts 4
cp 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A compileRowNumber() 0 7 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