You are here

public static function Debug::dump in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/doctrine/common/lib/Doctrine/Common/Util/Debug.php \Doctrine\Common\Util\Debug::dump()

Prints a dump of the public, protected and private properties of $var.

@link http://xdebug.org/

Parameters

mixed $var The variable to dump.:

integer $maxDepth The maximum nesting level for object properties.:

boolean $stripTags Whether output should strip HTML tags.:

boolean $echo Send the dumped value to the output buffer:

Return value

string

2 calls to Debug::dump()
DebugTest::testDisablesOutput in vendor/doctrine/common/tests/Doctrine/Tests/Common/Util/DebugTest.php
DebugTest::testReturnsOutput in vendor/doctrine/common/tests/Doctrine/Tests/Common/Util/DebugTest.php

File

vendor/doctrine/common/lib/Doctrine/Common/Util/Debug.php, line 55

Class

Debug
Static class containing most used debug methods.

Namespace

Doctrine\Common\Util

Code

public static function dump($var, $maxDepth = 2, $stripTags = true, $echo = true) {
  $html = ini_get('html_errors');
  if ($html !== true) {
    ini_set('html_errors', true);
  }
  if (extension_loaded('xdebug')) {
    ini_set('xdebug.var_display_max_depth', $maxDepth);
  }
  $var = self::export($var, $maxDepth++);
  ob_start();
  var_dump($var);
  $dump = ob_get_contents();
  ob_end_clean();
  $dumpText = $stripTags ? strip_tags(html_entity_decode($dump)) : $dump;
  ini_set('html_errors', $html);
  if ($echo) {
    echo $dumpText;
  }
  return $dumpText;
}