Total Complexity | 8 |
Total Lines | 59 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
21 | class TraceDebug |
||
1 ignored issue
–
show
|
|||
22 | { |
||
23 | |||
24 | /** |
||
25 | * 配置参数 |
||
26 | * @var array |
||
27 | */ |
||
28 | protected $config = []; |
||
29 | |||
30 | /** @var App */ |
||
31 | protected $app; |
||
32 | |||
33 | public function __construct(App $app, Config $config) |
||
34 | { |
||
35 | $this->app = $app; |
||
36 | $this->config = $config->get('trace'); |
||
37 | } |
||
38 | |||
39 | /** |
||
40 | * 页面Trace调试 |
||
41 | * @access public |
||
42 | * @param Request $request |
||
1 ignored issue
–
show
|
|||
43 | * @param Closure $next |
||
1 ignored issue
–
show
|
|||
44 | * @return void |
||
45 | */ |
||
46 | public function handle($request, Closure $next) |
||
47 | { |
||
48 | $response = $next($request); |
||
49 | |||
50 | // Trace调试注入 |
||
51 | if ('cli' != PHP_SAPI && $this->app->env->get('app_trace', $this->app->config->get('app.app_trace'))) { |
||
52 | $data = $response->getContent(); |
||
53 | $this->traceDebug($response, $data); |
||
54 | $response->content($data); |
||
55 | } |
||
56 | |||
57 | return $response; |
||
58 | } |
||
59 | |||
60 | public function traceDebug(Response $response, &$content) |
||
80 | } |
||
81 | } |
||
82 | } |
||
85 |