序列化
@return string
191663
public function serialize(): string {
        $data['check']          = $this->check;
        $data['base']           = $this->base;
        $data['index']          = $this->index;
        $data['fail_states']    = $this->fail_states;
        $data['index_count']    = $this->index_count;
        $data['index_code']     = $this->index_code;
        $data['tmp_tree']       = $this->tmp_tree;
        $data['word_states']    = $this->word_states;
        $data['begin_used']     = $this->begin_used;
        return msgpack_pack($data);
    }
1361919
private function _get_table_name()
    {
        if ($this->table_name == '') {
            // 如果是在实例化后使用，则使用当前模型名称
            $current_class = get_class($this);
            if ($current_class != 'model') {
                $this->table_name = strtolower(substr($current_class, strrpos($current_class, '\\')+1, -5));

                // 如果设置了表前缀
                if (true == ($tb_prefix = Config::get('dbconfig.'.$this->db_config_name . '.tb_prefix'))) {
                    $this->table_name = $tb_prefix . $this->table_name;
                }
            } else {
                throw_error('Tablename cannot automatically infer.');
            }
        }

        return $this->table_name;
    }
1252807
public function toString() {
		$output = $this->getStatusLine() . "\r\n";
		foreach ($this->getHeaders() as $header) {
			$output .= $header . "\r\n";
		}
		$output .= "\r\n";
		$output .= $this->getBody();
		return $output;
	}
327654
protected function getSelectString(): string
    {
        $statement = '';
        $fieldSelect    = $this->builder->getSelect();
        $aggregate = $this->builder->getAggregate();
        if (empty($fieldSelect) && empty($aggregate)) {
            return $statement;
        }

        $select = $this->getAggregateStatement($fieldSelect, $aggregate);

        // 字段组拼
        foreach ($select as $column => $alias) {
            // Filter db keyword
            if (array_key_exists($column, $fieldSelect) && trim($column) != '*' && strpos($column, '.') === false) {
                // 判断是否为函数调用
                if (strpos($column, '(') || strpos($column, ')')) {
                    $column = sprintf('%s', $column);
                } else {
                    $column = sprintf('`%s`', $column);
                }
            }

            $statement .= $column;
            if ($alias !== null) {
                $statement .= sprintf(' AS `%s`', $alias);
            }
            $statement .= ', ';
        }

        //select组拼
        $statement = substr($statement, 0, -2);
        if (!empty($statement)) {
            $statement = 'SELECT ' . $statement;
        }

        return $statement;
    }
312539
public function toString()
    {
        $this->parts = array();
        $this->params = array();
        $this->assemble();
        $this->query = join(' ', $this->parts);
        if( $this->interpolation ) {
            $this->interpolateParams();
        }
        return $this->query;
    }
1216271
public function getData()
    {
        $this->validate('txnTime', 'orderId', 'trId');

        $data = array(
            'version'       => $this->getVersion(),  //版本号
            'encoding'      => $this->getEncoding(),  //编码方式
            'certId'        => $this->getTheCertId(),    //证书ID
            'signMethod'    => $this->getSignMethod(),  //签名方法
            'txnType'       => '79',        //交易类型
            'txnSubType'    => '05',        //交易子类
            'bizType'       => '000301',    //业务类型 000301 000902
            'accessType'    => '0',         //接入类型
            'channelType'   => '07',        //渠道类型 05:语音 07:互联网 08:移动
            'encryptCertId' => $this->getEncryptCertId(),
            'merId'         => $this->getMerId(),     //商户代码
            'orderId'       => $this->getOrderId(),     //商户订单号，填写开通并支付交易的orderId
            'txnTime'       => $this->getTxnTime(),    //订单发送时间
            'tokenPayData'  => sprintf('{trId=%s&tokenType=01}', $this->getTrId()), //标记请求者 trId
        );

        $data = $this->filter($data);

        $data['signature'] = $this->sign($data);

        var_dump($data);

        return $data;
    }
141326
public function getPostParams()
    {
        if (is_array($this->postParams)) {
            return $this->postParams;
        }
        
        //$posts = $this->getParsedBody();  // 可能是 xml 对象
        if (($input = static::getPostInputInfo())) {
            $this->postParams = $input[1];
        } else {
            $this->postParams = $_POST;
        }
        
        return $this->postParams;
    }
867328
public function toString()
    {
        $query = '';

        if ($this->sql) {
            return $this->sql;
        }

        switch ($this->type) {
            case 'element':
                $query .= (string) $this->element;
                break;

            case 'select':
                $query .= (string) $this->select;
                $query .= (string) $this->from;

                if ($this->join) {
                    // Special case for joins
                    foreach ($this->join as $join) {
                        $query .= (string) $join;
                    }
                }

                if ($this->where) {
                    $query .= (string) $this->where;
                }

                if ($this->group) {
                    $query .= (string) $this->group;
                }

                if ($this->having) {
                    $query .= (string) $this->having;
                }

                if ($this->order) {
                    $query .= (string) $this->order;
                }

                break;

            case 'union':
                $query .= (string) $this->union;
                break;

            case 'delete':
                $query .= (string) $this->delete;
                $query .= (string) $this->from;

                if ($this->join) {
                    // Special case for joins
                    foreach ($this->join as $join) {
                        $query .= (string) $join;
                    }
                }

                if ($this->where) {
                    $query .= (string) $this->where;
                }

                break;

            case 'update':
                $query .= (string) $this->update;

                if ($this->join) {
                    // Special case for joins
                    foreach ($this->join as $join) {
                        $query .= (string) $join;
                    }
                }

                $query .= (string) $this->set;

                if ($this->where) {
                    $query .= (string) $this->where;
                }

                break;

            case 'insert':
                $query .= (string) $this->insert;

                // Set method
                if ($this->set) {
                    $query .= (string) $this->set;
                } elseif ($this->values) {
                    // Columns-Values method
                    if ($this->columns) {
                        $query .= (string) $this->columns;
                    }

                    $elements = $this->values->getElements();

                    if (!($elements[0] instanceof $this)) {
                        $query .= ' VALUES ';
                    }

                    $query .= (string) $this->values;
                }

                break;

            case 'call':
                $query .= (string) $this->call;
                break;

            case 'exec':
                $query .= (string) $this->exec;
                break;
        }

        // Process Limit
        $query = $this->processLimit($query, $this->limit, $this->offset);

        if ($this->suffix) {
            $query .= ' ' . (string) $this->suffix;
        }

        if ($this->type === 'select' && $this->alias !== null) {
            $query = sprintf('(%s) AS %s', $query, $this->alias);
        }

        return $query;
    }
271607
public function string()
    {
        return
            $this->drive() .
            ':' .
            static::ATOM_SEPARATOR .
            implode(static::ATOM_SEPARATOR, $this->atoms()) .
            ($this->hasTrailingSeparator() ? static::ATOM_SEPARATOR : '');
    }
803998
private function createExist(): string
    {
        // 先构造子查询
        $this->createSelect();

        // 使用子查询构造存在查询
        $this->prepare = $this->db->createExist($this->prepare);
        $this->sql = $this->db->createExist($this->sql);

        $this->tables = [$this->table];
        return $this->prepare;
    }
94156
protected function getUpdateStatement(): string
    {
        $statement = '';
        if (!$this->isUpdate()) {
            return $statement;
        }

        // update语句
        $statement .= $this->getUpdateString();

        // set语句
        if ($this->builder->getUpdateValues() || $this->builder->getCounterValues()) {
            $statement .= ' ' . $this->getUpdateValuesString();
        }

        // where语句
        if ($this->builder->getWhere()) {
            $statement .= ' ' . $this->getWhereString();
        }

        // orderBy语句
        if ($this->builder->getOrderBy()) {
            $statement .= ' ' . $this->getOrderByString();
        }

        // limit语句
        if ($this->builder->getLimit()) {
            $statement .= ' ' . $this->getLimitString();
        }

        return $statement;
    }
1369783
public function renderNav()
    {
        $adminNavId = $this->getAdminNavId();
        $categories = $this->getCategories();

        // 高亮当前页面对应的父菜单
        foreach ($categories as $id => &$category) {
            if (($adminNavId && $adminNavId == $id)
                || $this->isInCategories($category)
            ) {
                $category['active'] = true;
                $this->curSubCategories = $category['navs'];
                break;
            }
        }

        // 默认显示第一个菜单
        if (!$this->curSubCategories && $categories) {
            reset($categories);
            $key = key($categories);
            $categories[$key]['active'] = true;
            $this->curSubCategories = $categories[$key]['navs'];
        }

        return $this->view->render('@admin/admin/nav.php', get_defined_vars());
    }
58647
public function getLink()
    {
        // Step1 查找出链接
        $link = wei()->navLink()->findId($this->request['id'], $this->request);

        // Step2 验证链接对应的菜单,是否属于当前app
        wei()->nav()->curApp()->findOneById($link['navId']);

        // Step3 如果设置了父链接,检查父链接是否属于当前应用
        if ($link['parentId']) {
            $parentLink = $link->getParentLink();
            wei()->nav()->curApp()->findOneById($parentLink['navId']);
        }

        return $link;
    }
334311
public function MakeSign()
	{
		//签名步骤一：按字典序排序参数
		ksort($this->values);
		$string = $this->ToUrlParams();
		//签名步骤二：在string后加入KEY
		$string = $string . "&key=".WxPayConfig::$KEY;
		//签名步骤三：MD5加密
		$string = md5($string);
		//签名步骤四：所有字符转为大写
		$result = strtoupper($string);
		return $result;
	}
354408
public function makeSign()
    {
        //签名步骤一：按字典序排序参数
        ksort($this->values);
        $string = $this->ToUrlParams();
        //签名步骤二：在string后加入KEY
        $string = $string . "&key=".Config::getKEY();
        //签名步骤三：MD5加密
        $string = md5($string);
        //签名步骤四：所有字符转为大写
        $result = strtoupper($string);
        return $result;
    }
1062112
public function getData()
    {
        $this->validate('txnTime', 'fileType', 'settleDate');

        $data = array(
            'version'    => $this->getVersion(),        //版本号
            'encoding'   => $this->getEncoding(),        //编码方式
            'certId'     => $this->getCertId(),    //证书ID
            'txnType'    => '76',        //交易类型
            'signMethod' => $this->getSignMethod(),        //签名方法
            'txnSubType' => '01',        //交易子类
            'bizType'    => '000000',        //业务类型
            'accessType' => '0',        //接入类型
            'merId'      => $this->getMerId(),     //商户代码
            'settleDate' => '0119',        //清算日期
            'txnTime'    => $this->getTxnTime(),    //订单发送时间
            'fileType'   => $this->getFileType(),        //文件类型
        );

        $data = $this->filter($data);

        $data['signature'] = $this->sign($data);

        return $data;
    }
35474
public function serialize(): ?string {
        $arr['#'] = static::version();
        $count = -1;
        foreach ($this->iterate(true) as $key => $value) {
            $count++;
            // 跳过弃用
            if (static::isKeyDeprecated($key)) {
                continue;
            }
            if ($value instanceof \Serializable) {
                $arr[$count] = serialize($value);
            } else {
                $arr[$count] = $value;
            }
        }
        return static::_pack($arr);
    }