设置key自增
@param string $field
@param int $num
@return int
515537
public function increment(string $field, int $num) : int
        {
                return intval($this->_redis->hincrby($this->_key, $field, $num));
        }
1246244
protected function key($field)
    {
        if (method_exists($this->model, 'getTrueKey')) {
            return $this->model->getTrueKey($field);
        }

        return $field;
    }
789646
public function ne($num) {
        if (!$this->_isValid) {
            return $this;
        }

        if ($this->_unsafeVar == $num) {
            $this->_isValid = false;
        }
        return $this;
    }
162383
public function count($field = '*', $isMulti = false, $useMaster = false)
    {
        $cmd = [
            'count' => $this->getRealTableName(key($this->table)),
            'query' => $this->sql['where']
        ];

        $count = $this->runMongoCommand($cmd, $useMaster);
        return intval($count[0]['n']);
    }
405283
public function setField($field)
    {
        if (!is_numeric($field)) {
            $errMsg = sprintf('Аргумент должен быть числом. Актуальное значение %s', $field);
            throw new ArgumentNotNumericException($errMsg);
        }

        $this->field = (integer)$field;

        return $this;
    }
190091
private static void writeField(final OutputStream out, final int num) throws IOException {
    final byte[] bytes = BigInteger.valueOf(num).toByteArray();
    writeField(out, bytes);
  }
801246
public function hashGet($key, $field) {
        $option = $this->getHashOption($key);
        return isset($option[$field]) ? $option[$field] : null;
    }
46846
protected function get_field($field) {
        $fieldname = calculator::using_attempts_string_id($this->whichattempts).$field;
        return $this->{$fieldname};
    }
225173
final public function max($field)
    {

        if (!is_array($fields)) {
            if (strpos($fields, ',') !== FALSE) {
                $fields = explode(',', $fields);
            } else {
                $fields = array($fields);
            }
        }

        foreach ($fields as $field) {
            $field = trim($field);
            if (!is_int($field) && empty($field)) {
                continue; //if empty and not zero?
            }
            $this->arraySelect[] = $field;

            if ($this->arrayCaching) {
                $this->arrayCacheSelect[] = $field;
                $this->arrayCacheExists[] = 'select';
            }
        }

        return $this;
    }
821517
private function encodeNumber($num)
    {
        $encodeString = '';

        while ($num >= 0x20) {
            $nextValue = (0x20 | ($num & 0x1f)) + 63;
            $encodeString .= chr($nextValue);
            $num >>= 5;
        }
        $finalValue = $num + 63;
        $encodeString .= chr($finalValue);
        return $encodeString;
    }
255481
protected function toWords($num)
    {
        $ret = '';
        $num = strval($num);

        if ((int)$num === 0) {
            return self::$digits[0];
        }

        if (substr($num, 0, 1) == '-') {
            $ret = $this->minus . $this->wordSeparator;
            $num = substr($num, 1);
        }

        $num = preg_replace('/^0+/', '', $num);
        $num_length = strlen($num);

        if ($num_length % 3 !== 0) {
            $num = str_pad($num, $num_length + (3-($num_length%3)), '0', STR_PAD_LEFT);
        }

        $groups = str_split($num, 3);
        $g_index = count($groups) - 1;
        foreach ($groups as $i => $g) {

            if ((int)$g[0] > 1)
                $ret .= self::$digits[$g[0]] . $this->wordSeparator;

            if ((int)$g[0] > 0)
                $ret .= "yüz" . $this->wordSeparator;

            if ((int)$g[1] > 0)
                $ret .= self::$digits_second[$g[1]] . $this->wordSeparator;

            if ((int)$g[2] > 0 && (($num_length === 4 && $i === 0 && (int)$g[2] <= 1) === false))
                $ret .= self::$digits[$g[2]] . $this->wordSeparator;

            if ((int)$g > 0)
                $ret .= self::$exponent[$g_index] . $this->wordSeparator;

            $g_index--;
        }

        return $ret;
    }
1223322
public function iShouldSeeSelectChoices($field, $num)
    {
        $selector = sprintf('#select2-%s-results li', $field);

        $this->assertSession()->elementsCount('css', $selector, intval($num));
    }
873835
public function chunk($num = 100, callable $func)
    {
        $this->paramsAutoReset();
        $start = 0;
        $backComdition = $this->sql;//sql组装
        $backTable = $this->table;//操作的表
        $backJoin = $this->join;//是否内联
        $backleftJoin = $this->leftJoin;//是否左联结
        $backrightJoin = $this->rightJoin;//是否右联
        $backBindParams = $this->bindParams;

        while ($result = $this->select($start, $num)) {
            if ($func($result) === false) {
                break;
            }
            $start += count($result);

            $this->sql = $backComdition;//sql组装
            $this->table = $backTable;//操作的表
            $this->join = $backJoin;//是否内联
            $this->leftJoin = $backleftJoin;//是否左联结
            $this->rightJoin = $backrightJoin;//是否右联
            $this->bindParams = $backBindParams;
        }
        $this->paramsAutoReset();
        $this->reset();
        $this->clearBindParams();
    }
130194
public function random($num = 1)
	{
		if($this->isSelectBefore)
		{
			$this->__selectBefore();
		}
		$opt = $this->getOption();
		$this->setOption($opt);
		$result = $this->field(array('count(*)'=>'count','max(' . $this->pk . ')'=>'max','min(' . $this->pk . ')'=>'min'))->getOne();
		$this->setOption($opt);
		$max_count=$result['max']-$result['count']+$num;
		// 随机出记录位置
		$limits = randomNums($result['min'], $result['max'], $max_count);
		$this->where(array($this->pk=>array('in',$limits)));
		$this->limit($num);
		$results = $this->orderByField($this->pk,$limits)->select();
		$this->__selectAfter($results,$opt);
		return $results;
	}
685398
private static function _validateNumber($num): bool
    {
        if (is_int($num)) {
            return true;
        }
        if (is_string($num) && preg_match('/-?\d+/', $num)) {
            return true;
        }
        return false;
    }
705866
public static function at($string, $num)
    {
        $num = (int) $num;

        if (Utf8String::strlen($string) < $num) {
            return null;
        }

        return Utf8String::substr($string, $num, 1);
    }
929475
protected function validate_numeric($field, $input, $param = null)
    {
        if (!isset($input[$field]) || empty($input[$field])) {
            return;
        }

        if (!is_numeric($input[$field])) {
            return array(
                'field' => $field,
                'value' => $input[$field],
                'rule' => __FUNCTION__,
                'param' => $param,
            );
        }
    }