Total Complexity | 7 |
Total Lines | 47 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
13 | class BaseProvider implements ProviderInterface |
||
14 | { |
||
15 | protected $config = []; |
||
16 | public function __construct($config) |
||
17 | { |
||
18 | $this->config = $config; |
||
19 | } |
||
20 | |||
21 | /** |
||
22 | * @param string $shortcut |
||
23 | * @param array $params |
||
24 | * @return mixed |
||
25 | */ |
||
26 | public function __call(string $shortcut, array $params=[]) |
||
27 | { |
||
28 | $class = str_replace('Provider','Service',static::class).'\\' . Str::studly($shortcut); |
||
29 | if(!class_exists($class)){ |
||
30 | throw new TException("Chinaums:{$class}类不存在"); |
||
31 | } |
||
32 | |||
33 | return new $class($this->config,$params); |
||
34 | } |
||
35 | |||
36 | /** |
||
37 | * @param $contents |
||
38 | * @return bool |
||
39 | */ |
||
40 | public function callback($contents) |
||
52 | } |
||
53 | |||
54 | /** |
||
55 | * @return string |
||
56 | */ |
||
57 | public function success() |
||
60 | } |
||
61 | } |
||
62 |