@param string $fullName
@param int    $limit

@return array
976702
public function generate(string $fullName, int $limit = 8): array
    {
        $original = str_replace(' ', '', $fullName);
        if ($limit > strlen($original)) {
            return array();
        }

        if (-1 === $index = $this->isReservedName($fullName)) {
            return array();
        }

        $temp = explode(' ', strtoupper($fullName));
        if (2 > count($temp)) {
            return array();
        }

        $temp[$index] = $this->reservedNames[$temp[$index]];
        $fullName = substr(implode('', $temp), 0, $limit);
        if ($limit > strlen($fullName)) {
            $fullName = $original;
        } else {
            $original = $temp[$index];
        }

        return $this->shift($fullName, $original);
    }
1065833
protected function readTableData(string $tableName, int $limit = null): array
    {
        assert($limit === null || $limit > 0);

        $builder = $this->getConnection()->createQueryBuilder();
        $builder
            ->select('*')
            ->from($tableName);

        $limit === null ?: $builder->setMaxResults($limit);

        $result = $builder->execute()->fetchAll(PDO::FETCH_ASSOC);

        return $result;
    }
1075189
public function fetchAll($limit = null, $offset = null){
		$limit = $limit === null ? -1 : (int) $limit;
		if($offset !== null)
			$this->seek((int) $offset);

		$row = $this->fetch();
		if(!$row)
			return array();

		$rows = array();
		do{
			if($limit === 0)
				break;
			$rows[] = $row;
			$limit--;
		} while($row = $this->fetch());

		return $rows;
	}
1283490
public function getUserAgents($limit = 0)
    {
        $counter = 0;

        foreach ($this->loadFromPath() as $line) {
            if ($limit && $counter >= $limit) {
                return;
            }

            yield $line;
            ++$counter;
        }
    }
457164
private function doGenerate(string $fullName, int $characterLimit, array $characters = [])
    {
        $balineseGenerator = new BalineseUsernameGenerator();
        if (-1 !== $balineseGenerator->isReservedName($fullName)) {
            $characters = array_merge($characters, $balineseGenerator->generate($fullName, $characterLimit));
        }

        $islamicGenerator = new IslamicUsernameGenerator();
        if (-1 !== $islamicGenerator->isReservedName($fullName)) {
            $characters = array_merge($characters, $islamicGenerator->generate($fullName, $characterLimit));
        }

        $westernGenerator = new WesternUsernameGenerator();
        if (-1 !== $westernGenerator->isReservedName($fullName)) {
            $characters = array_merge($characters, $westernGenerator->generate($fullName, $characterLimit));
        }

        $genericGenerator = new GenericUsernameGenerator();
        $characters = array_merge($characters, $genericGenerator->generate($fullName, $characterLimit));

        return $characters;
    }
190979
public function getEvents($limit = null)
    {
        $select = $this->getConnection()->select()->from($this->getMainTable());

        if ($limit !== null) {
            $select->limit($limit);
        }

        $eventData = $this->getConnection()->fetchAll($select);

        foreach ($eventData as &$currentEvent) {
            $currentEvent = array_merge($currentEvent, $this->jsonSerializer->unserialize($currentEvent['data']));
            unset($currentEvent['data']);
        }

        return $eventData;
    }
698903
public function createLimit($limit = null)
    {
        // 未指定
        if (!$limit) {
            return [];
        }

        // 如果是字符串,分解吧
        if (is_string($limit)) {
            // 去首尾空格
            $limit = trim($limit);

            // 尝试以空格区分
            if (strpos($limit, ' ')) {
                $limit = explode(' ', $limit);
                return [intval($limit[0]), intval($limit[1])];
            }

            // 尝试以逗号区分
            if (strpos($limit, ',')) {
                $limit = explode(',', $limit);
                return [intval($limit[0]), intval($limit[1])];
            }

            // 尝试以:区分
            if (strpos($limit, ':')) {
                $limit = explode(':', $limit);
                return [intval($limit[0]), intval($limit[1])];
            }

            // 没找到间隔符,只能假设只指定了长度
            return [0, intval($limit)];
        }

        // 如果是整数,好办,只指定了长度
        if (is_int($limit)) {
            return [0, intval($limit)];
        }

        // 分页参数 必须是空或0或字符串或数组
        if (!is_array($limit)) {
            trigger_error('分页参数必须是字符串或数组:' . json($limit), E_USER_ERROR);
        }

        return [intval($limit[0]), intval($limit[1])];
    }
661948
protected function paginateByUsername($username, $url, $limit = Pagination::DEFAULT_LIMIT)
    {
        return $this->paginate($url, ['username' => $username], $limit);
    }
470539
public function resolveNamePattern( $limit = 0, $sequence = '' )
    {
        // Fetch attributes for present identifiers
        $this->fetchContentAttributes();

        // Replace tokens with real values
        $objectName = $this->translatePattern();

        $db = eZDB::instance();

        $limit = $limit ?: self::FIELD_NAME_MAX_SIZE;

        if ( $db->countStringSize( $objectName ) <= $limit )
        {
            return $objectName;
        }

        return preg_replace(
            "/[\pZ\pC]+$/u",
            '',
            $db->truncateString( $objectName, $limit, 'name', $sequence )
        ). $sequence;
    }
1347432
public function rangeLimit(int $max, int $limit) : array
        {
                $response =  $this->_redis->zrevrangebyscore($this->_key, $max, '-inf','WITHSCORES', 'LIMIT', 0, $limit);
                $result   = [];
                for($i=0,$num=count($response);$i<$num;$i++) {
                        $result[$response[$i]] = intval($response[++$i]);
                }
                return $result;
        }
719333
public function getFullName()
    {
        $parentFullName = $this->parentForm ? $this->parentForm->getFullName() : null;
        $fullName = $parentFullName ? $parentFullName . '[' . $this->getName() . ']' : $this->getName();

        return $fullName;
    }
216990
public function findLimited($limit = 0)
    {
        $queryBuilder = $this->createQueryBuilder('c')
            ->where('c.enabled = :enabled')
            ->orderBy('c.position')
            ->setParameters(array(
                'enabled' => true,
            ));

        if ($limit != 0) {
            $queryBuilder->setMaxResults($limit);
        }

        return $queryBuilder->getQuery()->getResult();
    }
1055964
public function findOpen($limit = 999): array
    {
        $queryBuilder = $this->createQuery();

        return (array)$queryBuilder->select('*')
            ->from($this->getTableName())
            ->where($queryBuilder->expr()->eq('call_date', $queryBuilder->createNamedParameter(0)))
            ->setMaxResults($limit)
            ->execute()
            ->fetchAll();
    }
738493
public function getAllDepartments($limit = CAKE_LDAP_SYNC_AD_LIMIT) {
		$fields = [
			$this->alias . '.id',
			$this->alias . '.value',
		];
		$blockExists = $this->hasField('block');
		if ($blockExists) {
			$fields[] = $this->alias . '.block';
		}
		$conditions = [];
		$order = [$this->alias . '.value' => 'asc'];
		$this->recursive = -1;

		return $this->find('all', compact('fields', 'conditions', 'order'));
	}
282693
public function findLastPublications($limit = 5)
    {
        $qb = $this->createQueryBuilder('p');

        $currentTime = new \DateTime();

        $qb->select('p')
            ->where(
                $qb->expr()->lt('p.publicationAt', ':datetime')
            )
            ->andWhere('p.enabled = 1')
            ->orderBy('p.publicationAt', 'DESC')
            ->setMaxResults($limit);

        $qb->setParameter(':datetime', $currentTime);

        return $qb->getQuery()->getResult();
    }
68164
public function getFullMenu($menuName)
    {
        if (is_array($menuName)) {
            $menuName = reset($menuName);
        }

        if (array_key_exists($menuName, $this->menuIterators) && count($this->menuIterators[$menuName]) > 0) {
            return $this->menuIterators[$menuName];
        }

        /** @var $mainMenu Menu */
        $mainMenu = $this->menuManager->findOneBy(
            ['name' => $menuName, 'locale' => $this->request->getLocale()]
        );

        if (!$mainMenu) {
            return [];
        }

        $this->menuIterators[$menuName] = $this->menuManager->getChildrenByStatus(
            $mainMenu,
            false,
            null,
            'ASC',
            false,
            $this->viewStatus
        );

        return $this->menuIterators[$menuName];
    }
794628
public static function getLimitString($limit)
    {
        if (isset($limit) && !empty($limit)) {
            $limitParts = GeneralUtility::trimExplode(',', $limit);
            if (count($limitParts) === 1) {
                return intval($limitParts[0]);
            }
            if (count($limitParts) === 2) {
                return intval($limitParts[0]) . ',' . intval($limitParts[1]);
            }
        }

        return '';
    }