diff --git a/Resources/functions/dump.php b/Resources/functions/dump.php index f2ff74c..d39af21 100644 --- a/Resources/functions/dump.php +++ b/Resources/functions/dump.php @@ -60,3 +60,22 @@ function dd(mixed ...$vars): never exit(1); } } + +if(!function_exists('dd_if')){ + function dd_if($condition,... $vars): mixed + { + if(!$condition){ + return null; + } + + if (array_key_exists(0, $vars) && 1 === count($vars)) { + VarDumper::dump($vars[0]); + } else { + foreach ($vars as $k => $v) { + VarDumper::dump($v, is_int($k) ? 1 + $k : $k); + } + } + + exit(1); + } +} \ No newline at end of file