Files
kiri-wchat/wchat/wx/V3/TransferDetail.php
T
2023-11-07 17:26:26 +08:00

45 lines
1.2 KiB
PHP

<?php
namespace wchat\wx\V3;
use JetBrains\PhpStorm\ArrayShape;
class TransferDetail
{
public function __construct(
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 = ''
)
{
}
/**
* @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,
];
}
}