@@ -43,7 +43,7 @@ private function __construct()
4343
4444 public static function debug ($ var , bool $ exit = true , int $ level = 0 , bool $ fullstack = false ): void
4545 {
46- if (null === $ var or \is_scalar ($ var )) {
46+ if (null === $ var || \is_scalar ($ var )) {
4747 \ob_start ();
4848 \var_dump ($ var );
4949 $ output = \trim (\ob_get_clean ());
@@ -107,14 +107,15 @@ private static function formatDb(bool $fullstack): string
107107 /**
108108 * Static class containing most used debug methods.
109109 *
110- * @link www.doctrine-project.org
110+ * @see www.doctrine-project.org
111111 * @since 2.0
112+ *
112113 * @author Guilherme Blanco <[email protected] > 113114 * @author Jonathan Wage <[email protected] > 114115 * @author Roman Borschel <[email protected] > 115116 * @author Giorgio Sironi <[email protected] > 116117 *
117- * @deprecated The Debug class is deprecated, please use symfony/var-dumper instead.
118+ * @deprecated the Debug class is deprecated, please use symfony/var-dumper instead
118119 */
119120 final class Debug
120121 {
@@ -128,31 +129,31 @@ private function __construct()
128129 /**
129130 * Prints a dump of the public, protected and private properties of $var.
130131 *
131- * @link https://xdebug.org/
132+ * @see https://xdebug.org/
132133 *
133- * @param mixed $var The variable to dump.
134- * @param integer $maxDepth The maximum nesting level for object properties.
135- * @param boolean $stripTags Whether output should strip HTML tags.
136- * @param boolean $echo Send the dumped value to the output buffer
134+ * @param mixed $var the variable to dump
135+ * @param int $maxDepth the maximum nesting level for object properties
136+ * @param bool $stripTags whether output should strip HTML tags
137+ * @param bool $echo Send the dumped value to the output buffer
137138 *
138139 * @return string
139140 */
140141 public static function dump ($ var , $ maxDepth = 2 , $ stripTags = true , $ echo = true )
141142 {
142- if (extension_loaded ('xdebug ' )) {
143- ini_set ('xdebug.var_display_max_depth ' , $ maxDepth );
143+ if (\ extension_loaded ('xdebug ' )) {
144+ \ ini_set ('xdebug.var_display_max_depth ' , $ maxDepth );
144145 }
145146
146147 $ var = self ::export ($ var , $ maxDepth );
147148
148- ob_start ();
149- var_dump ($ var );
149+ \ ob_start ();
150+ \ var_dump ($ var );
150151
151- $ dump = ob_get_contents ();
152+ $ dump = \ ob_get_contents ();
152153
153- ob_end_clean ();
154+ \ ob_end_clean ();
154155
155- $ dumpText = ($ stripTags ? strip_tags (html_entity_decode ($ dump )) : $ dump );
156+ $ dumpText = ($ stripTags ? \ strip_tags (\ html_entity_decode ($ dump )) : $ dump );
156157
157158 if ($ echo ) {
158159 echo $ dumpText ;
@@ -170,18 +171,18 @@ public static function dump($var, $maxDepth = 2, $stripTags = true, $echo = true
170171 public static function export ($ var , $ maxDepth )
171172 {
172173 $ return = null ;
173- $ isObj = is_object ($ var );
174+ $ isObj = \ is_object ($ var );
174175
175176 if ($ var instanceof Collection) {
176177 $ var = $ var ->toArray ();
177178 }
178179
179- if ( ! $ maxDepth ) {
180- return is_object ($ var ) ? get_class ($ var )
181- : (is_array ($ var ) ? 'Array( ' . count ($ var ) . ') ' : $ var );
180+ if (! $ maxDepth ) {
181+ return \ is_object ($ var ) ? \ get_class ($ var )
182+ : (\ is_array ($ var ) ? 'Array( ' . \ count ($ var ) . ') ' : $ var );
182183 }
183184
184- if (is_array ($ var )) {
185+ if (\ is_array ($ var )) {
185186 $ return = [];
186187
187188 foreach ($ var as $ k => $ v ) {
@@ -191,13 +192,13 @@ public static function export($var, $maxDepth)
191192 return $ return ;
192193 }
193194
194- if ( ! $ isObj ) {
195+ if (! $ isObj ) {
195196 return $ var ;
196197 }
197198
198199 $ return = new \stdclass ();
199200 if ($ var instanceof \DateTimeInterface) {
200- $ return ->__CLASS__ = get_class ($ var );
201+ $ return ->__CLASS__ = \ get_class ($ var );
201202 $ return ->date = $ var ->format ('c ' );
202203 $ return ->timezone = $ var ->getTimezone ()->getName ();
203204
@@ -220,25 +221,25 @@ public static function export($var, $maxDepth)
220221
221222 /**
222223 * Fill the $return variable with class attributes
223- * Based on obj2array function from {@see https://secure.php.net/manual/en/function.get-object-vars.php#47075}
224+ * Based on obj2array function from {@see https://secure.php.net/manual/en/function.get-object-vars.php#47075}.
224225 *
225- * @param object $var
226+ * @param object $var
226227 * @param \stdClass $return
227- * @param int $maxDepth
228+ * @param int $maxDepth
228229 *
229230 * @return mixed
230231 */
231232 private static function fillReturnWithClassAttributes ($ var , \stdClass $ return , $ maxDepth )
232233 {
233234 $ clone = (array ) $ var ;
234235
235- foreach (array_keys ($ clone ) as $ key ) {
236- $ aux = explode ("\0" , (string ) $ key );
237- $ name = end ($ aux );
238- if ($ aux [ 0 ] === '' ) {
239- $ name .= ': ' . ($ aux [ 1 ] === ' * ' ? 'protected ' : $ aux [1 ] . ':private ' );
236+ foreach (\ array_keys ($ clone ) as $ key ) {
237+ $ aux = \ explode ("\0" , (string ) $ key );
238+ $ name = \ end ($ aux );
239+ if ('' === $ aux [ 0 ] ) {
240+ $ name .= ': ' . (' * ' === $ aux [ 1 ] ? 'protected ' : $ aux [1 ] . ':private ' );
240241 }
241- $ return ->$ name = self ::export ($ clone [$ key ], $ maxDepth - 1 );
242+ $ return ->{ $ name} = self ::export ($ clone [$ key ], $ maxDepth - 1 );
242243 }
243244
244245 return $ return ;
@@ -253,11 +254,11 @@ private static function fillReturnWithClassAttributes($var, \stdClass $return, $
253254 */
254255 private static function getRealClass ($ class )
255256 {
256- if (! class_exists (Proxy::class) || false === ($ pos = strrpos ($ class , '\\' . Proxy::MARKER . '\\' ))) {
257+ if (! \ class_exists (Proxy::class) || false === ($ pos = \ strrpos ($ class , '\\' . Proxy::MARKER . '\\' ))) {
257258 return $ class ;
258259 }
259260
260- return substr ($ class , $ pos + Proxy::MARKER_LENGTH + 2 );
261+ return \ substr ($ class , $ pos + Proxy::MARKER_LENGTH + 2 );
261262 }
262263
263264 /**
@@ -269,7 +270,7 @@ private static function getRealClass($class)
269270 */
270271 private static function getClass ($ object )
271272 {
272- return self ::getRealClass (get_class ($ object ));
273+ return self ::getRealClass (\ get_class ($ object ));
273274 }
274275 }
275276}
0 commit comments