setDisplayOptions() public méthode

Configures display options.
public setDisplayOptions ( array $displayOptions )
$displayOptions array A map of display options to customize the behavior
Exemple #1
0
    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);
    }
 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;
 }