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