Factory.php 990 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. /**
  3. * 重庆赤晓店信息科技有限公司
  4. * https://www.chixiaodian.com
  5. * Copyright (c) 2023 赤店商城 All rights reserved.
  6. */
  7. namespace ByteDance;
  8. /**
  9. * Class Factory.
  10. *
  11. * @method static \ByteDance\MiniProgram\Application miniProgram(array $config)
  12. */
  13. class Factory
  14. {
  15. /**
  16. * @param array $config
  17. *
  18. * @return \ByteDance\Kernel\ServiceContainer
  19. */
  20. public static function make($name, array $config)
  21. {
  22. \Yii::warning([$name, $config]);
  23. $namespace = Kernel\Support\Str::studly($name);
  24. $application = "\\ByteDance\\{$namespace}\\Application";
  25. return new $application($config);
  26. }
  27. /**
  28. * Dynamically pass methods to the application.
  29. *
  30. * @param string $name
  31. * @param array $arguments
  32. *
  33. * @return mixed
  34. */
  35. public static function __callStatic($name, $arguments)
  36. {
  37. return self::make($name, ...$arguments);
  38. }
  39. }