Total Complexity | 3 |
Total Lines | 37 |
Duplicated Lines | 0 % |
Coverage | 87.5% |
Changes | 3 | ||
Bugs | 0 | Features | 2 |
1 | <?php |
||
26 | class Alipay |
||
27 | { |
||
28 | /** |
||
29 | * make. |
||
30 | * |
||
31 | * @param $name |
||
32 | * @param array $config |
||
33 | * |
||
34 | * @return mixed |
||
35 | * |
||
36 | * @throws \WannanBigPig\Alipay\Kernel\Exceptions\ApplicationException |
||
37 | */ |
||
38 | 20 | public static function make($name, array $config) |
|
39 | { |
||
40 | 20 | $namespace = Str::studly($name); |
|
41 | 20 | $application = __NAMESPACE__."\\{$namespace}\\Application"; |
|
42 | |||
43 | 20 | if (class_exists($application)) { |
|
44 | // Instantiation application |
||
45 | 20 | return new $application($config); |
|
46 | } |
||
47 | throw new ApplicationException("Application [{$name}] does not exist"); |
||
48 | } |
||
49 | |||
50 | /** |
||
51 | * Dynamically pass methods to the application. |
||
52 | * |
||
53 | * @param $name |
||
54 | * @param $arguments |
||
55 | * |
||
56 | * @return mixed |
||
57 | * |
||
58 | * @throws \WannanBigPig\Alipay\Kernel\Exceptions\ApplicationException |
||
59 | */ |
||
60 | 20 | public static function __callStatic($name, $arguments) |
|
63 | } |
||
64 | } |
||
65 |