class VarDumper
Same name in other branches
- 5.x src/Plugin/Devel/Dumper/VarDumper.php \Drupal\devel\Plugin\Devel\Dumper\VarDumper
Provides a Symfony VarDumper dumper plugin.
Plugin annotation
@DevelDumper(
id = "var_dumper",
label = @Translation("Symfony var-dumper"),
description = @Translation("Wrapper for <a href='https://github.com/symfony/var-dumper'>Symfony var-dumper</a> debugging tool."),
)
Hierarchy
- class \Drupal\Component\Plugin\PluginBase implements \Drupal\Component\Plugin\PluginInspectionInterface, \Drupal\Component\Plugin\DerivativeInspectionInterface
- class \Drupal\Core\Plugin\PluginBase extends \Drupal\Component\Plugin\PluginBase uses \Drupal\Core\StringTranslation\StringTranslationTrait, \Drupal\Core\DependencyInjection\DependencySerializationTrait, \Drupal\Core\Messenger\MessengerTrait
- class \Drupal\devel\DevelDumperBase extends \Drupal\Core\Plugin\PluginBase implements \Drupal\devel\DevelDumperInterface
- class \Drupal\devel\Plugin\Devel\Dumper\VarDumper extends \Drupal\devel\DevelDumperBase
- class \Drupal\devel\DevelDumperBase extends \Drupal\Core\Plugin\PluginBase implements \Drupal\devel\DevelDumperInterface
- class \Drupal\Core\Plugin\PluginBase extends \Drupal\Component\Plugin\PluginBase uses \Drupal\Core\StringTranslation\StringTranslationTrait, \Drupal\Core\DependencyInjection\DependencySerializationTrait, \Drupal\Core\Messenger\MessengerTrait
Expanded class hierarchy of VarDumper
File
-
src/
Plugin/ Devel/ Dumper/ VarDumper.php, line 19
Namespace
Drupal\devel\Plugin\Devel\DumperView source
class VarDumper extends DevelDumperBase {
/**
* {@inheritdoc}
*/
public function export($input, $name = NULL) {
$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) {
$output = $name . ' => ' . $output;
}
return $this->setSafeMarkup($output);
}
/**
* {@inheritdoc}
*/
public static function checkRequirements() {
return class_exists('Symfony\\Component\\VarDumper\\Cloner\\VarCloner', TRUE);
}
}
Members
Title Sort descending | Modifiers | Object type | Summary | Overriden Title | Overrides |
---|---|---|---|---|---|
DevelDumperBase::dump | public | function | Dumps information about a variable. | Overrides DevelDumperInterface::dump | 2 |
DevelDumperBase::exportAsRenderable | public | function | Returns a string representation of a variable wrapped in a render array. | Overrides DevelDumperInterface::exportAsRenderable | 2 |
DevelDumperBase::getInternalFunctions | protected | function | Returns a list of internal functions. | 1 | |
DevelDumperBase::setSafeMarkup | protected | function | Wrapper for \Drupal\Core\Render\Markup::create(). | ||
VarDumper::checkRequirements | public static | function | Checks if requirements for this plugin are satisfied. | Overrides DevelDumperInterface::checkRequirements | |
VarDumper::export | public | function | Returns a string representation of a variable. | Overrides DevelDumperInterface::export |