Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
| 1 | <?php |
||
| 16 | class Client extends BaseClient |
||
| 17 | { |
||
| 18 | /** |
||
| 19 | * 统一收单交易退款接口 |
||
| 20 | * |
||
| 21 | * 当交易发生之后一段时间内,由于买家或者卖家的原因需要退款时,卖家可以通过退款接口将支付款退还给买家,支付宝将在收到退款请求并且验证成功之后,按照退款规则将支付款按原路退到买家帐号上 |
||
| 22 | * 交易超过约定时间(签约时设置的可退款时间)的订单无法进行退款 支付宝退款支持单笔交易分多次退款,多次退款需要提交原支付订单的商户订单号和设置不同的退款单号 |
||
| 23 | * 一笔退款失败后重新提交,要采用原来的退款单号 |
||
| 24 | * 总退款金额不能超过用户实际支付金额 |
||
| 25 | * |
||
| 26 | * @param AlipayTradeRefundContentBuilder $builder |
||
| 27 | * @author kaylv <[email protected]> |
||
| 28 | * @return array|\Kaylyu\Alipay\Kernel\Support\Collection|string |
||
| 29 | */ |
||
| 30 | View Code Duplication | public function refund(AlipayTradeRefundContentBuilder $builder) |
|
| 59 | } |
||
| 60 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.