tp6混合easyswoole DLL 多应用模式 修改版
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

59 lines
1.4 KiB

5 years ago
  1. <?php
  2. /* ===========================================================================
  3. * Copyright (c) 2018-2019 Zindex Software
  4. *
  5. * Licensed under the MIT License
  6. * =========================================================================== */
  7. namespace Opis\Closure;
  8. use Closure;
  9. use SuperClosure\Analyzer\ClosureAnalyzer;
  10. class Analyzer extends ClosureAnalyzer
  11. {
  12. /**
  13. * Analyzer a given closure.
  14. *
  15. * @param Closure $closure
  16. *
  17. * @return array
  18. */
  19. public function analyze(Closure $closure)
  20. {
  21. $reflection = new ReflectionClosure($closure);
  22. $scope = $reflection->getClosureScopeClass();
  23. $data = [
  24. 'reflection' => $reflection,
  25. 'code' => $reflection->getCode(),
  26. 'hasThis' => $reflection->isBindingRequired(),
  27. 'context' => $reflection->getUseVariables(),
  28. 'hasRefs' => false,
  29. 'binding' => $reflection->getClosureThis(),
  30. 'scope' => $scope ? $scope->getName() : null,
  31. 'isStatic' => $reflection->isStatic(),
  32. ];
  33. return $data;
  34. }
  35. /**
  36. * @param array $data
  37. * @return mixed
  38. */
  39. protected function determineCode(array &$data)
  40. {
  41. return null;
  42. }
  43. /**
  44. * @param array $data
  45. * @return mixed
  46. */
  47. protected function determineContext(array &$data)
  48. {
  49. return null;
  50. }
  51. }