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