3 Commits
1.0.1 ... 1.1.1

Author SHA1 Message Date
User
20fa15128d 20230926#3 2023-09-26 21:20:21 +03:00
User
be7677bb23 20230926#2 2023-09-26 20:54:08 +03:00
User
30de3eb13a 20230818#3 2023-08-18 02:55:26 +03:00
3 changed files with 24 additions and 25 deletions

View File

@@ -7,13 +7,7 @@ Stable version
```bash
composer require --dev rmphp/var-damper
```
```bash
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"
```

View File

@@ -12,6 +12,7 @@ class Dumper {
private static string $objhex;
private static int $objid = 0;
private static int $deep = 0;
private static string $blockTitle = "array";
private static function initObjhex() : void {
self::$objid++;
@@ -56,7 +57,7 @@ class Dumper {
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
}
@@ -115,18 +116,20 @@ class Dumper {
}
}
public static function dump(mixed $value, string $name = ""): void {
public static function dump(array $value): void {
foreach ($value as $val){
if(in_array(\PHP_SAPI, ['cli', 'phpdbg'], true)){
var_dump($value);
var_dump($val);
} else {
self::initObjhex();
self::generateCSSBlock();
self::generateStartLine();
self::generateHTMLBlock($value, $name ?? null);
self::generateHTMLBlock($val, self::$blockTitle);
self::generateEndLine();
self::generateJSBlock();
}
}
}
public static function addShutdownInfo(array $exData = []) : void {
register_shutdown_function(function() use ($exData) {
@@ -136,13 +139,14 @@ class Dumper {
$info[] = "Выделено памяти в пике: ".round((memory_get_peak_usage()),2)." байт.";
$exData['info'] = $info;
if(error_get_last()) $exData['errors'] = error_get_last();
self::dump($exData, "Dump info");
self::$blockTitle = "Dump info";
self::dump([$exData]);
});
}
public static function vdd(mixed $exData) : void {
register_shutdown_function(function() use ($exData) {
self::dump($exData);
public static function vdd(array $value) : void {
register_shutdown_function(function() use ($value) {
self::dump($value);
});
exit;
}

View File

@@ -20,8 +20,9 @@ if (!function_exists('vdd')) {
* @param mixed $value
* @return void
*/
function vdd(mixed $value): void {
function vdd(mixed ...$value): void {
Dumper::vdd($value);
exit;
}
}
@@ -30,7 +31,7 @@ if (!function_exists('vd')) {
* @param mixed $value
* @return void
*/
function vd(mixed $value): void {
function vd(mixed ...$value): void {
Dumper::dump($value);
}
}