Code Duplication    Length = 18-18 lines in 2 locations

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

@@ 48-65 (lines=18) @@
45
     *
46
     * @link http://dev.mysql.com/doc/refman/5.0/en/select.html#id4651990
47
     */
48
    protected function compileLimit(int $limit, int $offset): string
49
    {
50
        if (empty($limit) && empty($offset)) {
51
            return '';
52
        }
53
54
        $statement = '';
55
        if (!empty($limit) || !empty($offset)) {
56
            //When limit is not provided but offset does we can replace limit value with PHP_INT_MAX
57
            $statement = 'LIMIT ' . ($limit ?: '18446744073709551615') . ' ';
58
        }
59
60
        if (!empty($offset)) {
61
            $statement .= "OFFSET {$offset}";
62
        }
63
64
        return trim($statement);
65
    }
66
67
    /**
68
     * Resolve operator value based on value value. ;).

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

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