function VarDumper::export
Same name in other branches
- 4.x src/Plugin/Devel/Dumper/VarDumper.php \Drupal\devel\Plugin\Devel\Dumper\VarDumper::export()
Overrides DevelDumperInterface::export
File
-
src/
Plugin/ Devel/ Dumper/ VarDumper.php, line 25
Class
- VarDumper
- Provides a Symfony VarDumper dumper plugin.
Namespace
Drupal\devel\Plugin\Devel\DumperCode
public function export(mixed $input, ?string $name = NULL) : MarkupInterface|string {
$cloner = new VarCloner();
$dumper = 'cli' === PHP_SAPI ? new CliDumper() : new HtmlDumper();
$output = fopen('php://memory', 'r+b');
$dumper->dump($cloner->cloneVar($input), $output);
$output = stream_get_contents($output, -1, 0);
if ($name !== NULL && $name !== '') {
$output = $name . ' => ' . $output;
}
return $this->setSafeMarkup($output);
}