Google.php 892 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. namespace App\libs\google;
  3. use Symfony\Component\VarExporter\Exception\ClassNotFoundException;
  4. /**
  5. * @desc
  6. * @method static \App\libs\google\Gateways\GoogleOauth GoogleOauth
  7. * @package \App\libs\google
  8. */
  9. class Google
  10. {
  11. /**
  12. * @param $method
  13. * @return mixed
  14. */
  15. private static function make($method)
  16. {
  17. $value = ucwords(str_replace(['-', '_'], ' ', $method));
  18. $gateway = __NAMESPACE__ . '\\Gateways\\' . $value;
  19. if (class_exists($gateway)) {
  20. return new $gateway();
  21. }
  22. throw new ClassNotFoundException("Gateway [{$method}] Not Exists",$gateway);
  23. }
  24. /**
  25. * @desc
  26. * @param string $method
  27. * @param array $arguments
  28. * @return mixed
  29. */
  30. public static function __callStatic($method, $arguments)
  31. {
  32. return self::make($method, ...$arguments);
  33. }
  34. }