Config.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. namespace Qiniu\Pili;
  3. final class Config
  4. {
  5. const SDK_VERSION = '2.1.1';
  6. const SDK_USER_AGENT = 'pili-sdk-php';
  7. public $USE_HTTPS = false;
  8. public $API_HOST = 'pili.qiniuapi.com';
  9. public $API_VERSION = 'v2';
  10. public $RTCAPI_HOST = 'http://rtc.qiniuapi.com';
  11. public $RTCAPI_VERSION = 'v2'; //连麦版本号,可以设置 "v1" 和 "v2"
  12. protected static $_instance = null;
  13. protected function __construct()
  14. {
  15. }
  16. protected function __clone()
  17. {
  18. }
  19. public static function getInstance()
  20. {
  21. if (!(self::$_instance instanceof self)) {
  22. self::$_instance = new self();
  23. }
  24. return self::$_instance;
  25. }
  26. public function __get($property)
  27. {
  28. if (property_exists(self::getInstance(), $property)) {
  29. return self::getInstance()->$property;
  30. } else {
  31. return null;
  32. }
  33. }
  34. public function __set($property, $value)
  35. {
  36. if (property_exists(self::getInstance(), $property)) {
  37. self::getInstance()->$property = $value;
  38. }
  39. return self::getInstance();
  40. }
  41. }