RefillFactory.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. namespace refill;
  3. require_once(BASE_HELPER_PATH . '/refill/RefillBase.php');
  4. require_once(BASE_HELPER_PATH . '/refill/afandeng/RefillPhone.php');
  5. require_once(BASE_HELPER_PATH . '/refill/afandeng/RefillCallBack.php');
  6. use Log;
  7. use StatesHelper;
  8. class RefillFactory extends RefillBase
  9. {
  10. private static $stInstance = null;
  11. public static function instance()
  12. {
  13. if (self::$stInstance == null) {
  14. self::$stInstance = new RefillFactory();
  15. }
  16. if(defined('SUPPORT_PTHREAD') && SUPPORT_PTHREAD === true)
  17. {
  18. Log::record("MOBILE_SERVER defined call load",Log::DEBUG);
  19. if(StatesHelper::fetch_state('channel')) {
  20. Log::record("RefillFactory reload channel config.",Log::DEBUG);
  21. self::$stInstance->load();
  22. }
  23. }
  24. return self::$stInstance;
  25. }
  26. private function __construct()
  27. {
  28. if (defined('SUPPORT_PTHREAD') && SUPPORT_PTHREAD === false) {
  29. Log::record("SUPPORT_PTHREAD defined dont call load",Log::DEBUG);
  30. } else {
  31. Log::record("SUPPORT_PTHREAD has not defined and call load",Log::DEBUG);
  32. $this->load();
  33. }
  34. }
  35. }