Config.php 1004 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. namespace Qiniu\Pili;
  3. final class Config
  4. {
  5. const SDK_VERSION = '2.1.0';
  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. protected static $_instance = NULL;
  11. protected function __construct()
  12. {
  13. }
  14. protected function __clone()
  15. {
  16. }
  17. public static function getInstance()
  18. {
  19. if (!(self::$_instance instanceof self)) {
  20. self::$_instance = new self();
  21. }
  22. return self::$_instance;
  23. }
  24. public function __get($property)
  25. {
  26. if (property_exists(self::getInstance(), $property)) {
  27. return self::getInstance()->$property;
  28. } else {
  29. return NULL;
  30. }
  31. }
  32. public function __set($property, $value)
  33. {
  34. if (property_exists(self::getInstance(), $property)) {
  35. self::getInstance()->$property = $value;
  36. }
  37. return self::getInstance();
  38. }
  39. }
  40. ?>