1 | <?php |
||
5 | abstract class Agent |
||
6 | { |
||
7 | const SUCCESS = 'success'; |
||
8 | const INFO = 'info'; |
||
9 | const CODE = 'code'; |
||
10 | |||
11 | /** |
||
12 | * agent config |
||
13 | * |
||
14 | * @var array |
||
15 | */ |
||
16 | protected $config; |
||
17 | |||
18 | /** |
||
19 | * sent result info |
||
20 | * |
||
21 | * @var array |
||
22 | */ |
||
23 | protected $result = [ |
||
24 | self::SUCCESS => false, |
||
25 | self::INFO => '', |
||
26 | self::CODE => 0, |
||
27 | ]; |
||
28 | |||
29 | /** |
||
30 | 18 | * construct for create a instance |
|
31 | * |
||
32 | 18 | * @param array $config |
|
33 | 18 | */ |
|
34 | public function __construct(array $config = []) |
||
38 | |||
39 | /** |
||
40 | * sms send process |
||
41 | * |
||
42 | * @param $tempId |
||
43 | * @param $to |
||
44 | * @param array $data |
||
45 | * @param $content |
||
46 | */ |
||
47 | abstract public function sendSms($tempId, $to, array $data, $content); |
||
48 | |||
49 | /** |
||
50 | * content sms send process |
||
51 | * |
||
52 | * @param $to |
||
53 | * @param $content |
||
54 | */ |
||
55 | abstract public function sendContentSms($to, $content); |
||
56 | |||
57 | /** |
||
58 | * template sms send process |
||
59 | * |
||
60 | * @param $tempId |
||
61 | * @param $to |
||
62 | * @param array $data |
||
63 | */ |
||
64 | abstract public function sendTemplateSms($tempId, $to, array $data); |
||
65 | |||
66 | /** |
||
67 | * voice verify |
||
68 | * |
||
69 | * @param $to |
||
70 | * @param $code |
||
71 | */ |
||
72 | abstract public function voiceVerify($to, $code); |
||
73 | |||
74 | /** |
||
75 | * http post request |
||
76 | * |
||
77 | * @codeCoverageIgnore |
||
78 | * |
||
79 | * @param $url |
||
80 | * @param array $query |
||
81 | * @param $port |
||
82 | * |
||
83 | * @return mixed |
||
84 | */ |
||
85 | public function sockPost($url, $query, $port = 80) |
||
111 | |||
112 | /** |
||
113 | 27 | * cURl |
|
114 | * |
||
115 | 27 | * @codeCoverageIgnore |
|
116 | * |
||
117 | * @param string $url [请求的URL地址] |
||
118 | * @param array $params [请求的参数] |
||
119 | * @param int|bool $isPost [是否采用POST形式] |
||
120 | * |
||
121 | * @return array ['request', 'response'] |
||
122 | * request:是否请求成功 |
||
123 | * response:响应数据 |
||
124 | */ |
||
125 | 3 | public function curl($url, array $params = [], $isPost = false) |
|
151 | |||
152 | /** |
||
153 | * get result |
||
154 | * |
||
155 | * @return array |
||
156 | */ |
||
157 | public function getResult() |
||
161 | |||
162 | /** |
||
163 | * set result |
||
164 | * |
||
165 | * @param $name |
||
166 | * @param $value |
||
167 | */ |
||
168 | public function result($name, $value) |
||
174 | |||
175 | /** |
||
176 | * overload object attribute |
||
177 | * |
||
178 | * @param $name |
||
179 | * |
||
180 | * @return mixed |
||
181 | */ |
||
182 | public function __get($name) |
||
190 | } |
||
191 |
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVar
assignment in line 1 and the$higher
assignment in line 2 are dead. The first because$myVar
is never used and the second because$higher
is always overwritten for every possible time line.