@@ -12,10 +12,10 @@ PHP library for handling exceptions and errors.
1212- [ Requirements] ( #requirements )
1313- [ Quick Start and Examples] ( #quick-start-and-examples )
1414- [ Available Methods] ( #available-methods )
15- - [ Images] ( #images )
1615- [ Usage] ( #usage )
1716- [ Tests] ( #tests )
1817- [ Exception Handler] ( #exception-handler )
18+ - [ Images] ( #images )
1919- [ Contribute] ( #contribute )
2020- [ Repository] ( #repository )
2121- [ Licensing] ( #licensing )
@@ -57,17 +57,9 @@ use Josantonius\ErrorHandler\ErrorHandler;
5757Available methods in this library:
5858
5959``` php
60- ErrorHandler->error();
61- ErrorHandler->exception();
60+ ErrorHandler::setCustomMethod();
6261```
6362
64- ### Images
65-
66- ![ image] ( resources/images/exception.png )
67- ![ image] ( resources/images/error.png )
68- ![ image] ( resources/images/notice.png )
69- ![ image] ( resources/images/warning.png )
70-
7163### Usage
7264
7365Example of use for this library:
@@ -78,9 +70,34 @@ require __DIR__ . '/vendor/autoload.php';
7870
7971use Josantonius\ErrorHandler\ErrorHandler;
8072
81- /* It is recommended to instantiate the class in a base file as the index.php */
73+ /**
74+ * It is recommended to instantiate the class in a base file as the index.php */
8275
8376new ErrorHandler;
77+
78+ /**
79+ * Optionally you can enter one or more methods to be executed instead the
80+ * default view. The indicated method will receive an array with the
81+ * following parameters:
82+ *
83+ * [
84+ * 'type' => 'Error|Exception',
85+ * 'message' => 'exception|error message',
86+ * 'file' => 'exception|error file',
87+ * 'line ' => 'exception|error line',
88+ * 'code' => 'exception|error code',
89+ * 'http-code' => 'HTTP response status code',
90+ * 'mode' => 'PHP|HHVM',
91+ * ];
92+ *
93+ */
94+ $class = $this;
95+
96+ $method = 'customMethodResponse';
97+
98+ $times = 0; // Times number to repeat this method in case of multiple errors
99+
100+ ErrorHandler::SetCustomMethod($class, $method, $times);
84101```
85102
86103### Tests
@@ -99,6 +116,7 @@ use Josantonius\ErrorHandler\Tests\ErrorHandlerTest;
99116Available test methods in this library:
100117
101118``` php
119+ ErrorHandlerTest->testSetCustomMethod();
102120ErrorHandlerTest->testSProvokeException();
103121ErrorHandlerTest->testSProvokeWarning();
104122ErrorHandlerTest->testSProvokeNotice();
@@ -110,6 +128,14 @@ ErrorHandlerTest->testSProvokeUserWarning();
110128### Exception Handler
111129
112130This library uses [ exception handler] ( src/Exception ) that you can customize.
131+
132+ ### Images
133+
134+ ![ image] ( resources/images/exception.png )
135+ ![ image] ( resources/images/error.png )
136+ ![ image] ( resources/images/notice.png )
137+ ![ image] ( resources/images/warning.png )
138+
113139### Contribute
1141401 . Check for open issues or open a new issue to start a discussion around a bug or feature.
1151411 . Fork the repository on GitHub to start making your changes.
0 commit comments