88
99 function r ($ var , bool $ exit = true , int $ level = 0 , bool $ fullstack = false )
1010 {
11- DebugR::$ db = debug_backtrace ();
11+ DebugR::$ db = \ debug_backtrace ();
1212 DebugR::debug ($ var , $ exit , $ level , $ fullstack );
1313 }
1414
1515 function rq (string $ query , array $ params , bool $ exit = true , int $ level = 0 , bool $ fullstack = false )
1616 {
17- uksort ($ params , function (string $ key1 , string $ key2 ) {
18- return strlen ($ key2 ) <=> strlen ($ key1 );
17+ \ uksort ($ params , function (string $ key1 , string $ key2 ) {
18+ return \ strlen ($ key2 ) <=> \ strlen ($ key1 );
1919 });
2020
2121 foreach ($ params as $ key => $ value ) {
22- $ query = str_replace (
23- sprintf (':%s ' , $ key ),
24- sprintf ('"%s" ' , str_replace ('" ' , '\\" ' , $ value )),
22+ $ query = \ str_replace (
23+ \ sprintf (':%s ' , $ key ),
24+ \ sprintf ('"%s" ' , \ str_replace ('" ' , '\\" ' , $ value )),
2525 $ query
2626 );
2727 }
2828
29- DebugR::$ db = debug_backtrace ();
29+ DebugR::$ db = \ debug_backtrace ();
3030 DebugR::debug ($ query , $ exit , $ level , $ fullstack );
3131 }
3232}
@@ -45,20 +45,20 @@ private function __construct()
4545
4646 public static function debug ($ var , bool $ exit = true , int $ level = 0 , bool $ fullstack = false )
4747 {
48- if ($ var === null or is_scalar ($ var )) {
49- ob_start ();
50- var_dump ($ var );
51- $ output = trim (ob_get_clean ());
52- } elseif ($ level > 0 and class_exists (DoctrineDebug::class)) {
53- $ output = print_r (DoctrineDebug::export ($ var , $ level ), true );
48+ if (null === $ var or \ is_scalar ($ var )) {
49+ \ ob_start ();
50+ \ var_dump ($ var );
51+ $ output = \ trim (\ ob_get_clean ());
52+ } elseif ($ level > 0 and \ class_exists (DoctrineDebug::class)) {
53+ $ output = \ print_r (DoctrineDebug::export ($ var , $ level ), true );
5454 } else {
55- $ output = print_r ($ var , true );
55+ $ output = \ print_r ($ var , true );
5656 }
5757
58- if (PHP_SAPI === 'cli ' ) {
59- echo PHP_EOL . self ::formatDb ($ fullstack ) . $ output . PHP_EOL ;
58+ if (\ PHP_SAPI === 'cli ' ) {
59+ echo \ PHP_EOL . self ::formatDb ($ fullstack ) . $ output . \ PHP_EOL ;
6060 } else {
61- echo '<pre><strong> ' . self ::formatDb ($ fullstack ) . '</strong><br /> ' . htmlspecialchars ($ output ) . '</pre> ' ;
61+ echo '<pre><strong> ' . self ::formatDb ($ fullstack ) . '</strong><br /> ' . \ htmlspecialchars ($ output ) . '</pre> ' ;
6262 }
6363
6464 if ($ exit ) {
@@ -79,21 +79,21 @@ private static function formatDb(bool $fullstack): string
7979
8080 $ args = array ();
8181 foreach ($ point ['args ' ] as $ argument ) {
82- $ args [] = (is_object ($ argument )
83- ? get_class ($ argument )
84- : gettype ($ argument )
82+ $ args [] = (\ is_object ($ argument )
83+ ? \ get_class ($ argument )
84+ : \ gettype ($ argument )
8585 );
8686 }
8787
88- $ output .= '( ' . implode (', ' , $ args ) . ') ' . PHP_EOL ;
88+ $ output .= '( ' . \ implode (', ' , $ args ) . ') ' . \ PHP_EOL ;
8989
9090 if (! $ fullstack ) {
9191 break ;
9292 }
9393 }
9494
95- if (defined ('ROOT_PATH ' )) {
96- return str_replace (ROOT_PATH , '. ' , $ output );
95+ if (\ defined ('ROOT_PATH ' )) {
96+ return \ str_replace (ROOT_PATH , '. ' , $ output );
9797 }
9898
9999 return $ output ;
0 commit comments