1 | <?php |
||
2 | |||
3 | /* |
||
4 | * This file is part of the overtrue/wechat. |
||
5 | * |
||
6 | * (c) overtrue <[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 EasyWeChat; |
||
13 | |||
14 | /** |
||
15 | * Class Factory. |
||
16 | * |
||
17 | * @method static \EasyWeChat\Payment\Application payment(array $config) |
||
18 | * @method static \EasyWeChat\MiniProgram\Application miniProgram(array $config) |
||
19 | * @method static \EasyWeChat\OpenPlatform\Application openPlatform(array $config) |
||
20 | * @method static \EasyWeChat\OfficialAccount\Application officialAccount(array $config) |
||
21 | * @method static \EasyWeChat\BasicService\Application basicService(array $config) |
||
22 | * @method static \EasyWeChat\Work\Application work(array $config) |
||
23 | * @method static \EasyWeChat\OpenWork\Application openWork(array $config) |
||
24 | * @method static \EasyWeChat\MicroMerchant\Application microMerchant(array $config) |
||
25 | */ |
||
26 | class Factory |
||
27 | { |
||
28 | /** |
||
29 | * @param string $name |
||
30 | * @param array $config |
||
31 | * |
||
32 | * @return \EasyWeChat\Kernel\ServiceContainer |
||
33 | */ |
||
34 | 1 | public static function make($name, array $config) |
|
35 | { |
||
36 | 1 | $namespace = Kernel\Support\Str::studly($name); |
|
37 | 1 | $application = "\\EasyWeChat\\{$namespace}\\Application"; |
|
38 | |||
39 | 1 | return new $application($config); |
|
40 | } |
||
41 | |||
42 | /** |
||
43 | * Dynamically pass methods to the application. |
||
44 | * |
||
45 | * @param string $name |
||
46 | * @param array $arguments |
||
47 | * |
||
48 | * @return mixed |
||
49 | */ |
||
50 | 1 | public static function __callStatic($name, $arguments) |
|
51 | { |
||
52 | 1 | return self::make($name, ...$arguments); |
|
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||
53 | } |
||
54 | } |
||
55 |