You are here

public function DoctrineDebug::export in Devel 8.3

Same name and namespace in other branches
  1. 8 src/Plugin/Devel/Dumper/DoctrineDebug.php \Drupal\devel\Plugin\Devel\Dumper\DoctrineDebug::export()
  2. 8.2 src/Plugin/Devel/Dumper/DoctrineDebug.php \Drupal\devel\Plugin\Devel\Dumper\DoctrineDebug::export()
  3. 4.x src/Plugin/Devel/Dumper/DoctrineDebug.php \Drupal\devel\Plugin\Devel\Dumper\DoctrineDebug::export()

Returns a string representation of a variable.

Parameters

mixed $input: The variable to export.

string $name: (optional) The label to output before variable, defaults to NULL.

Return value

string String representation of a variable.

Overrides DevelDumperInterface::export

1 call to DoctrineDebug::export()
DoctrineDebug::exportAsRenderable in src/Plugin/Devel/Dumper/DoctrineDebug.php
Returns a string representation of a variable wrapped in a render array.

File

src/Plugin/Devel/Dumper/DoctrineDebug.php, line 23

Class

DoctrineDebug
Provides a DoctrineDebug dumper plugin.

Namespace

Drupal\devel\Plugin\Devel\Dumper

Code

public function export($input, $name = NULL) {
  $name = $name ? $name . ' => ' : '';
  $variable = Debug::export($input, 6);
  ob_start();
  print_r($variable);
  $dump = ob_get_contents();
  ob_end_clean();

  // Run Xss::filterAdmin on the resulting string to prevent
  // cross-site-scripting (XSS) vulnerabilities.
  $dump = Xss::filterAdmin($dump);
  $config = \Drupal::config('devel.settings');
  $debug_pre = $config
    ->get('debug_pre');
  $dump = ($debug_pre ? '<pre>' : '') . $name . $dump . ($debug_pre ? '</pre>' : '');
  return $this
    ->setSafeMarkup($dump);
}