You are here

public function VarDumperDebug::getDebug in VarDumper 7

Same name and namespace in other branches
  1. 8 src/VarDumper/VarDumperDebug.php \Drupal\vardumper\VarDumper\VarDumperDebug::getDebug()
3 calls to VarDumperDebug::getDebug()
VarDumperBlock::dump in modules/vardumper_block/src/VarDumper/VarDumperBlock.php
VarDumperMessage::dump in src/VarDumper/VarDumperMessage.php
VarDumperWatchdog::dump in modules/vardumper_watchdog/src/VarDumper/VarDumperWatchdog.php

File

src/VarDumper/VarDumperDebug.php, line 50
Contains Drupal\vardumper\VarDumper\VarDumperDebug.

Class

VarDumperDebug

Namespace

Drupal\vardumper\VarDumper

Code

public function getDebug($var) {
  $memory = fopen('php://memory', 'r+b');
  $cloner = new VarCloner();
  $dumper = 'cli' === PHP_SAPI ? new CliDumper() : new HtmlDrupalDumper();
  $dumper
    ->dump($cloner
    ->cloneVar($var), $memory);
  return stream_get_contents($memory, -1, 0);
}