| Conditions | 4 |
| Paths | 4 |
| Total Lines | 25 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 29 | public function limit( $limit, $offset = null ) |
||
| 30 | { |
||
| 31 | $limit = trim( $limit ); |
||
| 32 | |||
| 33 | if ( !QueryHelper::isInteger( $limit ) ) |
||
| 34 | throw new QueryException( 'Invalid Limit value', QueryException::QUERY_ERROR_INVALID_LIMIT ); |
||
| 35 | |||
| 36 | $limit = $this->queryStructure->bindParam('lim', (int)$limit); |
||
| 37 | |||
| 38 | if ( is_null( $offset ) ) { |
||
| 39 | $this->queryStructure->setElement( QueryStructure::LIMIT, $limit ); |
||
| 40 | |||
| 41 | return $this; |
||
| 42 | } |
||
| 43 | |||
| 44 | $offset = trim( $offset ); |
||
| 45 | |||
| 46 | if ( !QueryHelper::isInteger( $offset ) ) |
||
| 47 | throw new QueryException( 'Invalid Limit offset', QueryException::QUERY_ERROR_INVALID_LIMIT_OFFSET ); |
||
| 48 | |||
| 49 | $offset = $this->queryStructure->bindParam('ofs', (int)$offset); |
||
| 50 | |||
| 51 | $this->queryStructure->setElement( QueryStructure::LIMIT, $offset . ', ' . $limit ); |
||
| 52 | |||
| 53 | return $this; |
||
| 54 | } |
||
| 66 |