12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- <?php
- namespace Symfony\Component\HttpKernel\DataCollector;
- use Symfony\Component\ErrorHandler\Exception\FlattenException;
- use Symfony\Component\HttpFoundation\Request;
- use Symfony\Component\HttpFoundation\Response;
- class ExceptionDataCollector extends DataCollector
- {
-
- public function collect(Request $request, Response $response, \Throwable $exception = null)
- {
- if (null !== $exception) {
- $this->data = [
- 'exception' => FlattenException::createFromThrowable($exception),
- ];
- }
- }
-
- public function reset()
- {
- $this->data = [];
- }
- public function hasException(): bool
- {
- return isset($this->data['exception']);
- }
-
- public function getException()
- {
- return $this->data['exception'];
- }
- public function getMessage(): string
- {
- return $this->data['exception']->getMessage();
- }
- public function getCode(): int
- {
- return $this->data['exception']->getCode();
- }
- public function getStatusCode(): int
- {
- return $this->data['exception']->getStatusCode();
- }
- public function getTrace(): array
- {
- return $this->data['exception']->getTrace();
- }
-
- public function getName(): string
- {
- return 'exception';
- }
- }
|