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 |
||
| 21 | class Client extends BaseClient |
||
| 22 | { |
||
| 23 | /** |
||
| 24 | * Query MerchantPay. |
||
| 25 | * |
||
| 26 | * @param array $params |
||
| 27 | * |
||
| 28 | * @return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string |
||
| 29 | */ |
||
| 30 | View Code Duplication | public function info(array $params) |
|
| 39 | |||
| 40 | /** |
||
| 41 | * Send MerchantPay. |
||
| 42 | * |
||
| 43 | * @param array $params |
||
| 44 | * |
||
| 45 | * @return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string |
||
| 46 | */ |
||
| 47 | View Code Duplication | public function send(array $params) |
|
| 56 | } |
||
| 57 |