Code Duplication    Length = 18-18 lines in 2 locations

source/Spiral/Database/Drivers/SQLite/SQLiteCompiler.php 1 location

@@ 55-72 (lines=18) @@
52
     *
53
     * @link http://stackoverflow.com/questions/10491492/sqllite-with-skip-offset-only-not-limit
54
     */
55
    protected function compileLimit(int $limit, int $offset): string
56
    {
57
        if (empty($limit) && empty($offset)) {
58
            return '';
59
        }
60
61
        $statement = '';
62
63
        if (!empty($limit) || !empty($offset)) {
64
            $statement = 'LIMIT ' . ($limit ?: '-1') . ' ';
65
        }
66
67
        if (!empty($offset)) {
68
            $statement .= "OFFSET {$offset}";
69
        }
70
71
        return trim($statement);
72
    }
73
}
74

source/Spiral/Database/Drivers/MySQL/MySQLCompiler.php 1 location

@@ 24-41 (lines=18) @@
21
     *
22
     * @link http://dev.mysql.com/doc/refman/5.0/en/select.html#id4651990
23
     */
24
    protected function compileLimit(int $limit, int $offset): string
25
    {
26
        if (empty($limit) && empty($offset)) {
27
            return '';
28
        }
29
30
        $statement = '';
31
        if (!empty($limit) || !empty($offset)) {
32
            //When limit is not provided but offset does we can replace limit value with PHP_INT_MAX
33
            $statement = 'LIMIT ' . ($limit ?: '18446744073709551615') . ' ';
34
        }
35
36
        if (!empty($offset)) {
37
            $statement .= "OFFSET {$offset}";
38
        }
39
40
        return trim($statement);
41
    }
42
43
    /**
44
     * Resolve operator value based on value value. ;).