/** * Class Dumper */ classDumper { /** * Dump a value with elegance. * * @param mixed $value * @return void */ publicfunctiondump($value) { if (class_exists(CliDumper::class)) { $dumper = 'cli' === PHP_SAPI ? new CliDumper : new HtmlDumper; $dumper->dump((new VarCloner)->cloneVar($value)); } else { var_dump($value); } } }
if (! function_exists('dd')) { /** * Dump the passed variables and end the script. * * @param mixed * @return void */ functiondd(...$args) { foreach ($args as $x) { (new Dumper)->dump($x); } die(1); } }
if (! function_exists('dda')) { /** * Dump the passed array variables and end the script. * * @param mixed * @return void */ functiondda(...$args) { foreach ($args as $x) { (new Dumper)->dump($x->toArray()); } die(1); } }