1 | <?php |
||
11 | final class ExceptionAsString |
||
12 | { |
||
13 | public function summery(\Exception $e, $log) |
||
14 | { |
||
15 | return sprintf("\n\n[%s]\n%s\n %s", get_class($e), $e->getMessage(), $log); |
||
16 | } |
||
17 | |||
18 | /** |
||
19 | * @param \Exception $e |
||
20 | * @param Request $request |
||
21 | * |
||
22 | * @return string |
||
23 | */ |
||
24 | 1 | public function detail(\Exception $e, Request $request) |
|
37 | |||
38 | /** |
||
39 | * @param array $server |
||
40 | * |
||
41 | * @return string |
||
42 | */ |
||
43 | 1 | private function getPhpVariables(array $server) |
|
51 | } |
||
52 |
Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable: