class VarDumperDebug in VarDumper 8
Same name and namespace in other branches
- 7 src/VarDumper/VarDumperDebug.php \Drupal\vardumper\VarDumper\VarDumperDebug
Hierarchy
- class \Drupal\vardumper\VarDumper\VarDumperDebug
Expanded class hierarchy of VarDumperDebug
3 files declare their use of VarDumperDebug
- VarDumperBlock.php in modules/
vardumper_block/ src/ VarDumper/ VarDumperBlock.php - VarDumperConsole.php in modules/
vardumper_console/ src/ VarDumper/ VarDumperConsole.php - VarDumperWatchdog.php in modules/
vardumper_watchdog/ src/ VarDumper/ VarDumperWatchdog.php
File
- src/
VarDumper/ VarDumperDebug.php, line 9
Namespace
Drupal\vardumper\VarDumperView source
class VarDumperDebug {
protected $header1 = '<em>Dump called from <strong>%s</strong>, line <strong>%d</strong> at <strong>%s</strong>.</em>';
protected $header2 = '<em><strong>%s</strong> :: Dump called from <strong>%s</strong>, line <strong>%d</strong> at <strong>%s</strong>.</em>';
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);
}
public function getDebugInformation() {
$_ = array_reverse(debug_backtrace());
while ($d = array_pop($_)) {
if (mb_strpos($d['file'], 'src/VarDumper') === FALSE && mb_strpos($d['file'], 'vardumper') === FALSE) {
break;
}
}
return $d;
}
public function getHeaders($name, $d) {
$time = explode(' ', microtime());
$time = date('H:i:s') . '.' . round($time[0], 4) * 10000;
$result = sprintf($this->header1, $d['file'], $d['line'], $time);
if (!empty($name)) {
$result = sprintf($this->header2, $name, $d['file'], $d['line'], $time);
}
return $result;
}
public function hasPermission() {
return \Drupal::currentUser()
->hasPermission('access vardumper information');
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
VarDumperDebug:: |
protected | property | ||
VarDumperDebug:: |
protected | property | ||
VarDumperDebug:: |
public | function | ||
VarDumperDebug:: |
public | function | ||
VarDumperDebug:: |
public | function | ||
VarDumperDebug:: |
public | function |