1 | <?php |
||
2 | |||
3 | /* |
||
4 | * This file is part of the docodeit/wechat. |
||
5 | * |
||
6 | * (c) docodeit <[email protected]> |
||
7 | * |
||
8 | * This source file is subject to the MIT license that is bundled |
||
9 | * with this source code in the file LICENSE. |
||
10 | */ |
||
11 | |||
12 | namespace JinWeChat; |
||
13 | |||
14 | /** |
||
15 | * 入口文件. |
||
16 | * |
||
17 | * @method static OfficialAccount\Application officialAccount(array $config) |
||
18 | **/ |
||
19 | class Factory |
||
20 | { |
||
21 | /** |
||
22 | * @param $name |
||
23 | * @param array $config |
||
24 | * |
||
25 | * @return mixed |
||
26 | */ |
||
27 | public static function make($name, array $config) |
||
28 | { |
||
29 | $application = "\\JinWeChat\\{$name}\\Application"; |
||
30 | |||
31 | return new $application($config); |
||
32 | } |
||
33 | |||
34 | /** |
||
35 | * @param $name |
||
36 | * @param $args |
||
37 | * |
||
38 | * @return mixed |
||
39 | */ |
||
40 | public static function __callStatic($name, $args) |
||
41 | { |
||
42 | $name = ucwords(str_replace(['-', '_'], ' ', $name)); |
||
43 | |||
44 | return self::make($name, ...$args); |
||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||
45 | } |
||
46 | } |
||
47 |