本文整理汇总了PHP中Tracy\Dumper::toHtml方法的典型用法代码示例。如果您正苦于以下问题:PHP Dumper::toHtml方法的具体用法?PHP Dumper::toHtml怎么用?PHP Dumper::toHtml使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tracy\Dumper
的用法示例。
在下文中一共展示了Dumper::toHtml方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sdump
/**
* Dumps information about a variable in readable format.
*
* @param mixed $var to dump
* @param null $title
* @return void
*/
public static function sdump($var, $title = null)
{
if (!Debugger::$productionMode) {
self::initialize();
$trace = debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT);
$item = Helpers::findTrace($trace, 'sdump', $index) ?: Helpers::findTrace($trace, __CLASS__ . '::sdump', $index);
if (isset($item['file'], $item['line']) && is_file($item['file'])) {
$lines = file($item['file']);
preg_match('#sdump\\((.*)\\)#', $lines[$item['line'] - 1], $matches);
$params = isset($matches[1]) ? htmlspecialchars($matches[1]) : false;
if ($params) {
preg_match('#array\\((.*)\\)#', $params, $matches2);
$params = isset($matches2[1]) ? $matches2[1] : $params;
$params = explode(',', $params);
}
$dumpParams = isset($matches[0]) ? "{$matches['0']};" : '';
$location = Debugger::$showLocation ? "<br>" . Helpers::editorLink($item['file'], $item['line']) : false;
}
$tiMethod = $trace[$index + 1];
$dumpTitle = isset($tiMethod['class']) ? $tiMethod['class'] . $tiMethod['type'] . $tiMethod['function'] . '(); ' : $tiMethod['function'] . $title;
$dumpObject = self::$dumpObject && isset($tiMethod['object']) ? Dumper::toHtml($tiMethod['object']) : '';
$dump = (isset($dumpParams) ? "<b>{$dumpParams}</b> " : '') . (isset($location) ? $location : '') . $dumpObject;
if (self::$traceMode) {
for ($i = 0; $i <= $index; $i++) {
array_shift($trace);
}
$dump .= "<br/>" . self::showTraceSimple($trace);
}
$dump .= Dumper::toHtml($var);
self::$dumps = array('title' => $dumpTitle, 'dump' => $dump);
self::addToDumpPanel($dump, $dumpTitle);
}
}
示例2: getInfo
/**
* e.g. SQL explain
*
* @return NULL|Html|string
*/
public function getInfo()
{
$info = $this->response;
unset($info['hits']['hits']);
$html = Dumper::toHtml($info, [Dumper::COLLAPSE => TRUE, Dumper::TRUNCATE => 50]);
return Html::el()->setHtml($html);
}
示例3: renderHtml
private function renderHtml()
{
$res = '<style>code, pre {white-space:nowrap} a {text-decoration:none} pre {color:gray;display:inline} big {color:red}</style><code>';
foreach ($this->list as $item) {
$res .= Helpers::editorLink($item[0], $item[1]) . ' ' . str_replace(self::BOM, '<big>BOM</big>', Dumper::toHtml($item[2])) . "<br>\n";
}
return $res . '</code>';
}
示例4: render
/**
* @internal
* @param \Exception|NULL $e
* @return string[]|NULL
*/
public static function render(\Exception $e = NULL)
{
if (!$e instanceof \Nella\Tracy\DebugInfoException) {
return NULL;
// skip
}
return ['tab' => 'Exception Debug Info', 'panel' => \Tracy\Dumper::toHtml($e->__debugInfo())];
}
示例5: processQuery
/**
* @param array
* @return string
*/
protected function processQuery(array $query)
{
$s = '';
list($sql, $params, $time) = $query;
$s .= '<tr><td>' . sprintf('%0.3f', $time * 1000);
$s .= '</td><td class="nette-Doctrine2Panel-sql">' . Helpers::dumpSql($sql);
$s .= '</td><td>' . Dumper::toHtml($params) . '</tr>';
return $s;
}
示例6: getResult
/**
* @return Html|string
*/
public function getResult()
{
$data = iterator_to_array($this->result);
foreach ($data as &$row) {
$row = $this->rowToArray($row);
}
$html = Dumper::toHtml($data, [Dumper::COLLAPSE => TRUE]);
return Html::el()->setHtml($html);
}
示例7: initializePanel
public static function initializePanel(Nette\Application\Application $application)
{
Tracy\Debugger::getBlueScreen()->addPanel(function ($e) use ($application) {
return $e ? NULL : array(
'tab' => 'Nette Application',
'panel' => '<h3>Requests</h3>' . Tracy\Dumper::toHtml($application->getRequests())
. '<h3>Presenter</h3>' . Tracy\Dumper::toHtml($application->getPresenter()),
);
});
}
示例8: getPanel
/**
* @return string
*/
public function getPanel()
{
if (empty($this->evaluatedFeatures)) {
return NULL;
}
$evaluatedFeatures = $this->evaluatedFeatures;
$click = class_exists('\\Tracy\\Dumper') ? function ($o, $c = TRUE, $d = 4) {
return \Tracy\Dumper::toHtml($o, array('collapse' => $c, 'depth' => $d));
} : callback('\\Tracy\\Helpers::clickableDump');
ob_start();
require __DIR__ . '/panel.phtml';
return ob_get_clean();
}
示例9: getPanel
/**
* Renders HTML code for custom panel.
* @return string
*/
function getPanel()
{
if (!$this->messages) {
return NULL;
}
ob_start();
$esc = callback('Nette\\Templating\\Helpers::escapeHtml');
$click = class_exists('\\Tracy\\Dumper') ? function ($o, $c = FALSE) {
return \Tracy\Dumper::toHtml($o, array('collapse' => $c));
} : callback('\\Tracy\\Helpers::clickableDump');
require __DIR__ . '/panel.phtml';
return ob_get_clean();
}
示例10: renderHtml
private function renderHtml()
{
$res = '<style>code, pre {white-space:nowrap} a {text-decoration:none} pre {color:gray;display:inline} big {color:red}</style><code>';
foreach ($this->list as $item) {
$stack = array();
foreach (array_slice($item[3], 1) as $t) {
$t += array('class' => '', 'type' => '', 'function' => '');
$stack[] = "{$t['class']}{$t['type']}{$t['function']}()" . (isset($t['file'], $t['line']) ? ' in ' . basename($t['file']) . ":{$t['line']}" : '');
}
$res .= Helpers::editorLink($item[0], $item[1]) . ' ' . '<span title="' . htmlspecialchars(implode("\n", $stack), ENT_IGNORE | ENT_QUOTES, 'UTF-8') . '">' . str_replace(self::BOM, '<big>BOM</big>', Dumper::toHtml($item[2])) . "</span><br>\n";
}
return $res . '</code>';
}
示例11: getPanel
/**
* Renders HTML code for custom panel.
* @return string
*/
public function getPanel()
{
if (!$this->resources) {
return null;
}
$esc = \Nette\Utils\Callback::closure('Latte\\Runtime\\Filters::escapeHtml');
$click = function ($o, $c = false) {
return \Tracy\Dumper::toHtml($o, ['collapse' => $c]);
};
ob_start();
include __DIR__ . '/panel.phtml';
return ob_get_clean();
}
示例12: allResponses
/**
* @param \Kdyby\Curl\Response $response
*
* @return string
*/
public static function allResponses($response)
{
if (!$response instanceof Curl\Response) {
return NULL;
}
$click = function ($o, $c = TRUE) {
return Dumper::toHtml($o, array('collapse' => $c));
};
$responses = array($click($response, TRUE));
while ($response = $response->getPrevious()) {
$responses[] = $click($response, TRUE);
}
return implode('', $responses);
}
示例13: getPanel
/**
* @return string
*/
public function getPanel()
{
if (!$this->calls) {
return NULL;
}
ob_start();
$esc = array('Nette\\Templating\\Helpers', 'escapeHtml');
$click = class_exists('\\Tracy\\Dumper') ? function ($o, $c = FALSE) {
return \Tracy\Dumper::toHtml($o, array('collapse' => $c));
} : array('\\Tracy\\Helpers', 'clickableDump');
$totalTime = $this->totalTime ? sprintf('%0.3f', $this->totalTime * 1000) . ' ms' : 'none';
require __DIR__ . '/panel.phtml';
return ob_get_clean();
}
示例14: getPanel
/**
* @return string
*/
public function getPanel()
{
if (!$this->calls) {
return NULL;
}
ob_start();
$esc = function ($s) {
return htmlSpecialChars($s, ENT_QUOTES, 'UTF-8');
};
$click = class_exists('\\Tracy\\Dumper') ? function ($o, $c = FALSE) {
return \Tracy\Dumper::toHtml($o, array('collapse' => $c));
} : Callback::closure('\\Tracy\\Helpers::clickableDump');
$totalTime = $this->totalTime ? sprintf('%0.3f', $this->totalTime * 1000) . ' ms' : 'none';
require __DIR__ . '/panel.phtml';
return ob_get_clean();
}
示例15: getPanel
/**
* @return string
*/
public function getPanel()
{
if (!$this->calls) {
return NULL;
}
ob_start();
if (class_exists('Latte\\Runtime\\Filters')) {
$esc = Nette\Utils\Callback::closure('Latte\\Runtime\\Filters::escapeHtml');
} else {
$esc = 'Nette\\Templating\\Helpers::escapeHtml';
}
$click = class_exists('\\Tracy\\Dumper') ? function ($o, $c = FALSE) {
return \Tracy\Dumper::toHtml($o, array('collapse' => $c));
} : '\\Tracy\\Helpers::clickableDump';
$totalTime = $this->totalTime ? sprintf('%0.3f', $this->totalTime * 1000) . ' ms' : 'none';
require __DIR__ . '/panel.phtml';
return ob_get_clean();
}