Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
30de3eb13a | ||
|
|
56e5991094 | ||
|
|
be483eec6e |
@@ -7,14 +7,6 @@ Stable version
|
|||||||
```bash
|
```bash
|
||||||
composer require --dev rmphp/var-damper
|
composer require --dev rmphp/var-damper
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
composer require --dev rmphp/var-damper:"^1.0"
|
composer require --dev rmphp/var-damper:"^1.0"
|
||||||
```
|
|
||||||
|
|
||||||
Dev version contains the latest changes
|
|
||||||
|
|
||||||
```bash
|
|
||||||
composer require --dev rmphp/var-damper:"1.0.x-dev"
|
|
||||||
```
|
```
|
||||||
@@ -12,6 +12,7 @@ class Dumper {
|
|||||||
private static string $objhex;
|
private static string $objhex;
|
||||||
private static int $objid = 0;
|
private static int $objid = 0;
|
||||||
private static int $deep = 0;
|
private static int $deep = 0;
|
||||||
|
private static string $blockTitle = "array";
|
||||||
|
|
||||||
private static function initObjhex() : void {
|
private static function initObjhex() : void {
|
||||||
self::$objid++;
|
self::$objid++;
|
||||||
@@ -56,7 +57,7 @@ class Dumper {
|
|||||||
|
|
||||||
private static function generateStartLine(): void {
|
private static function generateStartLine(): void {
|
||||||
?>
|
?>
|
||||||
<div style="position:relative; box-sizing: border-box; width:100%; padding:10px; background: #000000; z-index: 10000; overflow: auto;">
|
<div style="position:relative; box-sizing: border-box; width:100%; padding:10px; background: #000000; z-index: 10000; overflow: auto; margin-bottom: 10px;">
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -115,34 +116,37 @@ class Dumper {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function dump(mixed $value, string $name = ""): void {
|
public static function dump(array $value): void {
|
||||||
if(in_array(\PHP_SAPI, ['cli', 'phpdbg'], true)){
|
foreach ($value as $val){
|
||||||
var_dump($value);
|
if(in_array(\PHP_SAPI, ['cli', 'phpdbg'], true)){
|
||||||
} else {
|
var_dump($val);
|
||||||
self::initObjhex();
|
} else {
|
||||||
self::generateCSSBlock();
|
self::initObjhex();
|
||||||
self::generateStartLine();
|
self::generateCSSBlock();
|
||||||
self::generateHTMLBlock($value, $name ?? null);
|
self::generateStartLine();
|
||||||
self::generateEndLine();
|
self::generateHTMLBlock($val, self::$blockTitle);
|
||||||
self::generateJSBlock();
|
self::generateEndLine();
|
||||||
}
|
self::generateJSBlock();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function addShutdownInfo(array $exData = []) : void {
|
public static function addShutdownInfo(array $exData = []) : void {
|
||||||
register_shutdown_function(function() use ($exData) {
|
register_shutdown_function(function() use ($exData) {
|
||||||
$finish = array_sum(explode(' ', microtime()));
|
$finish = array_sum(explode(' ', microtime()));
|
||||||
$info[] = error_get_last();
|
|
||||||
$info[] = "Время генерации: ".substr((string)($finish-$_SERVER['REQUEST_TIME_FLOAT']), 0, 10)." сек.";
|
$info[] = "Время генерации: ".substr((string)($finish-$_SERVER['REQUEST_TIME_FLOAT']), 0, 10)." сек.";
|
||||||
$info[] = "Объем памяти: ".round((memory_get_usage()),2)." байт.";
|
$info[] = "Объем памяти: ".round((memory_get_usage()),2)." байт.";
|
||||||
$info[] = "Выделено памяти в пике: ".round((memory_get_peak_usage()),2)." байт.";
|
$info[] = "Выделено памяти в пике: ".round((memory_get_peak_usage()),2)." байт.";
|
||||||
$exData['info'] = array_diff($info, array(null));
|
$exData['info'] = $info;
|
||||||
self::dump($exData, "Dump info");
|
if(error_get_last()) $exData['errors'] = error_get_last();
|
||||||
|
self::$blockTitle = "Dump info";
|
||||||
|
self::dump([$exData]);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function vdd(mixed $exData) : void {
|
public static function vdd(array $value) : void {
|
||||||
register_shutdown_function(function() use ($exData) {
|
register_shutdown_function(function() use ($value) {
|
||||||
self::dump($exData);
|
self::dump($value);
|
||||||
});
|
});
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ if (!function_exists('vdd')) {
|
|||||||
* @param mixed $value
|
* @param mixed $value
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function vdd(mixed $value): void {
|
function vdd(mixed ...$value): void {
|
||||||
Dumper::vdd($value);
|
Dumper::vdd($value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -30,7 +30,7 @@ if (!function_exists('vd')) {
|
|||||||
* @param mixed $value
|
* @param mixed $value
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function vd(mixed $value): void {
|
function vd(mixed ...$value): void {
|
||||||
Dumper::dump($value);
|
Dumper::dump($value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user