Files
kiri-wchat/wx/V3/TransferDetail.php
T

53 lines
1.4 KiB
PHP
Raw Normal View History

2022-09-09 16:42:55 +08:00
<?php
namespace wchat\wx\V3;
use JetBrains\PhpStorm\ArrayShape;
class TransferDetail
{
2023-11-14 00:07:18 +08:00
/**
* @param string $out_detail_no
* @param int|float $transfer_amount
* @param string $transfer_remark
* @param string $openid
* @param string $user_name
*/
2023-11-07 16:14:59 +08:00
public function __construct(
2023-11-07 17:26:26 +08:00
readonly public string $out_detail_no,
readonly public int|float $transfer_amount,
readonly public string $transfer_remark,
readonly public string $openid,
readonly public string $user_name = ''
2023-11-07 16:14:59 +08:00
)
{
}
2022-09-09 16:42:55 +08:00
2023-11-07 16:14:59 +08:00
/**
* @return array
*/
#[ArrayShape(['out_detail_no' => "string", 'transfer_amount' => "float|int", 'transfer_remark' => "string", 'openid' => "string", 'user_name' => "string"])]
public function toArray(): array
{
if (empty($this->user_name)) {
return [
'out_detail_no' => $this->out_detail_no,
'transfer_amount' => $this->transfer_amount,
'transfer_remark' => $this->transfer_remark,
'openid' => $this->openid,
];
}
return [
'out_detail_no' => $this->out_detail_no,
'transfer_amount' => $this->transfer_amount,
'transfer_remark' => $this->transfer_remark,
'openid' => $this->openid,
'user_name' => $this->user_name,
];
}
2022-09-09 16:42:55 +08:00
}