@@ -75,7 +75,7 @@ function getXrFailover(): ?XrInterface
75
75
}
76
76
77
77
/**
78
- * Register XR throwable handler.
78
+ * Register XR Debug throwable handler.
79
79
*
80
80
* @param bool $callPrevious True to call the previous handler.
81
81
* False to disable the previous handler.
@@ -99,20 +99,21 @@ function (Throwable $throwable) use ($xrHandler, $previous) {
99
99
}
100
100
101
101
/**
102
- * Handle a Throwable using XR.
102
+ * Handle a Throwable using XR Debug .
103
103
*
104
104
* @param Throwable $throwable The throwable to handle
105
- * @param string $extra Extra contents to append to the XR message
105
+ * @param string $extra Extra contents to append to the XR Debug message
106
106
*
107
107
* @codeCoverageIgnore
108
108
*/
109
109
function throwableHandler (Throwable $ throwable , string $ extra = '' ): void
110
110
{
111
- if (getXr ()->isEnabled () === false ) {
111
+ $ xr = getXrFailover ();
112
+ if ($ xr === null || $ xr ->isEnabled () === false ) {
112
113
return ; // @codeCoverageIgnore
113
114
}
114
115
$ parser = new ThrowableParser ($ throwable , $ extra );
115
- getXr () ->client ()
116
+ $ xr ->client ()
116
117
->sendMessage (
117
118
(new Message (
118
119
backtrace: $ parser ->throwableRead ()->trace (),
@@ -126,7 +127,6 @@ function throwableHandler(Throwable $throwable, string $extra = ''): void
126
127
127
128
namespace {
128
129
use function Chevere \Xr \getWriter ;
129
- use function Chevere \Xr \getXr ;
130
130
use function Chevere \Xr \getXrFailover ;
131
131
use Chevere \Xr \Inspector \Inspector ;
132
132
use Chevere \Xr \Inspector \InspectorInstance ;
@@ -141,7 +141,7 @@ function throwableHandler(Throwable $throwable, string $extra = ''): void
141
141
// @codeCoverageIgnoreEnd
142
142
if (! function_exists ('xr ' )) { // @codeCoverageIgnore
143
143
/**
144
- * Dumps information about one or more variables to XR.
144
+ * Dumps information about one or more variables to XR Debug .
145
145
*
146
146
* ```php
147
147
* xr($foo, $bar,...);
@@ -151,7 +151,8 @@ function throwableHandler(Throwable $throwable, string $extra = ''): void
151
151
*/
152
152
function xr (mixed ...$ vars ): void
153
153
{
154
- if (getXrFailover () === null || getXr ()->isEnabled () === false ) {
154
+ $ xr = getXrFailover ();
155
+ if ($ xr === null || $ xr ->isEnabled () === false ) {
155
156
return ; // @codeCoverageIgnore
156
157
}
157
158
$ defaultArgs = [
@@ -165,7 +166,7 @@ function xr(mixed ...$vars): void
165
166
unset($ vars [$ name ]);
166
167
}
167
168
}
168
- getXr () ->client ()
169
+ $ xr ->client ()
169
170
->sendMessage (
170
171
(new Message (
171
172
backtrace: debug_backtrace (),
@@ -180,7 +181,7 @@ function xr(mixed ...$vars): void
180
181
}
181
182
if (! function_exists ('xrr ' )) { // @codeCoverageIgnore
182
183
/**
183
- * Send a raw html message to XR.
184
+ * Send a raw html message to XR Debug .
184
185
*
185
186
* ```php
186
187
* xrr($html, ...);
@@ -199,10 +200,11 @@ function xrr(
199
200
string $ e = '' ,
200
201
int $ f = 0
201
202
): void {
202
- if (getXrFailover () === null || getXr ()->isEnabled () === false ) {
203
+ $ xr = getXrFailover ();
204
+ if ($ xr === null || $ xr ->isEnabled () === false ) {
203
205
return ;
204
206
}
205
- getXr () ->client ()
207
+ $ xr ->client ()
206
208
->sendMessage (
207
209
(new Message (
208
210
backtrace: debug_backtrace (),
@@ -217,21 +219,22 @@ function xrr(
217
219
}
218
220
if (! function_exists ('xri ' )) { // @codeCoverageIgnore
219
221
/**
220
- * Access XR inspector to send debug information.
222
+ * Access XR Debug inspector to send debug information.
221
223
*
222
224
* @codeCoverageIgnore
223
225
*/
224
226
function xri (): InspectorInterface
225
227
{
226
- if (getXrFailover () === null ) {
228
+ $ xr = getXrFailover ();
229
+ if ($ xr === null ) {
227
230
return new InspectorNull ();
228
231
}
229
232
230
233
try {
231
234
return InspectorInstance::get ();
232
235
} catch (LogicException ) {
233
- $ xrInspector = getXr () ->isEnabled ()
234
- ? new Inspector (getXr () ->client ())
236
+ $ xrInspector = $ xr ->isEnabled ()
237
+ ? new Inspector ($ xr ->client ())
235
238
: new InspectorNull ();
236
239
237
240
return (new InspectorInstance ($ xrInspector ))::get ();
0 commit comments