public function setLimit(int $limit = null)
    {
        if (null !== $limit && ($limit < 1 || $limit > 1000)) {
            throw new \RangeException(\sprintf(
                'Limit value must be between 0 and 1000, "%d" given.',
                $limit
            ));
        }

        $this->limit = $limit;

        return $this;
    }