From a112c1b4a76bd61513e2d7bca2f81b31a23ba27c Mon Sep 17 00:00:00 2001 From: Pierre Clavequin Date: Mon, 29 Apr 2024 22:07:00 +0800 Subject: [PATCH] feat: jd function to dump in json api call --- .../VarDumper/Resources/functions/dump.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/Symfony/Component/VarDumper/Resources/functions/dump.php b/src/Symfony/Component/VarDumper/Resources/functions/dump.php index e6ade0dfaed38..1b162c1a955d6 100644 --- a/src/Symfony/Component/VarDumper/Resources/functions/dump.php +++ b/src/Symfony/Component/VarDumper/Resources/functions/dump.php @@ -66,3 +66,22 @@ function dd(mixed ...$vars): never exit(1); } } + +if (!function_exists('jd')) { + function jd(mixed ...$vars): never + { + if (!\in_array(\PHP_SAPI, ['cli', 'phpdbg', 'embed'], true) && !headers_sent()) { + header('HTTP/1.1 500 Internal Server Error'); + } + + if (array_key_exists(0, $vars) && 1 === count($vars)) { + var_dump($vars[0]); + } else { + foreach ($vars as $var) { + var_dump($var); + } + } + + exit(1); + } +} pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy