Dumper.php 574B

123456789101112131415161718192021222324252627
  1. <?php
  2. namespace Illuminate\Support\Debug;
  3. use Symfony\Component\VarDumper\Cloner\VarCloner;
  4. use Symfony\Component\VarDumper\Dumper\CliDumper;
  5. class Dumper
  6. {
  7. /**
  8. * Dump a value with elegance.
  9. *
  10. * @param mixed $value
  11. * @return void
  12. */
  13. public function dump($value)
  14. {
  15. if (class_exists(CliDumper::class)) {
  16. $dumper = in_array(PHP_SAPI, ['cli', 'phpdbg']) ? new CliDumper : new HtmlDumper;
  17. $dumper->dump((new VarCloner)->cloneVar($value));
  18. } else {
  19. var_dump($value);
  20. }
  21. }
  22. }