Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 4
0.00% covered (danger)
0.00%
0 / 1
CRAP
0.00% covered (danger)
0.00%
0 / 1
AbstractSQL
0.00% covered (danger)
0.00%
0 / 4
0.00% covered (danger)
0.00%
0 / 1
6
0.00% covered (danger)
0.00%
0 / 1
 limit
0.00% covered (danger)
0.00%
0 / 4
0.00% covered (danger)
0.00%
0 / 1
6
1<?php declare(strict_types=1);
2/**
3 * Query
4 *
5 * SQL Query Builder / Database Abstraction Layer
6 *
7 * PHP version 8.1
8 *
9 * @package     Query
10 * @author      Timothy J. Warren <tim@timshome.page>
11 * @copyright   2012 - 2023 Timothy J. Warren
12 * @license     http://www.opensource.org/licenses/mit-license.html  MIT License
13 * @link        https://git.timshomepage.net/aviat/Query
14 * @version     4.0.0
15 */
16
17namespace Query\Drivers;
18
19/**
20 * Parent for database-specific syntax subclasses
21 */
22abstract class AbstractSQL implements SQLInterface
23{
24    /**
25     * Limit clause
26     */
27    public function limit(string $sql, int $limit, ?int $offset=NULL): string
28    {
29        $sql .= "\nLIMIT {$limit}";
30
31        if (is_numeric($offset))
32        {
33            $sql .= " OFFSET {$offset}";
34        }
35
36        return $sql;
37    }
38}