Completed
Push — master ( f0a013...5b9cc9 )
by Jeroen
02:17
created
src/Exceptions/Handler.php 1 patch
Indentation   +82 added lines, -82 removed lines patch added patch discarded remove patch
@@ -7,95 +7,95 @@
 block discarded – undo
7 7
 
8 8
 class Handler
9 9
 {
10
-	const ERROR_HANDLER = 'handleError';
11
-	const EXCEPTION_HANDLER = 'handleException';
12
-	const SHUTDOWN_HANDLER = 'handleShutdown';
10
+    const ERROR_HANDLER = 'handleError';
11
+    const EXCEPTION_HANDLER = 'handleException';
12
+    const SHUTDOWN_HANDLER = 'handleShutdown';
13 13
 
14
-	/**
15
-	 * @var FormatterInterface
16
-	 */
17
-	private $formatter;
14
+    /**
15
+     * @var FormatterInterface
16
+     */
17
+    private $formatter;
18 18
 
19
-	/**
20
-	 * Handler constructor.
21
-	 *
22
-	 * @param FormatterInterface $formatter
23
-	 */
24
-	public function __construct(FormatterInterface $formatter)
25
-	{
26
-		$this->formatter = $formatter;
19
+    /**
20
+     * Handler constructor.
21
+     *
22
+     * @param FormatterInterface $formatter
23
+     */
24
+    public function __construct(FormatterInterface $formatter)
25
+    {
26
+        $this->formatter = $formatter;
27 27
 
28
-		$this->registerErrorHandler();
29
-		$this->registerExceptionHandler();
30
-		$this->registerShutdownHandler();
31
-	}
28
+        $this->registerErrorHandler();
29
+        $this->registerExceptionHandler();
30
+        $this->registerShutdownHandler();
31
+    }
32 32
 
33
-	/**
34
-	 * Register the PHP error handler.
35
-	 *
36
-	 * @return void
37
-	 */
38
-	protected function registerErrorHandler()
39
-	{
40
-		set_error_handler([$this, self::ERROR_HANDLER]);
41
-	}
33
+    /**
34
+     * Register the PHP error handler.
35
+     *
36
+     * @return void
37
+     */
38
+    protected function registerErrorHandler()
39
+    {
40
+        set_error_handler([$this, self::ERROR_HANDLER]);
41
+    }
42 42
 
43
-	/**
44
-	 * Register the PHP exception handler.
45
-	 *
46
-	 * @return void
47
-	 */
48
-	protected function registerExceptionHandler()
49
-	{
50
-		set_exception_handler([$this, self::EXCEPTION_HANDLER]);
51
-	}
43
+    /**
44
+     * Register the PHP exception handler.
45
+     *
46
+     * @return void
47
+     */
48
+    protected function registerExceptionHandler()
49
+    {
50
+        set_exception_handler([$this, self::EXCEPTION_HANDLER]);
51
+    }
52 52
 
53
-	/**
54
-	 * Register a function for execution on shutdown
55
-	 *
56
-	 * @return void
57
-	 */
58
-	protected function registerShutdownHandler()
59
-	{
60
-		register_shutdown_function([$this, self::SHUTDOWN_HANDLER]);
61
-	}
53
+    /**
54
+     * Register a function for execution on shutdown
55
+     *
56
+     * @return void
57
+     */
58
+    protected function registerShutdownHandler()
59
+    {
60
+        register_shutdown_function([$this, self::SHUTDOWN_HANDLER]);
61
+    }
62 62
 
63
-	/**
64
-	 * @param int $level
65
-	 * @param string $message
66
-	 * @param string $file
67
-	 * @param int $line
68
-	 * @param array $context
69
-	 *
70
-	 * @throws ErrorException
71
-	 */
72
-	public function handleError(int $level, string $message, string $file = '', int $line = 0, array $context = [])
73
-	{
74
-		throw new ErrorException($message, 0, $level, $file, $line);
75
-	}
63
+    /**
64
+     * @param int $level
65
+     * @param string $message
66
+     * @param string $file
67
+     * @param int $line
68
+     * @param array $context
69
+     *
70
+     * @throws ErrorException
71
+     */
72
+    public function handleError(int $level, string $message, string $file = '', int $line = 0, array $context = [])
73
+    {
74
+        throw new ErrorException($message, 0, $level, $file, $line);
75
+    }
76 76
 
77
-	/**
78
-	 * @param \Throwable $e
79
-	 */
80
-	public function handleException(\Throwable $e)
81
-	{
82
-		ob_start();
83
-		$response = json_encode($this->formatter->format($e));
84
-		ob_end_clean();
85
-		http_response_code(500);
86
-		print $response;
87
-		return;
88
-	}
77
+    /**
78
+     * @param \Throwable $e
79
+     */
80
+    public function handleException(\Throwable $e)
81
+    {
82
+        ob_start();
83
+        $response = json_encode($this->formatter->format($e));
84
+        ob_end_clean();
85
+        http_response_code(500);
86
+        print $response;
87
+        return;
88
+    }
89 89
 
90
-	/**
91
-	 *
92
-	 */
93
-	public function handleShutdown()
94
-	{
95
-		$error = error_get_last();
96
-		echo 'ok';
97
-		if ($error) {
98
-			$this->handleException(new ErrorException($error['type'], $error['message'], $error['file'], $error['line']));
99
-		}
100
-	}
90
+    /**
91
+     *
92
+     */
93
+    public function handleShutdown()
94
+    {
95
+        $error = error_get_last();
96
+        echo 'ok';
97
+        if ($error) {
98
+            $this->handleException(new ErrorException($error['type'], $error['message'], $error['file'], $error['line']));
99
+        }
100
+    }
101 101
 }
102 102
\ No newline at end of file
Please login to merge, or discard this patch.