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 |
||
9 | class ShortApi extends BaseApi |
||
10 | { |
||
11 | /** |
||
12 | * 生成短连接 |
||
13 | * |
||
14 | * @param string $long_url 需要转换的长链接,支持http://、https://、weixin://wxpay 格式的url |
||
15 | * @param string $action 此处填long2short,代表长链接转短链接 |
||
16 | * |
||
17 | * @return bool. 成功返回ok |
||
|
|||
18 | */ |
||
19 | public function url($long_url, $action = 'long2short') |
||
38 | |||
39 | /** |
||
40 | * 获取当前URL |
||
41 | * |
||
42 | * @return string |
||
43 | */ |
||
44 | View Code Duplication | public static function current() |
|
58 | } |
||
59 |
This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.