@@ -75,7 +75,7 @@ function getXrFailover(): ?XrInterface
7575 }
7676
7777 /**
78- * Register XR throwable handler.
78+ * Register XR Debug throwable handler.
7979 *
8080 * @param bool $callPrevious True to call the previous handler.
8181 * False to disable the previous handler.
@@ -99,20 +99,21 @@ function (Throwable $throwable) use ($xrHandler, $previous) {
9999 }
100100
101101 /**
102- * Handle a Throwable using XR.
102+ * Handle a Throwable using XR Debug .
103103 *
104104 * @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
106106 *
107107 * @codeCoverageIgnore
108108 */
109109 function throwableHandler (Throwable $ throwable , string $ extra = '' ): void
110110 {
111- if (getXr ()->isEnabled () === false ) {
111+ $ xr = getXrFailover ();
112+ if ($ xr === null || $ xr ->isEnabled () === false ) {
112113 return ; // @codeCoverageIgnore
113114 }
114115 $ parser = new ThrowableParser ($ throwable , $ extra );
115- getXr () ->client ()
116+ $ xr ->client ()
116117 ->sendMessage (
117118 (new Message (
118119 backtrace: $ parser ->throwableRead ()->trace (),
@@ -126,7 +127,6 @@ function throwableHandler(Throwable $throwable, string $extra = ''): void
126127
127128namespace {
128129 use function Chevere \Xr \getWriter ;
129- use function Chevere \Xr \getXr ;
130130 use function Chevere \Xr \getXrFailover ;
131131 use Chevere \Xr \Inspector \Inspector ;
132132 use Chevere \Xr \Inspector \InspectorInstance ;
@@ -141,7 +141,7 @@ function throwableHandler(Throwable $throwable, string $extra = ''): void
141141 // @codeCoverageIgnoreEnd
142142 if (! function_exists ('xr ' )) { // @codeCoverageIgnore
143143 /**
144- * Dumps information about one or more variables to XR.
144+ * Dumps information about one or more variables to XR Debug .
145145 *
146146 * ```php
147147 * xr($foo, $bar,...);
@@ -151,7 +151,8 @@ function throwableHandler(Throwable $throwable, string $extra = ''): void
151151 */
152152 function xr (mixed ...$ vars ): void
153153 {
154- if (getXrFailover () === null || getXr ()->isEnabled () === false ) {
154+ $ xr = getXrFailover ();
155+ if ($ xr === null || $ xr ->isEnabled () === false ) {
155156 return ; // @codeCoverageIgnore
156157 }
157158 $ defaultArgs = [
@@ -165,7 +166,7 @@ function xr(mixed ...$vars): void
165166 unset($ vars [$ name ]);
166167 }
167168 }
168- getXr () ->client ()
169+ $ xr ->client ()
169170 ->sendMessage (
170171 (new Message (
171172 backtrace: debug_backtrace (),
@@ -180,7 +181,7 @@ function xr(mixed ...$vars): void
180181 }
181182 if (! function_exists ('xrr ' )) { // @codeCoverageIgnore
182183 /**
183- * Send a raw html message to XR.
184+ * Send a raw html message to XR Debug .
184185 *
185186 * ```php
186187 * xrr($html, ...);
@@ -199,10 +200,11 @@ function xrr(
199200 string $ e = '' ,
200201 int $ f = 0
201202 ): void {
202- if (getXrFailover () === null || getXr ()->isEnabled () === false ) {
203+ $ xr = getXrFailover ();
204+ if ($ xr === null || $ xr ->isEnabled () === false ) {
203205 return ;
204206 }
205- getXr () ->client ()
207+ $ xr ->client ()
206208 ->sendMessage (
207209 (new Message (
208210 backtrace: debug_backtrace (),
@@ -217,21 +219,22 @@ function xrr(
217219 }
218220 if (! function_exists ('xri ' )) { // @codeCoverageIgnore
219221 /**
220- * Access XR inspector to send debug information.
222+ * Access XR Debug inspector to send debug information.
221223 *
222224 * @codeCoverageIgnore
223225 */
224226 function xri (): InspectorInterface
225227 {
226- if (getXrFailover () === null ) {
228+ $ xr = getXrFailover ();
229+ if ($ xr === null ) {
227230 return new InspectorNull ();
228231 }
229232
230233 try {
231234 return InspectorInstance::get ();
232235 } catch (LogicException ) {
233- $ xrInspector = getXr () ->isEnabled ()
234- ? new Inspector (getXr () ->client ())
236+ $ xrInspector = $ xr ->isEnabled ()
237+ ? new Inspector ($ xr ->client ())
235238 : new InspectorNull ();
236239
237240 return (new InspectorInstance ($ xrInspector ))::get ();
0 commit comments