@@ -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 | * |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | // Set correct key for the original item |
| 104 | 104 | if (strpos($item['key'], '#') === false) { |
| 105 | 105 | self::$collection[$key] = array_merge($item, [ |
| 106 | - 'key' => $key . ' #1', |
|
| 106 | + 'key' => $key.' #1', |
|
| 107 | 107 | 'count' => $itemCount, |
| 108 | 108 | ]); |
| 109 | 109 | } else { |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | // Set new key |
| 116 | - $key = $key . ' #' . $itemCount; |
|
| 116 | + $key = $key.' #'.$itemCount; |
|
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | // Make sure various options are set |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | // Check for key duplicates, and find the last one not stopped |
| 175 | - if (isset(self::$collection[$key]) && isset(self::$collection[$key . ' #2'])) { |
|
| 175 | + if (isset(self::$collection[$key]) && isset(self::$collection[$key.' #2'])) { |
|
| 176 | 176 | $lastNotStopped = false; |
| 177 | 177 | $currentKey = $key; |
| 178 | 178 | $currentIndex = 1; |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | } |
| 183 | 183 | |
| 184 | 184 | $currentIndex++; |
| 185 | - $currentKey = $key . ' #' . $currentIndex; |
|
| 185 | + $currentKey = $key.' #'.$currentIndex; |
|
| 186 | 186 | } |
| 187 | 187 | |
| 188 | 188 | if ($lastNotStopped) { |
@@ -263,21 +263,21 @@ discard block |
||
| 263 | 263 | if (count($keyArr) > 1) { |
| 264 | 264 | $method = array_pop($keyArr); |
| 265 | 265 | $key = implode('/', $keyArr); |
| 266 | - $key .= '::' . $method; |
|
| 266 | + $key .= '::'.$method; |
|
| 267 | 267 | } |
| 268 | 268 | |
| 269 | 269 | unset($keyArr, $method); |
| 270 | 270 | } elseif (is_object($callback) && $callback instanceof \Closure) { |
| 271 | 271 | $key = 'closure'; |
| 272 | 272 | } |
| 273 | - $key = 'callback: ' . $key; |
|
| 273 | + $key = 'callback: '.$key; |
|
| 274 | 274 | } |
| 275 | 275 | |
| 276 | 276 | // Set default return value |
| 277 | 277 | $returnValue = true; |
| 278 | 278 | |
| 279 | 279 | // Set error handler, to convert errors to exceptions |
| 280 | - set_error_handler(function ($errno, $errstr, $errfile, $errline, array $errcontext) { |
|
| 280 | + set_error_handler(function($errno, $errstr, $errfile, $errline, array $errcontext) { |
|
| 281 | 281 | throw new \ErrorException($errstr, 0, $errno, $errfile, $errline); |
| 282 | 282 | }); |
| 283 | 283 | |
@@ -301,7 +301,7 @@ discard block |
||
| 301 | 301 | ob_end_clean(); |
| 302 | 302 | |
| 303 | 303 | // Show error message |
| 304 | - self::output('Invalid callback sent to Timer::callback: ' . str_replace('callback: ', '', $key)); |
|
| 304 | + self::output('Invalid callback sent to Timer::callback: '.str_replace('callback: ', '', $key)); |
|
| 305 | 305 | |
| 306 | 306 | // Clear the item from the collection |
| 307 | 307 | unset(self::$collection[$key]); |
@@ -356,7 +356,7 @@ discard block |
||
| 356 | 356 | $stats = self::getStats($key, $options); |
| 357 | 357 | |
| 358 | 358 | if (php_sapi_name() == 'cli') { |
| 359 | - $output .= (!empty($output) ? "\n" : '') . $stats; |
|
| 359 | + $output .= (!empty($output) ? "\n" : '').$stats; |
|
| 360 | 360 | } else { |
| 361 | 361 | $output .= '<div class="xicrow-php-debug-timer">'; |
| 362 | 362 | $output .= $stats; |
@@ -392,7 +392,7 @@ discard block |
||
| 392 | 392 | |
| 393 | 393 | // If item does not exist |
| 394 | 394 | if (!isset(self::$collection[$key])) { |
| 395 | - return 'Unknow item in with key: ' . $key; |
|
| 395 | + return 'Unknow item in with key: '.$key; |
|
| 396 | 396 | } |
| 397 | 397 | |
| 398 | 398 | // Get item |
@@ -414,7 +414,7 @@ discard block |
||
| 414 | 414 | $outputName .= ($options['nested'] ? str_repeat($options['nested_prefix'], $item['level']) : ''); |
| 415 | 415 | $outputName .= $item['key']; |
| 416 | 416 | if (mb_strlen($outputName) > $options['max_key_length']) { |
| 417 | - $outputName = '~' . mb_substr($item['key'], -($options['max_key_length'] - 1)); |
|
| 417 | + $outputName = '~'.mb_substr($item['key'], -($options['max_key_length'] - 1)); |
|
| 418 | 418 | } |
| 419 | 419 | |
| 420 | 420 | // Add item stats |
@@ -426,7 +426,7 @@ discard block |
||
| 426 | 426 | krsort(self::$colorThreshold); |
| 427 | 427 | foreach (self::$colorThreshold as $value => $color) { |
| 428 | 428 | if (is_numeric($itemResult) && $itemResult >= $value) { |
| 429 | - $output = '<span style="color: ' . $color . ';">' . $output . '</span>'; |
|
| 429 | + $output = '<span style="color: '.$color.';">'.$output.'</span>'; |
|
| 430 | 430 | } |
| 431 | 431 | } |
| 432 | 432 | } |
@@ -477,6 +477,6 @@ discard block |
||
| 477 | 477 | } |
| 478 | 478 | } |
| 479 | 479 | |
| 480 | - return sprintf('%0.' . $precision . 'f', $value) . ' ' . str_pad($unit, 2, ' ', STR_PAD_RIGHT); |
|
| 480 | + return sprintf('%0.'.$precision.'f', $value).' '.str_pad($unit, 2, ' ', STR_PAD_RIGHT); |
|
| 481 | 481 | } |
| 482 | 482 | } |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | $output = ''; |
| 99 | 99 | $traceIndex = ($options['reverse'] ? 1 : count($backtrace)); |
| 100 | 100 | foreach ($backtrace as $trace) { |
| 101 | - $output .= $traceIndex . ': '; |
|
| 101 | + $output .= $traceIndex.': '; |
|
| 102 | 102 | $output .= self::getCalledFromTrace($trace); |
| 103 | 103 | $output .= "\n"; |
| 104 | 104 | |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | $data .= "\n"; |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | - $data .= 'class ' . $reflectionClass->name . '{'; |
|
| 129 | + $data .= 'class '.$reflectionClass->name.'{'; |
|
| 130 | 130 | $firstElement = true; |
| 131 | 131 | foreach ($reflectionClass->getProperties() as $reflectionProperty) { |
| 132 | 132 | if (!$firstElement) { |
@@ -183,9 +183,9 @@ discard block |
||
| 183 | 183 | $data .= ($reflectionProperty->isPrivate() ? 'private ' : ''); |
| 184 | 184 | $data .= ($reflectionProperty->isProtected() ? 'protected ' : ''); |
| 185 | 185 | $data .= ($reflectionProperty->isStatic() ? 'static ' : ''); |
| 186 | - $data .= '$' . $reflectionProperty->name; |
|
| 186 | + $data .= '$'.$reflectionProperty->name; |
|
| 187 | 187 | if (isset($defaultPropertyValues[$property])) { |
| 188 | - $data .= ' = ' . self::getDebugInformation($defaultPropertyValues[$property]); |
|
| 188 | + $data .= ' = '.self::getDebugInformation($defaultPropertyValues[$property]); |
|
| 189 | 189 | } |
| 190 | 190 | $data .= ';'; |
| 191 | 191 | |
@@ -221,15 +221,15 @@ discard block |
||
| 221 | 221 | $data .= ($reflectionMethod->isPrivate() ? 'private ' : ''); |
| 222 | 222 | $data .= ($reflectionMethod->isProtected() ? 'protected ' : ''); |
| 223 | 223 | $data .= ($reflectionMethod->isStatic() ? 'static ' : ''); |
| 224 | - $data .= 'function ' . $reflectionMethod->name . '('; |
|
| 224 | + $data .= 'function '.$reflectionMethod->name.'('; |
|
| 225 | 225 | if ($reflectionMethod->getNumberOfParameters()) { |
| 226 | 226 | foreach ($reflectionMethod->getParameters() as $reflectionMethodParameterIndex => $reflectionMethodParameter) { |
| 227 | 227 | $data .= ($reflectionMethodParameterIndex > 0 ? ', ' : ''); |
| 228 | - $data .= '$' . $reflectionMethodParameter->name; |
|
| 228 | + $data .= '$'.$reflectionMethodParameter->name; |
|
| 229 | 229 | if ($reflectionMethodParameter->isDefaultValueAvailable()) { |
| 230 | 230 | $defaultValue = self::getDebugInformation($reflectionMethodParameter->getDefaultValue()); |
| 231 | 231 | $defaultValue = str_replace(["\n", "\t"], '', $defaultValue); |
| 232 | - $data .= ' = ' . $defaultValue; |
|
| 232 | + $data .= ' = '.$defaultValue; |
|
| 233 | 233 | } |
| 234 | 234 | } |
| 235 | 235 | } |
@@ -252,7 +252,7 @@ discard block |
||
| 252 | 252 | $backtrace = debug_backtrace(); |
| 253 | 253 | |
| 254 | 254 | if (!isset($backtrace[$index])) { |
| 255 | - return 'Unknown trace with index: ' . $index; |
|
| 255 | + return 'Unknown trace with index: '.$index; |
|
| 256 | 256 | } |
| 257 | 257 | |
| 258 | 258 | return self::getCalledFromTrace($backtrace[$index]); |
@@ -268,7 +268,7 @@ discard block |
||
| 268 | 268 | // Get file and line number |
| 269 | 269 | $calledFromFile = ''; |
| 270 | 270 | if (isset($trace['file'])) { |
| 271 | - $calledFromFile .= $trace['file'] . ' line ' . $trace['line']; |
|
| 271 | + $calledFromFile .= $trace['file'].' line '.$trace['line']; |
|
| 272 | 272 | $calledFromFile = str_replace('\\', '/', $calledFromFile); |
| 273 | 273 | $calledFromFile = (!empty(self::$documentRoot) ? substr($calledFromFile, strlen(self::$documentRoot)) : $calledFromFile); |
| 274 | 274 | $calledFromFile = trim($calledFromFile, '/'); |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | if (isset($trace['function'])) { |
| 280 | 280 | $calledFromFunction .= (isset($trace['class']) ? $trace['class'] : ''); |
| 281 | 281 | $calledFromFunction .= (isset($trace['type']) ? $trace['type'] : ''); |
| 282 | - $calledFromFunction .= $trace['function'] . '()'; |
|
| 282 | + $calledFromFunction .= $trace['function'].'()'; |
|
| 283 | 283 | } |
| 284 | 284 | |
| 285 | 285 | // Return called from |
@@ -306,27 +306,27 @@ discard block |
||
| 306 | 306 | |
| 307 | 307 | $dataType = gettype($data); |
| 308 | 308 | |
| 309 | - $methodName = 'getDebugInformation' . ucfirst(strtolower($dataType)); |
|
| 309 | + $methodName = 'getDebugInformation'.ucfirst(strtolower($dataType)); |
|
| 310 | 310 | |
| 311 | - $result = 'No method found supporting data type: ' . $dataType; |
|
| 311 | + $result = 'No method found supporting data type: '.$dataType; |
|
| 312 | 312 | if ($dataType == 'string') { |
| 313 | 313 | if (php_sapi_name() == 'cli') { |
| 314 | - $result = '"' . (string)$data . '"'; |
|
| 314 | + $result = '"'.(string) $data.'"'; |
|
| 315 | 315 | } else { |
| 316 | 316 | $result = htmlentities($data); |
| 317 | 317 | if ($data !== '' && $result === '') { |
| 318 | 318 | $result = htmlentities(utf8_encode($data)); |
| 319 | 319 | } |
| 320 | 320 | |
| 321 | - $result = sprintf(self::$style['debug_string_format'], (string)$result); |
|
| 321 | + $result = sprintf(self::$style['debug_string_format'], (string) $result); |
|
| 322 | 322 | } |
| 323 | 323 | } elseif (method_exists('\Xicrow\PhpDebug\Debugger', $methodName)) { |
| 324 | - $result = (string)self::$methodName($data, [ |
|
| 324 | + $result = (string) self::$methodName($data, [ |
|
| 325 | 325 | 'depth' => ($options['depth'] - 1), |
| 326 | 326 | 'indent' => ($options['indent'] + 1), |
| 327 | 327 | ]); |
| 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 | |
@@ -358,7 +358,7 @@ discard block |
||
| 358 | 358 | */ |
| 359 | 359 | private static function getDebugInformationInteger($data) |
| 360 | 360 | { |
| 361 | - return (string)$data; |
|
| 361 | + return (string) $data; |
|
| 362 | 362 | } |
| 363 | 363 | |
| 364 | 364 | /** |
@@ -368,7 +368,7 @@ discard block |
||
| 368 | 368 | */ |
| 369 | 369 | private static function getDebugInformationDouble($data) |
| 370 | 370 | { |
| 371 | - return (string)$data; |
|
| 371 | + return (string) $data; |
|
| 372 | 372 | } |
| 373 | 373 | |
| 374 | 374 | /** |
@@ -387,8 +387,8 @@ discard block |
||
| 387 | 387 | |
| 388 | 388 | $break = $end = null; |
| 389 | 389 | if (!empty($data)) { |
| 390 | - $break = "\n" . str_repeat("\t", $options['indent']); |
|
| 391 | - $end = "\n" . str_repeat("\t", $options['indent'] - 1); |
|
| 390 | + $break = "\n".str_repeat("\t", $options['indent']); |
|
| 391 | + $end = "\n".str_repeat("\t", $options['indent'] - 1); |
|
| 392 | 392 | } |
| 393 | 393 | |
| 394 | 394 | $datas = []; |
@@ -400,13 +400,13 @@ discard block |
||
| 400 | 400 | } elseif ($val !== $data) { |
| 401 | 401 | $val = static::getDebugInformation($val, $options); |
| 402 | 402 | } |
| 403 | - $datas[] = $break . static::getDebugInformation($key) . ' => ' . $val; |
|
| 403 | + $datas[] = $break.static::getDebugInformation($key).' => '.$val; |
|
| 404 | 404 | } |
| 405 | 405 | } else { |
| 406 | - $datas[] = $break . '[maximum depth reached]'; |
|
| 406 | + $datas[] = $break.'[maximum depth reached]'; |
|
| 407 | 407 | } |
| 408 | 408 | |
| 409 | - return $debugInfo . implode(',', $datas) . $end . ']'; |
|
| 409 | + return $debugInfo.implode(',', $datas).$end.']'; |
|
| 410 | 410 | } |
| 411 | 411 | |
| 412 | 412 | /** |
@@ -422,23 +422,23 @@ discard block |
||
| 422 | 422 | ], $options); |
| 423 | 423 | |
| 424 | 424 | $debugInfo = ''; |
| 425 | - $debugInfo .= 'object(' . get_class($data) . ') {'; |
|
| 425 | + $debugInfo .= 'object('.get_class($data).') {'; |
|
| 426 | 426 | |
| 427 | - $break = "\n" . str_repeat("\t", $options['indent']); |
|
| 428 | - $end = "\n" . str_repeat("\t", $options['indent'] - 1); |
|
| 427 | + $break = "\n".str_repeat("\t", $options['indent']); |
|
| 428 | + $end = "\n".str_repeat("\t", $options['indent'] - 1); |
|
| 429 | 429 | |
| 430 | 430 | if ($options['depth'] > 0 && method_exists($data, '__debugInfo')) { |
| 431 | 431 | try { |
| 432 | 432 | $debugArray = static::getDebugInformationArray($data->__debugInfo(), array_merge($options, [ |
| 433 | 433 | 'depth' => ($options['depth'] - 1), |
| 434 | 434 | ])); |
| 435 | - $debugInfo .= substr($debugArray, 1, -1); |
|
| 435 | + $debugInfo .= substr($debugArray, 1, -1); |
|
| 436 | 436 | |
| 437 | - return $debugInfo . $end . '}'; |
|
| 437 | + return $debugInfo.$end.'}'; |
|
| 438 | 438 | } catch (\Exception $e) { |
| 439 | 439 | $message = $e->getMessage(); |
| 440 | 440 | |
| 441 | - return $debugInfo . "\n(unable to export object: $message)\n }"; |
|
| 441 | + return $debugInfo."\n(unable to export object: $message)\n }"; |
|
| 442 | 442 | } |
| 443 | 443 | } |
| 444 | 444 | |
@@ -449,7 +449,7 @@ discard block |
||
| 449 | 449 | $value = static::getDebugInformation($value, array_merge($options, [ |
| 450 | 450 | 'depth' => ($options['depth'] - 1), |
| 451 | 451 | ])); |
| 452 | - $props[] = "$key => " . $value; |
|
| 452 | + $props[] = "$key => ".$value; |
|
| 453 | 453 | } |
| 454 | 454 | |
| 455 | 455 | $ref = new \ReflectionObject($data); |
@@ -471,7 +471,7 @@ discard block |
||
| 471 | 471 | } |
| 472 | 472 | } |
| 473 | 473 | |
| 474 | - $debugInfo .= $break . implode($break, $props) . $end; |
|
| 474 | + $debugInfo .= $break.implode($break, $props).$end; |
|
| 475 | 475 | } |
| 476 | 476 | $debugInfo .= '}'; |
| 477 | 477 | |
@@ -485,6 +485,6 @@ discard block |
||
| 485 | 485 | */ |
| 486 | 486 | private static function getDebugInformationResource($data) |
| 487 | 487 | { |
| 488 | - return (string)$data . ' (' . get_resource_type($data) . ')'; |
|
| 488 | + return (string) $data.' ('.get_resource_type($data).')'; |
|
| 489 | 489 | } |
| 490 | 490 | } |