<commit_before><?php

namespace Doubear\Paysoul;

use Doubear\Paysoul\Contracts\Jsonable;

/**
 * 交易参数抽象对象，便于快速创建标准交易
 */
class Trade implements Jsonable
{
    private $data = [];

    /**
     * 构建新交易实例
     *
     * @param string $serialId 商户本地订单序列号
     * @param string $subject 交易类目
     * @param integer $amount 交易金额，单位分
     */
    public function __construct(string $serialId, string $subject, int $amount)
    {
        $this->data['out_trade_no'] = $serialId;
        $this->data['subject']  = $subject;
        $this->data['total_amount']   = $amount;
    }

    /**
     * 设置商户本地订单序列号
     *
     * @param string $serialId
     */
    public function setSerialId(string $serialId)
    {
        $this->data['out_trade_no'] = $serialId;
    }

    /**
     * 设置交易类目
     *
     * @param string $subject
     */
    public function setSubject(string $subject)
    {
        $this->data['subject'] = $subject;
    }

    /**
     * 设置交易金额
     *
     * @param integer $amount 单位分
     */
    public function setAmount(int $amount)
    {
        $this->data['total_amount'] = $amount;
    }

    /**
     * 添加自定义参数
     *
     * @param  string $key
     * @param  string $value
     *
     * @return void
     */
    public function appendExtra(string $key, string $value)
    {
        $this->data[$key] = $value;
    }

    /**
     * @return string
     */
    public function toJson()
    {
        return json_encode($this->data);
    }
}
<commit_msg>fixed amount error;<commit_after><?php

namespace Doubear\Paysoul;

use Doubear\Paysoul\Contracts\Jsonable;

/**
 * 交易参数抽象对象，便于快速创建标准交易
 */
class Trade implements Jsonable
{
    private $data = [];

    /**
     * 构建新交易实例
     *
     * @param string $serialId 商户本地订单序列号
     * @param string $subject 交易类目
     * @param integer $amount 交易金额，单位分
     */
    public function __construct(string $serialId, string $subject, int $amount)
    {
        $this->data['out_trade_no'] = $serialId;
        $this->data['subject']      = $subject;
        $this->data['total_amount'] = number_format($amount / 100, 2);
    }

    /**
     * 设置商户本地订单序列号
     *
     * @param string $serialId
     */
    public function setSerialId(string $serialId)
    {
        $this->data['out_trade_no'] = $serialId;
    }

    /**
     * 设置交易类目
     *
     * @param string $subject
     */
    public function setSubject(string $subject)
    {
        $this->data['subject'] = $subject;
    }

    /**
     * 设置交易金额
     *
     * @param integer $amount 单位分
     */
    public function setAmount(int $amount)
    {
        $this->data['total_amount'] = number_format($amount / 100, 2);
    }

    /**
     * 添加自定义参数
     *
     * @param  string $key
     * @param  string $value
     *
     * @return void
     */
    public function appendExtra(string $key, string $value)
    {
        $this->data[$key] = $value;
    }

    /**
     * @return string
     */
    public function toJson()
    {
        return json_encode($this->data);
    }
}

{'fraction_non_alphanumeric': 0.14050972501676728, 'fraction_numerical': 0.0026827632461435278, 'mean_word_length': 1.98001998001998, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6385076', 'n_tokens_mistral': 1101, 'n_tokens_neox': 1121, 'n_words': 194}