@@ -61,41 +61,41 @@ |
||
61 | 61 | * |
62 | 62 | * @return ResponseInterface |
63 | 63 | */ |
64 | - public function __invoke(ServerRequestInterface $request, ResponseInterface $response, callable $next) |
|
65 | - { |
|
66 | - ob_start(); |
|
67 | - $level = ob_get_level(); |
|
64 | + public function __invoke(ServerRequestInterface $request, ResponseInterface $response, callable $next) |
|
65 | + { |
|
66 | + ob_start(); |
|
67 | + $level = ob_get_level(); |
|
68 | 68 | |
69 | - $whoops = $this->getWhoopsInstance($request); |
|
69 | + $whoops = $this->getWhoopsInstance($request); |
|
70 | 70 | |
71 | - //Catch errors means register whoops globally |
|
72 | - if ($this->catchErrors) { |
|
73 | - $whoops->register(); |
|
74 | - } |
|
71 | + //Catch errors means register whoops globally |
|
72 | + if ($this->catchErrors) { |
|
73 | + $whoops->register(); |
|
74 | + } |
|
75 | 75 | |
76 | - try { |
|
77 | - $response = $next($request, $response); |
|
78 | - } catch (\Exception $exception) { |
|
79 | - $method = Run::EXCEPTION_HANDLER; |
|
76 | + try { |
|
77 | + $response = $next($request, $response); |
|
78 | + } catch (\Exception $exception) { |
|
79 | + $method = Run::EXCEPTION_HANDLER; |
|
80 | 80 | |
81 | - $whoops->allowQuit(false); |
|
82 | - $whoops->writeToOutput(false); |
|
83 | - $whoops->sendHttpCode(false); |
|
81 | + $whoops->allowQuit(false); |
|
82 | + $whoops->writeToOutput(false); |
|
83 | + $whoops->sendHttpCode(false); |
|
84 | 84 | |
85 | - $body = self::createStream(); |
|
86 | - $body->write($whoops->$method($exception)); |
|
85 | + $body = self::createStream(); |
|
86 | + $body->write($whoops->$method($exception)); |
|
87 | 87 | |
88 | - $response = $response->withStatus(500)->withBody($body); |
|
89 | - } finally { |
|
90 | - Utils\Helpers::getOutput($level); |
|
91 | - } |
|
88 | + $response = $response->withStatus(500)->withBody($body); |
|
89 | + } finally { |
|
90 | + Utils\Helpers::getOutput($level); |
|
91 | + } |
|
92 | 92 | |
93 | - if ($this->catchErrors) { |
|
94 | - $whoops->unregister(); |
|
95 | - } |
|
93 | + if ($this->catchErrors) { |
|
94 | + $whoops->unregister(); |
|
95 | + } |
|
96 | 96 | |
97 | - return $response; |
|
98 | - } |
|
97 | + return $response; |
|
98 | + } |
|
99 | 99 | |
100 | 100 | /** |
101 | 101 | * Returns the whoops instance or create one. |