1 | <?php namespace Arcanedev\LaravelTracker\Exceptions; |
||
13 | class Handler implements ExceptionHandlerContract |
||
14 | { |
||
15 | /* ----------------------------------------------------------------- |
||
16 | | Properties |
||
17 | | ----------------------------------------------------------------- |
||
18 | */ |
||
19 | |||
20 | /** @var \Arcanedev\LaravelTracker\Contracts\Tracker */ |
||
21 | private $manager; |
||
22 | |||
23 | /** @var \Illuminate\Contracts\Debug\ExceptionHandler */ |
||
24 | private $illuminateHandler; |
||
25 | |||
26 | private $originalExceptionHandler; |
||
27 | |||
28 | private $originalErrorHandler; |
||
29 | |||
30 | /* ----------------------------------------------------------------- |
||
31 | | Constructor |
||
32 | | ----------------------------------------------------------------- |
||
33 | */ |
||
34 | |||
35 | /** |
||
36 | * Handler constructor. |
||
37 | * |
||
38 | * @param \Arcanedev\LaravelTracker\Contracts\Tracker $tracker |
||
39 | * @param \Illuminate\Contracts\Debug\ExceptionHandler $illuminateHandler |
||
40 | */ |
||
41 | 117 | public function __construct(Tracker $tracker, ExceptionHandlerContract $illuminateHandler) |
|
48 | |||
49 | /* ----------------------------------------------------------------- |
||
50 | | Main Methods |
||
51 | | ----------------------------------------------------------------- |
||
52 | */ |
||
53 | |||
54 | /** |
||
55 | * Report or log an exception. |
||
56 | * |
||
57 | * @param \Exception $e |
||
58 | */ |
||
59 | 3 | public function report(Exception $e) |
|
60 | { |
||
61 | try { |
||
62 | 3 | $this->manager->trackException($e); |
|
63 | } |
||
64 | catch (Exception $exception) { |
||
65 | // ignore |
||
66 | } |
||
67 | |||
68 | 3 | $this->illuminateHandler->report($e); |
|
69 | 3 | } |
|
70 | |||
71 | /** |
||
72 | * Render an exception into an HTTP response. |
||
73 | * |
||
74 | * @param \Illuminate\Http\Request $request |
||
75 | * @param \Exception $e |
||
76 | * |
||
77 | * @return \Symfony\Component\HttpFoundation\Response |
||
78 | */ |
||
79 | 3 | public function render($request, Exception $e) |
|
83 | |||
84 | /** |
||
85 | * Render an exception to the console. |
||
86 | * |
||
87 | * @param \Symfony\Component\Console\Output\OutputInterface $output |
||
88 | * @param \Exception $e |
||
89 | */ |
||
90 | public function renderForConsole($output, Exception $e) |
||
94 | |||
95 | /** |
||
96 | * Track the exception. |
||
97 | * |
||
98 | * @param Exception $exception |
||
99 | * |
||
100 | * @return mixed |
||
101 | */ |
||
102 | public function trackException(Exception $exception) |
||
114 | |||
115 | /** |
||
116 | * Handle the error. |
||
117 | * |
||
118 | * @param int $err_severity |
||
119 | * @param string $err_msg |
||
120 | * @param mixed $err_file |
||
121 | * @param mixed $err_line |
||
122 | * @param array $err_context |
||
123 | * |
||
124 | * @return mixed |
||
125 | */ |
||
126 | public function handleError($err_severity, $err_msg, $err_file, $err_line, array $err_context) |
||
140 | } |
||
141 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.