Conditions | 1 |
Paths | 1 |
Total Lines | 60 |
Code Lines | 58 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
1 | <?php |
||
51 | public function __construct($apiKey, $secretKey) |
||
52 | { |
||
53 | $this->_apiKey = $apiKey; |
||
54 | $this->_secretKey = $secretKey; |
||
55 | $this->_errorMap = [ |
||
56 | 0 => '成功', |
||
57 | 1 => '服务器内部错误,请再次请求', |
||
58 | 2 => '服务暂不可用,请再次请求', |
||
59 | 3 => '调用的 API 不存在,请检查后重新尝试', |
||
60 | 4 => '集群超限额', |
||
61 | 6 => '无权限访问该用户数据', |
||
62 | 13 => '获取 token 失败', |
||
63 | 14 => 'IAM鉴权失败', |
||
64 | 15 => '应用不存在或者创建失败', |
||
65 | 17 => '每天请求量超限额', |
||
66 | 18 => 'QPS 超限额', |
||
67 | 19 => '请求总量超限额', |
||
68 | 100 => '包含了无效或错误参数,请检查代码', |
||
69 | 110 => 'Access Token 失效', |
||
70 | 111 => 'Access token 过期', |
||
71 | 216100 => '请求中包含非法参数,请检查后重新尝试', |
||
72 | 216101 => '缺少必须的参数,请检查参数是否有遗漏', |
||
73 | 216102 => '请求了不支持的服务,请检查调用的 url', |
||
74 | 216103 => '请求中某些参数过长,请检查后重新尝试', |
||
75 | 216110 => 'appid 不存在,请重新核对信息是否为后台应用列表中的 appid', |
||
76 | 216200 => '图片为空,请检查后重新尝试', |
||
77 | 216201 => '上传的图片格式错误,现阶段我们支持的图片格式为:PNG、JPG、JPEG、BMP,请进行转码或更换图片', |
||
78 | 216202 => '上传的图片大小错误,现阶段我们支持的图片大小为:base64编码后小于4M,分辨率不高于4096*4096,请重新上传图片', |
||
79 | 216203 => '上传的图片 base64 编码有误,请校验 base64 编码方式,并重新上传图片', |
||
80 | 216630 => '识别错误,请再次请求', |
||
81 | 216631 => '识别银行卡错误,出现此问题的原因一般为:您上传的图片非银行卡正面,上传了异形卡的图片或上传的银行卡正品图片不完整', |
||
82 | 216633 => '识别身份证错误,出现此问题的原因一般为:您上传了非身份证图片或您上传的身份证图片不完整', |
||
83 | 216634 => '检测错误,请再次请求', |
||
84 | 282000 => '服务器内部错误,请再次请求', |
||
85 | 282002 => '编码错误,请使用GBK编码', |
||
86 | 282003 => '请求参数缺失', |
||
87 | 282004 => '请求中包含非法参数,请检查后重新尝试', |
||
88 | 282005 => '处理批量任务时发生部分或全部错误,请根据具体错误码排查', |
||
89 | 282006 => '批量任务处理数量超出限制,请将任务数量减少到 10 或 10 以下', |
||
90 | 282008 => '仅支持 GBK 和 UTF-8,其余为不支持的字符编码,请检查后重新尝试', |
||
91 | 282011 => '未训练或未生效该接口', |
||
92 | 282100 => '图片压缩转码错误', |
||
93 | 282101 => '长图片切分数量超限', |
||
94 | 282102 => '未检测到图片中识别目标', |
||
95 | 282103 => '图片目标识别错误', |
||
96 | 282114 => 'URL 长度超过 1024 字节或为 0', |
||
97 | 282130 => '当前查询无结果返回,出现此问题的原因一般为:参数配置存在问题,请检查后重新尝试', |
||
98 | 282131 => '输入长度超限,请查看文档说明', |
||
99 | 282133 => '接口参数缺失', |
||
100 | 282134 => '输入为空', |
||
101 | 282300 => 'word 不在算法词典中', |
||
102 | 282301 => 'word_1 提交的词汇暂未收录,无法比对相似度', |
||
103 | 282302 => 'word_2 提交的词汇暂未收录,无法比对相似度', |
||
104 | 282303 => 'word_1和word_2暂未收录,无法比对相似度', |
||
105 | 282808 => 'request id 不存在', |
||
106 | 282809 => '返回结果请求错误(不属于 excel 或 json)', |
||
107 | 282810 => '图像识别错误', |
||
108 | 283300 => '入参格式有误,可检查下图片编码、代码格式是否有误', |
||
109 | 336000 => '服务器内部错误,请再次请求', |
||
110 | 336001 => '入参格式有误,比如缺少必要参数、图片base64编码错误等等,可检查下图片编码、代码格式是否有误', |
||
111 | ]; |
||
306 |
Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a mixed type is assigned to a property that is type hinted more strictly.
For example, imagine you have a variable
$accountId
that can either hold an Id object or false (if there is no account id yet). Your code now assigns that value to theid
property of an instance of theAccount
class. This class holds a proper account, so the id value must no longer be false.Either this assignment is in error or a type check should be added for that assignment.