Total Complexity | 2 |
Total Lines | 38 |
Duplicated Lines | 0 % |
Changes | 3 | ||
Bugs | 1 | Features | 0 |
1 | <?php |
||
10 | abstract class Sender |
||
11 | { |
||
12 | protected $config = []; |
||
13 | |||
14 | abstract public function send($data); |
||
15 | |||
16 | abstract public function checkConfig(); |
||
17 | |||
18 | abstract public function checkMsgFormate($msg); |
||
19 | |||
20 | public function setConfig($config) |
||
21 | { |
||
22 | $this->config = $config; |
||
23 | // 检查配置是否完整 |
||
24 | $this->checkConfig(); |
||
25 | |||
26 | return $this; |
||
27 | } |
||
28 | |||
29 | /** |
||
30 | * 从数据库获取配置. |
||
31 | * |
||
32 | * @param $tag 配置标识 |
||
|
|||
33 | */ |
||
34 | // protected function getConfigByDatabase($signature) |
||
35 | // { |
||
36 | // if (!is_string($signature)) { |
||
37 | // throw new \Exception("请传入config tag"); |
||
38 | // } |
||
39 | // if (!$config) { |
||
40 | // throw new \Exception("无效的config signature"); |
||
41 | // } |
||
42 | |||
43 | // $this->config = $config; |
||
44 | // } |
||
45 | public function post($url, $data) |
||
48 | } |
||
49 | } |
||
50 |