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