LimitSqlsrv   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 6
lcom 1
cbo 1
dl 0
loc 22
ccs 0
cts 10
cp 0
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A buildEarly() 0 8 3
A build() 0 10 3
1
<?php
2
declare(strict_types=1);
3
4
namespace Sirius\Sql\Component;
5
6
class LimitSqlsrv extends Limit
7
{
8
    public function buildEarly(): string
9
    {
10
        if ($this->limit > 0 && $this->offset == 0) {
11
            return " TOP {$this->limit}";
12
        }
13
14
        return '';
15
    }
16
17
    public function build(): string
18
    {
19
        if ($this->limit > 0 && $this->offset > 0) {
20
            return PHP_EOL
21
                   . "OFFSET {$this->offset} ROWS "
22
                   . "FETCH NEXT {$this->limit} ROWS ONLY";
23
        }
24
25
        return '';
26
    }
27
}
28