<commit_before><?php

/**
 * @license MIT
 * @license http://opensource.org/licenses/MIT
 */

namespace FaaPz\PDO\Clause;

use FaaPz\PDO\QueryInterface;

class Limit implements QueryInterface
{
    /** @var int $size */
    protected $size;

    /** @var int|null $offset */
    protected $offset;

    /**
     * @param int      $size
     * @param int|null $offset
     */
    public function __construct(int $size, ?int $offset = null)
    {
        $this->size = $size;
        $this->offset = $offset;
    }

    /**
     * @return int[]
     */
    public function getValues(): array
    {
        $values = [];
        if ($this->offset !== null) {
            $values[] = $this->offset;
        }
        $values[] = $this->size;

        return $values;
    }

    /**
     * @return string
     */
    public function __toString(): string
    {
        $sql = '?';
        if (isset($this->offset)) {
            $sql .= ', ?';
        }

        return $sql;
    }
}<commit_msg>Explicitly check for null.<commit_after><?php

/**
 * @license MIT
 * @license http://opensource.org/licenses/MIT
 */

namespace FaaPz\PDO\Clause;

use FaaPz\PDO\QueryInterface;

class Limit implements QueryInterface
{
    /** @var int $size */
    protected $size;

    /** @var int|null $offset */
    protected $offset;

    /**
     * @param int      $size
     * @param int|null $offset
     */
    public function __construct(int $size, ?int $offset = null)
    {
        $this->size = $size;
        $this->offset = $offset;
    }

    /**
     * @return int[]
     */
    public function getValues(): array
    {
        $values = [];
        if ($this->offset !== null) {
            $values[] = $this->offset;
        }
        $values[] = $this->size;

        return $values;
    }

    /**
     * @return string
     */
    public function __toString(): string
    {
        $sql = '?';
        if ($this->offset !== null) {
            $sql .= ', ?';
        }

        return $sql;
    }
}
{'fraction_non_alphanumeric': 0.16557952834922227, 'fraction_numerical': 0.0, 'mean_word_length': 1.6909581646423752, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3058661', 'n_tokens_mistral': 638, 'n_tokens_neox': 626, 'n_words': 140}