本文整理匯總了PHP中Symfony\Component\VarDumper\Dumper\HtmlDumper::setDisplayOptions方法的典型用法代碼示例。如果您正苦於以下問題:PHP HtmlDumper::setDisplayOptions方法的具體用法?PHP HtmlDumper::setDisplayOptions怎麽用?PHP HtmlDumper::setDisplayOptions使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Symfony\Component\VarDumper\Dumper\HtmlDumper
的用法示例。
在下文中一共展示了HtmlDumper::setDisplayOptions方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testLinkStub
public function testLinkStub()
{
$var = array(new LinkStub(__CLASS__, 0, __FILE__));
$cloner = new VarCloner();
$dumper = new HtmlDumper();
$dumper->setDumpHeader('<foo></foo>');
$dumper->setDumpBoundaries('<bar>', '</bar>');
$dumper->setDisplayOptions(array('fileLinkFormat' => '%f:%l'));
$dump = $dumper->dump($cloner->cloneVar($var), true);
$expectedDump = <<<'EODUMP'
<foo></foo><bar><span class=sf-dump-note>array:1</span> [<samp>
<span class=sf-dump-index>0</span> => "<a href="%sStubCasterTest.php:0"><span class=sf-dump-str title="55 characters">Symfony\Component\VarDumper\Tests\Caster\StubCasterTest</span></a>"
</samp>]
</bar>
EODUMP;
$this->assertStringMatchesFormat($expectedDump, $dump);
}
示例2: getDumps
public function getDumps($format, $maxDepthLimit = -1, $maxItemsPerDepth = -1)
{
$data = fopen('php://memory', 'r+b');
if ('html' === $format) {
$dumper = new HtmlDumper($data, $this->charset);
$dumper->setDisplayOptions(array('fileLinkFormat' => $this->fileLinkFormat));
} else {
throw new \InvalidArgumentException(sprintf('Invalid dump format: %s', $format));
}
$dumps = array();
foreach ($this->data as $dump) {
$dumper->dump($dump['data']->withMaxDepth($maxDepthLimit)->withMaxItemsPerDepth($maxItemsPerDepth));
$dump['data'] = stream_get_contents($data, -1, 0);
ftruncate($data, 0);
rewind($data);
$dumps[] = $dump;
}
return $dumps;
}