DispatcherInterface.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | ThinkPHP [ WE CAN DO IT JUST THINK ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
  8. // +----------------------------------------------------------------------
  9. // | Author: Slince <taosikai@yeah.net>
  10. // +----------------------------------------------------------------------
  11. namespace think\http\middleware;
  12. use think\Request;
  13. use think\Response;
  14. interface DispatcherInterface
  15. {
  16. /**
  17. * 在队尾添加 middleware
  18. * @param callable $middleware
  19. * @return DispatcherInterface
  20. */
  21. public function add($middleware);
  22. /**
  23. * 在队前插入 middleware
  24. * @param callable $middleware
  25. * @return DispatcherInterface
  26. */
  27. public function insert($middleware);
  28. /**
  29. * 获取所有的middleware
  30. * @return array
  31. */
  32. public function all();
  33. /**
  34. * 处理 request 并返回 response
  35. * @param Request $request
  36. * @return Response
  37. */
  38. public function dispatch(Request $request);
  39. }