@@ -435,7 +435,7 @@ |
||
| 435 | 435 | } |
| 436 | 436 | |
| 437 | 437 | /** |
| 438 | - * @param int|float $number |
|
| 438 | + * @param integer $number |
|
| 439 | 439 | * @param int $precision |
| 440 | 440 | * @param null|string $forceUnit |
| 441 | 441 | * |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | if (php_sapi_name() != 'cli') { |
| 66 | 66 | echo sprintf(self::$style['called_from_format'], Debugger::getCalledFrom(2)); |
| 67 | 67 | echo sprintf(self::$style['output_format'], $data); |
| 68 | - echo '<style type="text/css">.xicrow-php-debug-timer:hover{ ' . self::$style['hover_style'] . ' }</style>'; |
|
| 68 | + echo '<style type="text/css">.xicrow-php-debug-timer:hover{ '.self::$style['hover_style'].' }</style>'; |
|
| 69 | 69 | } else { |
| 70 | 70 | echo Debugger::getCalledFrom(2); |
| 71 | 71 | echo "\n"; |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | // Set correct key for the original item |
| 109 | 109 | if (strpos($item['key'], '#') === false) { |
| 110 | 110 | self::$collection[$key] = array_merge($item, [ |
| 111 | - 'key' => $key . ' #1', |
|
| 111 | + 'key' => $key.' #1', |
|
| 112 | 112 | 'count' => $itemCount, |
| 113 | 113 | ]); |
| 114 | 114 | } else { |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | // Set new key |
| 121 | - $key = $key . ' #' . $itemCount; |
|
| 121 | + $key = $key.' #'.$itemCount; |
|
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | // Make sure various options are set |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | } |
| 178 | 178 | |
| 179 | 179 | // Check for key duplicates, and find the last one not stopped |
| 180 | - if (isset(self::$collection[$key]) && isset(self::$collection[$key . ' #2'])) { |
|
| 180 | + if (isset(self::$collection[$key]) && isset(self::$collection[$key.' #2'])) { |
|
| 181 | 181 | $lastNotStopped = false; |
| 182 | 182 | $currentKey = $key; |
| 183 | 183 | $currentIndex = 1; |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | } |
| 188 | 188 | |
| 189 | 189 | $currentIndex++; |
| 190 | - $currentKey = $key . ' #' . $currentIndex; |
|
| 190 | + $currentKey = $key.' #'.$currentIndex; |
|
| 191 | 191 | } |
| 192 | 192 | |
| 193 | 193 | if ($lastNotStopped) { |
@@ -268,21 +268,21 @@ discard block |
||
| 268 | 268 | if (count($keyArr) > 1) { |
| 269 | 269 | $method = array_pop($keyArr); |
| 270 | 270 | $key = implode('/', $keyArr); |
| 271 | - $key .= '::' . $method; |
|
| 271 | + $key .= '::'.$method; |
|
| 272 | 272 | } |
| 273 | 273 | |
| 274 | 274 | unset($keyArr, $method); |
| 275 | 275 | } elseif (is_object($callback) && $callback instanceof \Closure) { |
| 276 | 276 | $key = 'closure'; |
| 277 | 277 | } |
| 278 | - $key = 'callback: ' . $key; |
|
| 278 | + $key = 'callback: '.$key; |
|
| 279 | 279 | } |
| 280 | 280 | |
| 281 | 281 | // Set default return value |
| 282 | 282 | $returnValue = true; |
| 283 | 283 | |
| 284 | 284 | // Set error handler, to convert errors to exceptions |
| 285 | - set_error_handler(function ($errno, $errstr, $errfile, $errline, array $errcontext) { |
|
| 285 | + set_error_handler(function($errno, $errstr, $errfile, $errline, array $errcontext) { |
|
| 286 | 286 | throw new \ErrorException($errstr, 0, $errno, $errfile, $errline); |
| 287 | 287 | }); |
| 288 | 288 | |
@@ -306,7 +306,7 @@ discard block |
||
| 306 | 306 | ob_end_clean(); |
| 307 | 307 | |
| 308 | 308 | // Show error message |
| 309 | - self::output('Invalid callback sent to Timer::callback: ' . str_replace('callback: ', '', $key)); |
|
| 309 | + self::output('Invalid callback sent to Timer::callback: '.str_replace('callback: ', '', $key)); |
|
| 310 | 310 | |
| 311 | 311 | // Clear the item from the collection |
| 312 | 312 | unset(self::$collection[$key]); |
@@ -361,7 +361,7 @@ discard block |
||
| 361 | 361 | $stats = self::getStats($key, $options); |
| 362 | 362 | |
| 363 | 363 | if (php_sapi_name() == 'cli') { |
| 364 | - $output .= (!empty($output) ? "\n" : '') . $stats; |
|
| 364 | + $output .= (!empty($output) ? "\n" : '').$stats; |
|
| 365 | 365 | } else { |
| 366 | 366 | $output .= '<div class="xicrow-php-debug-timer">'; |
| 367 | 367 | $output .= $stats; |
@@ -397,7 +397,7 @@ discard block |
||
| 397 | 397 | |
| 398 | 398 | // If item does not exist |
| 399 | 399 | if (!isset(self::$collection[$key])) { |
| 400 | - return 'Unknow item in with key: ' . $key; |
|
| 400 | + return 'Unknow item in with key: '.$key; |
|
| 401 | 401 | } |
| 402 | 402 | |
| 403 | 403 | // Get item |
@@ -419,7 +419,7 @@ discard block |
||
| 419 | 419 | $outputName .= ($options['nested'] ? str_repeat($options['nested_prefix'], $item['level']) : ''); |
| 420 | 420 | $outputName .= $item['key']; |
| 421 | 421 | if (mb_strlen($outputName) > $options['max_key_length']) { |
| 422 | - $outputName = '~' . mb_substr($item['key'], -($options['max_key_length'] - 1)); |
|
| 422 | + $outputName = '~'.mb_substr($item['key'], -($options['max_key_length'] - 1)); |
|
| 423 | 423 | } |
| 424 | 424 | |
| 425 | 425 | // Add item stats |
@@ -431,7 +431,7 @@ discard block |
||
| 431 | 431 | krsort(self::$colorThreshold); |
| 432 | 432 | foreach (self::$colorThreshold as $value => $color) { |
| 433 | 433 | if (is_numeric($itemResult) && $itemResult >= $value) { |
| 434 | - $output = '<span style="color: ' . $color . ';">' . $output . '</span>'; |
|
| 434 | + $output = '<span style="color: '.$color.';">'.$output.'</span>'; |
|
| 435 | 435 | } |
| 436 | 436 | } |
| 437 | 437 | } |
@@ -482,6 +482,6 @@ discard block |
||
| 482 | 482 | } |
| 483 | 483 | } |
| 484 | 484 | |
| 485 | - return sprintf('%0.' . $precision . 'f', $value) . ' ' . str_pad($unit, 2, ' ', STR_PAD_RIGHT); |
|
| 485 | + return sprintf('%0.'.$precision.'f', $value).' '.str_pad($unit, 2, ' ', STR_PAD_RIGHT); |
|
| 486 | 486 | } |
| 487 | 487 | } |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | $output = ''; |
| 102 | 102 | $traceIndex = ($options['reverse'] ? 1 : count($backtrace)); |
| 103 | 103 | foreach ($backtrace as $trace) { |
| 104 | - $output .= $traceIndex . ': '; |
|
| 104 | + $output .= $traceIndex.': '; |
|
| 105 | 105 | $output .= self::getCalledFromTrace($trace); |
| 106 | 106 | $output .= "\n"; |
| 107 | 107 | |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | $data .= "\n"; |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | - $data .= 'class ' . $reflectionClass->name . '{'; |
|
| 132 | + $data .= 'class '.$reflectionClass->name.'{'; |
|
| 133 | 133 | $firstElement = true; |
| 134 | 134 | foreach ($reflectionClass->getProperties() as $reflectionProperty) { |
| 135 | 135 | if (!$firstElement) { |
@@ -186,9 +186,9 @@ discard block |
||
| 186 | 186 | $data .= ($reflectionProperty->isPrivate() ? 'private ' : ''); |
| 187 | 187 | $data .= ($reflectionProperty->isProtected() ? 'protected ' : ''); |
| 188 | 188 | $data .= ($reflectionProperty->isStatic() ? 'static ' : ''); |
| 189 | - $data .= '$' . $reflectionProperty->name; |
|
| 189 | + $data .= '$'.$reflectionProperty->name; |
|
| 190 | 190 | if (isset($defaultPropertyValues[$property])) { |
| 191 | - $data .= ' = ' . self::getDebugInformation($defaultPropertyValues[$property]); |
|
| 191 | + $data .= ' = '.self::getDebugInformation($defaultPropertyValues[$property]); |
|
| 192 | 192 | } |
| 193 | 193 | $data .= ';'; |
| 194 | 194 | |
@@ -225,15 +225,15 @@ discard block |
||
| 225 | 225 | $data .= ($reflectionMethod->isPrivate() ? 'private ' : ''); |
| 226 | 226 | $data .= ($reflectionMethod->isProtected() ? 'protected ' : ''); |
| 227 | 227 | $data .= ($reflectionMethod->isStatic() ? 'static ' : ''); |
| 228 | - $data .= 'function ' . $reflectionMethod->name . '('; |
|
| 228 | + $data .= 'function '.$reflectionMethod->name.'('; |
|
| 229 | 229 | if ($reflectionMethod->getNumberOfParameters()) { |
| 230 | 230 | foreach ($reflectionMethod->getParameters() as $reflectionMethodParameterIndex => $reflectionMethodParameter) { |
| 231 | 231 | $data .= ($reflectionMethodParameterIndex > 0 ? ', ' : ''); |
| 232 | - $data .= '$' . $reflectionMethodParameter->name; |
|
| 232 | + $data .= '$'.$reflectionMethodParameter->name; |
|
| 233 | 233 | if ($reflectionMethodParameter->isDefaultValueAvailable()) { |
| 234 | 234 | $defaultValue = self::getDebugInformation($reflectionMethodParameter->getDefaultValue()); |
| 235 | 235 | $defaultValue = str_replace(["\n", "\t"], '', $defaultValue); |
| 236 | - $data .= ' = ' . $defaultValue; |
|
| 236 | + $data .= ' = '.$defaultValue; |
|
| 237 | 237 | } |
| 238 | 238 | } |
| 239 | 239 | } |
@@ -256,7 +256,7 @@ discard block |
||
| 256 | 256 | $backtrace = debug_backtrace(); |
| 257 | 257 | |
| 258 | 258 | if (!isset($backtrace[$index])) { |
| 259 | - return 'Unknown trace with index: ' . $index; |
|
| 259 | + return 'Unknown trace with index: '.$index; |
|
| 260 | 260 | } |
| 261 | 261 | |
| 262 | 262 | return self::getCalledFromTrace($backtrace[$index]); |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | // Get file and line number |
| 273 | 273 | $calledFromFile = ''; |
| 274 | 274 | if (isset($trace['file'])) { |
| 275 | - $calledFromFile .= $trace['file'] . ' line ' . $trace['line']; |
|
| 275 | + $calledFromFile .= $trace['file'].' line '.$trace['line']; |
|
| 276 | 276 | $calledFromFile = str_replace('\\', '/', $calledFromFile); |
| 277 | 277 | $calledFromFile = (!empty(self::$documentRoot) ? substr($calledFromFile, strlen(self::$documentRoot)) : $calledFromFile); |
| 278 | 278 | $calledFromFile = trim($calledFromFile, '/'); |
@@ -283,7 +283,7 @@ discard block |
||
| 283 | 283 | if (isset($trace['function'])) { |
| 284 | 284 | $calledFromFunction .= (isset($trace['class']) ? $trace['class'] : ''); |
| 285 | 285 | $calledFromFunction .= (isset($trace['type']) ? $trace['type'] : ''); |
| 286 | - $calledFromFunction .= $trace['function'] . '()'; |
|
| 286 | + $calledFromFunction .= $trace['function'].'()'; |
|
| 287 | 287 | } |
| 288 | 288 | |
| 289 | 289 | // Return called from |
@@ -313,20 +313,20 @@ discard block |
||
| 313 | 313 | $dataType = gettype($data); |
| 314 | 314 | |
| 315 | 315 | // Set name of method to get debug information for data |
| 316 | - $methodName = 'getDebugInformation' . ucfirst(strtolower($dataType)); |
|
| 316 | + $methodName = 'getDebugInformation'.ucfirst(strtolower($dataType)); |
|
| 317 | 317 | |
| 318 | 318 | // Get result from debug information method |
| 319 | - $result = 'No method found supporting data type: ' . $dataType; |
|
| 319 | + $result = 'No method found supporting data type: '.$dataType; |
|
| 320 | 320 | if (method_exists('\Xicrow\PhpDebug\Debugger', $methodName)) { |
| 321 | - $result = (string)self::$methodName($data, [ |
|
| 321 | + $result = (string) self::$methodName($data, [ |
|
| 322 | 322 | 'depth' => ($options['depth'] - 1), |
| 323 | 323 | 'indent' => ($options['indent'] + 1), |
| 324 | 324 | ]); |
| 325 | 325 | } |
| 326 | 326 | |
| 327 | 327 | // Format the result |
| 328 | - if (php_sapi_name() != 'cli' && !empty(self::$style['debug_' . strtolower($dataType) . '_format'])) { |
|
| 329 | - $result = sprintf(self::$style['debug_' . strtolower($dataType) . '_format'], $result); |
|
| 328 | + if (php_sapi_name() != 'cli' && !empty(self::$style['debug_'.strtolower($dataType).'_format'])) { |
|
| 329 | + $result = sprintf(self::$style['debug_'.strtolower($dataType).'_format'], $result); |
|
| 330 | 330 | } |
| 331 | 331 | |
| 332 | 332 | // Return result |
@@ -338,7 +338,7 @@ discard block |
||
| 338 | 338 | */ |
| 339 | 339 | private static function getDebugInformationString($data) |
| 340 | 340 | { |
| 341 | - return (string)(php_sapi_name() == 'cli' ? '"' . $data . '"' : htmlentities($data)); |
|
| 341 | + return (string) (php_sapi_name() == 'cli' ? '"'.$data.'"' : htmlentities($data)); |
|
| 342 | 342 | } |
| 343 | 343 | |
| 344 | 344 | /** |
@@ -366,7 +366,7 @@ discard block |
||
| 366 | 366 | */ |
| 367 | 367 | private static function getDebugInformationInteger($data) |
| 368 | 368 | { |
| 369 | - return (string)$data; |
|
| 369 | + return (string) $data; |
|
| 370 | 370 | } |
| 371 | 371 | |
| 372 | 372 | /** |
@@ -376,7 +376,7 @@ discard block |
||
| 376 | 376 | */ |
| 377 | 377 | private static function getDebugInformationDouble($data) |
| 378 | 378 | { |
| 379 | - return (string)$data; |
|
| 379 | + return (string) $data; |
|
| 380 | 380 | } |
| 381 | 381 | |
| 382 | 382 | /** |
@@ -395,8 +395,8 @@ discard block |
||
| 395 | 395 | |
| 396 | 396 | $break = $end = null; |
| 397 | 397 | if (!empty($data)) { |
| 398 | - $break = "\n" . str_repeat("\t", $options['indent']); |
|
| 399 | - $end = "\n" . str_repeat("\t", $options['indent'] - 1); |
|
| 398 | + $break = "\n".str_repeat("\t", $options['indent']); |
|
| 399 | + $end = "\n".str_repeat("\t", $options['indent'] - 1); |
|
| 400 | 400 | } |
| 401 | 401 | |
| 402 | 402 | $datas = []; |
@@ -408,13 +408,13 @@ discard block |
||
| 408 | 408 | } elseif ($val !== $data) { |
| 409 | 409 | $val = static::getDebugInformation($val, $options); |
| 410 | 410 | } |
| 411 | - $datas[] = $break . static::getDebugInformation($key) . ' => ' . $val; |
|
| 411 | + $datas[] = $break.static::getDebugInformation($key).' => '.$val; |
|
| 412 | 412 | } |
| 413 | 413 | } else { |
| 414 | - $datas[] = $break . '[maximum depth reached]'; |
|
| 414 | + $datas[] = $break.'[maximum depth reached]'; |
|
| 415 | 415 | } |
| 416 | 416 | |
| 417 | - return $debugInfo . implode(',', $datas) . $end . ']'; |
|
| 417 | + return $debugInfo.implode(',', $datas).$end.']'; |
|
| 418 | 418 | } |
| 419 | 419 | |
| 420 | 420 | /** |
@@ -430,23 +430,23 @@ discard block |
||
| 430 | 430 | ], $options); |
| 431 | 431 | |
| 432 | 432 | $debugInfo = ''; |
| 433 | - $debugInfo .= 'object(' . get_class($data) . ') {'; |
|
| 433 | + $debugInfo .= 'object('.get_class($data).') {'; |
|
| 434 | 434 | |
| 435 | - $break = "\n" . str_repeat("\t", $options['indent']); |
|
| 436 | - $end = "\n" . str_repeat("\t", $options['indent'] - 1); |
|
| 435 | + $break = "\n".str_repeat("\t", $options['indent']); |
|
| 436 | + $end = "\n".str_repeat("\t", $options['indent'] - 1); |
|
| 437 | 437 | |
| 438 | 438 | if ($options['depth'] > 0 && method_exists($data, '__debugInfo')) { |
| 439 | 439 | try { |
| 440 | 440 | $debugArray = static::getDebugInformationArray($data->__debugInfo(), array_merge($options, [ |
| 441 | 441 | 'depth' => ($options['depth'] - 1), |
| 442 | 442 | ])); |
| 443 | - $debugInfo .= substr($debugArray, 1, -1); |
|
| 443 | + $debugInfo .= substr($debugArray, 1, -1); |
|
| 444 | 444 | |
| 445 | - return $debugInfo . $end . '}'; |
|
| 445 | + return $debugInfo.$end.'}'; |
|
| 446 | 446 | } catch (\Exception $e) { |
| 447 | 447 | $message = $e->getMessage(); |
| 448 | 448 | |
| 449 | - return $debugInfo . "\n(unable to export object: $message)\n }"; |
|
| 449 | + return $debugInfo."\n(unable to export object: $message)\n }"; |
|
| 450 | 450 | } |
| 451 | 451 | } |
| 452 | 452 | |
@@ -457,7 +457,7 @@ discard block |
||
| 457 | 457 | $value = static::getDebugInformation($value, array_merge($options, [ |
| 458 | 458 | 'depth' => ($options['depth'] - 1), |
| 459 | 459 | ])); |
| 460 | - $props[] = "$key => " . $value; |
|
| 460 | + $props[] = "$key => ".$value; |
|
| 461 | 461 | } |
| 462 | 462 | |
| 463 | 463 | $ref = new \ReflectionObject($data); |
@@ -479,7 +479,7 @@ discard block |
||
| 479 | 479 | } |
| 480 | 480 | } |
| 481 | 481 | |
| 482 | - $debugInfo .= $break . implode($break, $props) . $end; |
|
| 482 | + $debugInfo .= $break.implode($break, $props).$end; |
|
| 483 | 483 | } |
| 484 | 484 | $debugInfo .= '}'; |
| 485 | 485 | |
@@ -493,6 +493,6 @@ discard block |
||
| 493 | 493 | */ |
| 494 | 494 | private static function getDebugInformationResource($data) |
| 495 | 495 | { |
| 496 | - return (string)$data . ' (' . get_resource_type($data) . ')'; |
|
| 496 | + return (string) $data.' ('.get_resource_type($data).')'; |
|
| 497 | 497 | } |
| 498 | 498 | } |