/**
  * Format the given value into a human readable string.
  *
  * @param  mixed $value
  * @return string
  */
 public function dump($value)
 {
     $dumper = $this->getDumper();
     if ($dumper) {
         // re-use the same DumpOutput instance, so it won't re-render the global styles/scripts on each dump.
         // exclude verbose information (e.g. exception stack traces)
         $dumper->dump($this->getCloner()->cloneVar($value, Caster::EXCLUDE_VERBOSE), $this->htmlDumperOutput);
         $output = $this->htmlDumperOutput->getOutput();
         $this->htmlDumperOutput->clear();
         return $output;
     }
     return print_r($value, true);
 }
예제 #2
0
 /**
  * Format the given value into a human readable string.
  *
  * @param  mixed $value
  * @return string
  */
 public function dump($value)
 {
     $dumper = $this->getDumper();
     if ($dumper) {
         // re-use the same DumpOutput instance, so it won't re-render the global styles/scripts on each dump.
         // exclude verbose information (e.g. exception stack traces)
         if (class_exists('Symfony\\Component\\VarDumper\\Caster\\Caster')) {
             $cloneVar = $this->getCloner()->cloneVar($value, Caster::EXCLUDE_VERBOSE);
             // Symfony VarDumper 2.6 Caster class dont exist.
         } else {
             $cloneVar = $this->getCloner()->cloneVar($value);
         }
         $dumper->dump($cloneVar, $this->htmlDumperOutput);
         $output = $this->htmlDumperOutput->getOutput();
         $this->htmlDumperOutput->clear();
         return $output;
     }
     return print_r($value, true);
 }