Hit the limit set for the given region.

@param string $region
@param int $count
@return bool
7093
public function hitLimits($region, $count = 1)
	{
		foreach ($this->limits as $limit)
		{
			if ($limit->getRegion() == $region &&
				! $limit->hit($count)
			)
			{
				return false;
			}
		}

		return true;
	}
1284228
protected function isNodeLimited(DataObject $node, $count = null)
    {
        // Singleton root node isn't limited
        if (!$node->ID) {
            return false;
        }

        // Check if limiting is enabled first
        if (!$this->getLimitingEnabled()) {
            return false;
        }

        // Count children for this node and compare to max
        if (!isset($count)) {
            $count = $this->getNumChildren($node);
        }
        return $count > $this->getMaxChildNodes();
    }
1142679
public function countInRegion($region)
    {
        $query = $this->_em->createQuery('
            SELECT COUNT(n.id)
            FROM CMSBundle:Node AS n
            JOIN CMSBundle:Region AS r
            WHERE r.id = :region
            AND n.region = r
        ')->setParameter('region', $region);

        return $query->getSingleScalarResult();
    }
407278
public function limit($count)
    {
        if($count<1 || $count>50){
            throw new \RuntimeException('Limit beyond 1-50 range', ResourceException::LIMIT_BEYOND_RANGE);
        }

        $this->limit = $count;

        return $this;
    }
1373578
public final function getItemIds($count = null, $offset = null)
    {
        $select = $this->_getSelect();
        if (!$select) return array();

        if ($count) {
            if ($select->hasPart(Kwf_Model_Select::LIMIT_COUNT)) {
                $ex = new Kwf_Exception("Can't use getItemIds with limit in select when \$count paramter is given. You probably should disable paging for {$this->getData()->componentClass}.");
                $ex->logOrThrow();
            }
            $select->limit($count, $offset);
        }

        return $this->getData()->parent->getComponent()->getItemIds($select);
    }
870767
public function release($count)
    {
        $count = min($count, $this->size);

        if (!$count) {
            return;
        }

        $this->size -= $count;
        call_user_func($this->releaseFn, $count);
    }
1079889
public function lrem($key, $count, $value) {
        return $this->returnCommand(['LREM'], $key, [$key, $count, $value]);
    }
446984
public static function rangeCount($value, int $minCount, int $maxCount): bool
    {
        if (!static::isCountable($value)) {
            return false;
        }

        $count = count($value);

        if ($count < $minCount) {
            return false;
        }
        if ($count > $maxCount) {
            return false;
        }

        return true;
    }
351741
public function getConstrainedKeysByCount($count, $operator = '>=')
	{
		$associativeLocal = $this->associativeLocal;

		return $this->getConstrainedKeys(function($related) use ($count, $associativeLocal, $operator)
		{
			$related->group($associativeLocal)->having('COUNT(*)', $operator, $count);
		});
	}
535773
public function limit($sql, $count, $offset = 0)
    {
        $count = intval($count);
        if ($count <= 0) {
            /**
             * @see Zend_Db_Adapter_Oracle_Exception
             */
            // require_once 'Zend/Db/Adapter/Oracle/Exception.php';
            throw new Zend_Db_Adapter_Oracle_Exception("LIMIT argument count=$count is not valid");
        }

        $offset = intval($offset);
        if ($offset < 0) {
            /**
             * @see Zend_Db_Adapter_Oracle_Exception
             */
            // require_once 'Zend/Db/Adapter/Oracle/Exception.php';
            throw new Zend_Db_Adapter_Oracle_Exception("LIMIT argument offset=$offset is not valid");
        }

        /**
         * Oracle does not implement the LIMIT clause as some RDBMS do.
         * We have to simulate it with subqueries and ROWNUM.
         * Unfortunately because we use the column wildcard "*",
         * this puts an extra column into the query result set.
         */
        $limit_sql = "SELECT z2.*
            FROM (
                SELECT z1.*, ROWNUM AS \"zend_db_rownum\"
                FROM (
                    " . $sql . "
                ) z1
            ) z2
            WHERE z2.\"zend_db_rownum\" BETWEEN " . ($offset+1) . " AND " . ($offset+$count);
        return $limit_sql;
    }
583863
protected function cacheCountBetween($count, Carbon $from, Carbon $until, $locale, $cacheKey)
    {
        // Cache only if cacheKey is present
        if ($cacheKey && ($until->timestamp < Carbon::now()->timestamp))
        {
            $key = $this->makeBetweenCacheKey($from, $until, $locale, $cacheKey);

            $this->cache->put($key, $count, 525600);
        }
    }
1140584
public function takeLast(int $count)
    {
        return $this->wrap(function (Iterator $data) use ($count) {
            // From the end of the collection
            $limit = max(0, $count);
            $chunk = [];

            foreach ($data as $key => $datum) {
                $chunk[] = [$key, $datum];
                if (count($chunk) > $limit) {
                    array_shift($chunk);
                }
            }

            foreach ($chunk as $item) {
                [$key, $datum] = $item;
                yield $key => $datum;
            }
        });
    }
1277048
public function setCount( $count )
	{
		if ( $count == $this->getCount() ) { return; }

		$this->_values['count'] = (string) $count;
		$this->setModified();
	}
1166803
public function setCount(int $count, string $type = self::INFO): void
	{
		if ($count > 0) {
			switch ($type) {
				default:
					throw new InvalidArgumentException("Wrong argument 'type'");
				case self::INFO:
				case self::WARNING:
					break;
			}
			$this->count = $count;
			$this->type = $type;
		}
	}
300041
public function limit($count, $offset = 0)
    {
        $this->limit = array((int) $count, (int) $offset);

        return $this;
    }
94943
public function limit($count = null, $offset = null)
    {
        $this->_parts[self::LIMIT_COUNT]  = (int) $count;
        $this->_parts[self::LIMIT_OFFSET] = (int) $offset;
        return $this;
    }
821165
public function setLimit($count, $offset = null)
    {
        $this->_dsql()->limit($count, $offset);

        return $this;
    }