1 | <?php |
||
2 | |||
3 | namespace EasyIM; |
||
4 | |||
5 | /** |
||
6 | * Class Factory |
||
7 | * |
||
8 | * @method static \EasyIM\TencentIM\Application TencentIM(array $config) |
||
9 | */ |
||
10 | class Factory |
||
11 | { |
||
12 | /** |
||
13 | * @param string $name |
||
14 | * @param array $config |
||
15 | * |
||
16 | * @return \EasyIM\Kernel\ServiceContainer |
||
17 | */ |
||
18 | 1 | public static function make($name, array $config) |
|
19 | { |
||
20 | 1 | $namespace = Kernel\Support\Str::studly($name); |
|
21 | |||
22 | 1 | $application = "\\EasyIM\\{$namespace}\\Application"; |
|
23 | |||
24 | 1 | return new $application($config); |
|
25 | } |
||
26 | |||
27 | /** |
||
28 | * Dynamically pass methods to the application. |
||
29 | * |
||
30 | * @param string $name |
||
31 | * @param array $arguments |
||
32 | * |
||
33 | * @return mixed |
||
34 | */ |
||
35 | 1 | public static function __callStatic($name, $arguments) |
|
36 | { |
||
37 | 1 | return self::make($name, ...$arguments); |
|
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||
38 | } |
||
39 | } |
||
40 |