Total Complexity | 8 |
Total Lines | 92 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
15 | class DingDanXiaService extends Service |
||
16 | { |
||
17 | /** |
||
18 | * 接口秘钥 |
||
19 | * @var string |
||
20 | */ |
||
21 | private $app_key; |
||
22 | |||
23 | /** |
||
24 | * API接口 |
||
25 | * @var string |
||
26 | */ |
||
27 | private $method; |
||
28 | |||
29 | /** |
||
30 | * 需要发送的的参数 |
||
31 | * @var |
||
32 | */ |
||
33 | private $param; |
||
34 | |||
35 | /** |
||
36 | * 响应内容 |
||
37 | * @var |
||
38 | */ |
||
39 | private $output; |
||
40 | |||
41 | /** |
||
42 | * 接口秘钥,请登录后台获取 |
||
43 | * @param string $appKey |
||
44 | * @return $this |
||
45 | */ |
||
46 | public function appKey(string $appKey): self |
||
47 | { |
||
48 | $this->app_key = $appKey; |
||
49 | return $this; |
||
50 | } |
||
51 | |||
52 | /** |
||
53 | * 自定义接口 |
||
54 | * @param string $method |
||
55 | * @return $this |
||
56 | */ |
||
57 | public function setMethod($method = ''): self |
||
58 | { |
||
59 | $this->method = $method; |
||
60 | return $this; |
||
61 | } |
||
62 | |||
63 | /** |
||
64 | * 请求参数 |
||
65 | * @param array $param |
||
66 | * @return $this |
||
67 | */ |
||
68 | public function param(array $param): self |
||
72 | } |
||
73 | |||
74 | /** |
||
75 | * 获取配置信息 |
||
76 | * @return $this |
||
77 | */ |
||
78 | private function getConfig(): self |
||
79 | { |
||
80 | $this->app_key = config('dtapp.dingdanxia.app_key'); |
||
|
|||
81 | return $this; |
||
82 | } |
||
83 | |||
84 | /** |
||
85 | * 返回Array |
||
86 | * @return array|mixed |
||
87 | * @throws DtaException |
||
88 | */ |
||
89 | public function toArray() |
||
107 | } |
||
108 | } |
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.