1 | <?php |
||
21 | final class ApiStore |
||
22 | { |
||
23 | /** |
||
24 | * The app key of calling the interface. |
||
25 | * |
||
26 | * @var string |
||
27 | */ |
||
28 | public $apikey; |
||
29 | |||
30 | public static $supportedApis = [ |
||
31 | 'ip' => 'light\apistore\apis\Ip', |
||
32 | 'phone' => 'light\apistore\apis\Phone', |
||
33 | 'translate' => 'light\apistore\apis\Translate', |
||
34 | 'idcard' => 'light\apistore\apis\IdCard', |
||
35 | 'currency' => 'light\apistore\apis\Currency', |
||
36 | 'pullword' => 'light\apistore\apis\PullWord', |
||
37 | 'distance' => 'light\apistore\apis\Distance', |
||
38 | ]; |
||
39 | |||
40 | /** |
||
41 | * Init. |
||
42 | * |
||
43 | * @param string $apikey 调用接口的API key |
||
44 | */ |
||
45 | 18 | public function __construct($apikey) |
|
49 | /** |
||
50 | * Implement the __get magic method. |
||
51 | * |
||
52 | * @param string $name The property name or the api name |
||
53 | * |
||
54 | * @throws InvalidaCallException |
||
55 | * @throws UnknownPropertyException |
||
56 | * |
||
57 | * @return mixed |
||
58 | */ |
||
59 | 18 | public function __get($name) |
|
68 | |||
69 | /** |
||
70 | * Invoke methods. |
||
71 | * |
||
72 | * @param string $name the name of method try to invoke |
||
73 | * @param array $params the params passed to the method |
||
74 | * |
||
75 | * @throws InvalidCallException |
||
76 | * |
||
77 | * @return mixed the method result of calling |
||
78 | */ |
||
79 | 1 | public function __call($name, $params) |
|
85 | } |
||
86 |