Factory.php 867 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. namespace crmeb\services\wechat;
  3. use crmeb\services\wechat;
  4. /**
  5. * Class Factory.
  6. *
  7. * @method static wechat\MiniPayment\Application MiniPayment(array $config)
  8. */
  9. class Factory
  10. {
  11. /**
  12. * @param string $name
  13. * @param array $config
  14. *
  15. * @return \EasyWeChat\Kernel\ServiceContainer
  16. */
  17. public static function make($name, array $config)
  18. {
  19. $namespace = \EasyWeChat\Kernel\Support\Str::studly($name);
  20. $application = "crmeb\\services\\wechat\\{$namespace}\\Application";
  21. return new $application($config);
  22. }
  23. /**
  24. * Dynamically pass methods to the application.
  25. *
  26. * @param string $name
  27. * @param array $arguments
  28. *
  29. * @return mixed
  30. */
  31. public static function __callStatic($name, $arguments)
  32. {
  33. return self::make($name, ...$arguments);
  34. }
  35. }