You are here

public function Kint::export in Devel 8

Same name and namespace in other branches
  1. 8.2 kint/src/Plugin/Devel/Dumper/Kint.php \Drupal\kint\Plugin\Devel\Dumper\Kint::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

File

kint/src/Plugin/Devel/Dumper/Kint.php, line 30

Class

Kint
Provides a Kint dumper plugin.

Namespace

Drupal\kint\Plugin\Devel\Dumper

Code

public function export($input, $name = NULL) {
  ob_start();
  \Kint::dump($input);
  $dump = ob_get_clean();

  // Kint does't allow to assign a title to the dump. Workaround to use the
  // passed in name as dump title.
  if ($name) {
    $dump = preg_replace('/\\$input/', $name, $dump, 1);
  }
  return $this
    ->setSafeMarkup($dump);
}