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