Conditions | 7 |
Paths | 10 |
Total Lines | 17 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
35 | protected function buildLimit(string $query, ?int $offset = null) { |
||
36 | $limit = $this->getLimit(); |
||
37 | if($limit === null && $offset !== null) { |
||
38 | $limit = '18446744073709551615'; |
||
39 | } |
||
40 | if($this->limit instanceof OptionalValue) { |
||
41 | if($this->limit->isValid()) { |
||
42 | $value = $this->limit->getValue(); |
||
43 | if(!preg_match('{\\d+}', $value)) { |
||
44 | throw new InvalidValueException('Value for LIMIT has to be a number'); |
||
45 | } |
||
46 | $query .= "LIMIT\n\t{$this->limit->getValue()}\n"; |
||
47 | } |
||
48 | } elseif($limit !== null) { |
||
49 | $query .= "LIMIT\n\t{$limit}\n"; |
||
50 | } |
||
51 | return $query; |
||
52 | } |
||
54 |