Limit the result set to $x number of documents

@param	number	$x			the max amount of documents to fetch
@usage	$mongodb->limit($x);
439276
public function limit($x = 99999)
		{
			if ($x !== null and is_numeric($x) and $x >= 1) {
				$this->limit = (int) $x;
			}

			return $this;
		}
431804
public function limit($num)
    {
        $num = (integer) $num;
        $this->limit = $num;
        $this->mongoCursor->limit($num);
        return $this;
    }
1354869
public function limit($offset = 0, $limit = 10)
    {
        $limit < 1 && $limit = 100;
        $this->sql['limit'] = [$offset, $limit];
        return $this;
    }
612951
protected boolean withinLimit(Integer limit, Collection<?> collection) {
        if (limit == null) {
            return true;
        } else {
            int value = limit.intValue();
            return value <= 0 || value > collection.size();
        }
    }
436305
protected function limitCollection($data)
    {
        $results = [];
        foreach ($data as $key => $value) {
            if (is_array($value) === true && count($value) > $this->limit) {
                $value = array_slice($value, 0, $this->limit);
            }

            if ($value instanceof Collection && $value->count() > $this->limit) {
                $value = $value->take($this->limit);
            }

            $results[$key] = $value;
        }

        return $results;
    }
211162
public function limit($limit = null) {
		if (is_null($limit)) //remove options
			return $this->discard('query.limit');
	
		return $this->merge(['query.limit' => intval($limit)]);
	}
32966
public function setLimit(QueryBuilder $qb)
    {
        if (isset($this->offset) && $this->amount != '-1') {
            $qb->setFirstResult($this->offset)->setMaxResults($this->amount);
        }
    }
950839
private function setLimit($limit = self::NO_LIMIT)
    {
        if (! is_int($limit)) {
            throw new Exceptions\InvalidIntegerType(gettype($limit));
        }

        // A limit of 0 or less is useless, fallback to no limit
        if ($limit !== self::NO_LIMIT && $limit <= 0) {
            throw new Exceptions\PositiveIntegerRequired($limit);
        }

        $this->limit = $limit;
    }
1075637
public function limit($offset, $amount = null)
    {
        if (is_null($amount)) {
            $this->append(' LIMIT ' . $offset);
        } else {
            $this->append(sprintf(' LIMIT %s, %s', $offset, $amount));
        }

        return $this;
    }
1254196
public function limit( $limit )
    {
        $limit = (int)$limit;
        if( $limit > 0 )
            $this->limit = $limit;

        return $this;
    }
88542
final public function limit($limit, $offset = 0)
    {
        $this->_sql['limit'] = $limit;
        $this->offset($offset);
        return $this;
    }
720028
public function limit($from, $to = '') 
    {
        $this->sql .= ' LIMIT ' . $from;
        
        if(is_numeric($to)) {
            $this->sql .= ', ' . $to;
        }
        
        return $this;
    }
981716
public static function limit($number, $min, $max): int
    {
        return self::max(self::min($number, $min), $max);
    }
281927
function applyLimit(&$sql, $offset, $limit) {

		$max = $offset + $limit;

		// nesting all queries, in case there's already a WHERE clause
		$sql = <<<EOF
SELECT A.*, rownum AS PROPEL\$ROWNUM
FROM (
  $sql
) A
WHERE rownum <= $max
EOF;

		if ($offset > 0) {
			$sql = <<<EOF
SELECT B.*
FROM (
  $sql
) B
WHERE B.PROPEL\$ROWNUM > $offset
EOF;
		}
	}
899541
protected function set_limit($query, $limit = 0, $offset = 0)
    {
        $limit  = intval($limit);
        $offset = intval($offset);
        $end    = $offset + $limit;

        // query without OFFSET
        if (!$offset) {
            $query = preg_replace('/^SELECT\s/i', "SELECT TOP $limit ", $query);
            return $query;
        }

        $orderby = stristr($query, 'ORDER BY');
        $offset += 1;

        if ($orderby !== false) {
            $query = trim(substr($query, 0, -1 * strlen($orderby)));
        }
        else {
            // it shouldn't happen, paging without sorting has not much sense
            // @FIXME: I don't know how to build paging query without ORDER BY
            $orderby = "ORDER BY 1";
        }

        $query = preg_replace('/^SELECT\s/i', '', $query);
        $query = "WITH paging AS (SELECT ROW_NUMBER() OVER ($orderby) AS [RowNumber], $query)"
            . " SELECT * FROM paging WHERE [RowNumber] BETWEEN $offset AND $end ORDER BY [RowNumber]";

        return $query;
    }
1363539
function exceed($key, $limit)
    {
        $key = self::PREFIX . $key;
        $count = $this->redis->get($key);

        if (!empty($count) and $count > $limit)
        {
            return true;
        }
        else
        {
            return false;
        }
    }
555347
public function limit(int $number)
    {
        $instance = $this->limitStrategyInstance();

        $instance->limitStrategy()->limit($number);

        return $instance;
    }