event_looper.php 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: stanley-king
  5. * Date: 2017/12/14
  6. * Time: 下午2:28
  7. */
  8. require_once(BASE_ROOT_PATH . '/helper/event/IProcessor.php');
  9. require_once(BASE_ROOT_PATH . '/helper/event/event_looper.php');
  10. require_once(BASE_ROOT_PATH . '/helper/event/buffer_looper.php');
  11. require_once(BASE_ROOT_PATH . '/helper/event/util.php');
  12. class process_looper extends event\buffer_looper
  13. {
  14. private static $stInstance;
  15. public static function instance()
  16. {
  17. if(self::$stInstance == null) {
  18. self::$stInstance = new process_looper();
  19. }
  20. return self::$stInstance;
  21. }
  22. }
  23. class empty_processor implements event\IProcessor
  24. {
  25. public function __construct()
  26. {
  27. }
  28. public function onStart()
  29. {
  30. }
  31. public function onConnected($bufid,$stream,$host,$port,$args)
  32. {
  33. }
  34. public function onRequest($bufid, $body)
  35. {
  36. $input = json_decode($body,true);
  37. if($input == false) {
  38. return false;
  39. }
  40. }
  41. public function onClose($bufid)
  42. {
  43. }
  44. }