当前位置: 首页>>代码示例>>PHP>>正文


PHP VarCloner::setMaxItems方法代码示例

本文整理汇总了PHP中Symfony\Component\VarDumper\Cloner\VarCloner::setMaxItems方法的典型用法代码示例。如果您正苦于以下问题:PHP VarCloner::setMaxItems方法的具体用法?PHP VarCloner::setMaxItems怎么用?PHP VarCloner::setMaxItems使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Symfony\Component\VarDumper\Cloner\VarCloner的用法示例。


在下文中一共展示了VarCloner::setMaxItems方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getVarDumperDump

 private function getVarDumperDump($data)
 {
     $h = fopen('php://memory', 'r+b');
     $cloner = new VarCloner();
     $cloner->setMaxItems(-1);
     $dumper = new CliDumper($h);
     $dumper->setColors(false);
     $dumper->dump($cloner->cloneVar($data)->withRefHandles(false));
     $data = stream_get_contents($h, -1, 0);
     fclose($h);
     return rtrim($data);
 }
开发者ID:ngitimfoyo,项目名称:Nyari-AppPHP,代码行数:12,代码来源:VarDumperTestTrait.php

示例2: getDump

 protected function getDump($data)
 {
     $flags = getenv('DUMP_LIGHT_ARRAY') ? CliDumper::DUMP_LIGHT_ARRAY : 0;
     $flags |= getenv('DUMP_STRING_LENGTH') ? CliDumper::DUMP_STRING_LENGTH : 0;
     $h = fopen('php://memory', 'r+b');
     $cloner = new VarCloner();
     $cloner->setMaxItems(-1);
     $dumper = new CliDumper($h, null, $flags);
     $dumper->setColors(false);
     $dumper->dump($cloner->cloneVar($data)->withRefHandles(false));
     $data = stream_get_contents($h, -1, 0);
     fclose($h);
     return rtrim($data);
 }
开发者ID:Ener-Getick,项目名称:symfony,代码行数:14,代码来源:VarDumperTestTrait.php

示例3: getDump

 protected function getDump($data, $key = null)
 {
     $flags = getenv('DUMP_LIGHT_ARRAY') ? CliDumper::DUMP_LIGHT_ARRAY : 0;
     $flags |= getenv('DUMP_STRING_LENGTH') ? CliDumper::DUMP_STRING_LENGTH : 0;
     $cloner = new VarCloner();
     $cloner->setMaxItems(-1);
     $dumper = new CliDumper(null, null, $flags);
     $dumper->setColors(false);
     $data = $cloner->cloneVar($data)->withRefHandles(false);
     if (null !== $key && null === ($data = $data->seek($key))) {
         return;
     }
     return rtrim($dumper->dump($data, true));
 }
开发者ID:ayoah,项目名称:symfony,代码行数:14,代码来源:VarDumperTestTrait.php

示例4: register

 public function register(Container $app)
 {
     $app['var_dumper.cloner'] = function ($app) {
         $cloner = new VarCloner();
         if (isset($app['debug.max_items'])) {
             $cloner->setMaxItems($app['debug.max_items']);
         }
         if (isset($app['debug.max_string_length'])) {
             $cloner->setMaxString($app['debug.max_string_length']);
         }
         return $cloner;
     };
     $app['data_collector.templates'] = $app->extend('data_collector.templates', function ($templates) {
         $templates[] = array('dump', '@Debug/Profiler/dump.html.twig');
         return $templates;
     });
     $app['data_collector.dump'] = function ($app) {
         return new DumpDataCollector($app['stopwatch'], $app['code.file_link_format']);
     };
     $app->extend('data_collectors', function ($collectors, $app) {
         $collectors['dump'] = function ($app) {
             return $app['data_collector.dump'];
         };
         return $collectors;
     });
     $app->extend('twig', function ($twig, $app) {
         if (class_exists('\\Symfony\\Bridge\\Twig\\Extension\\DumpExtension')) {
             $twig->addExtension(new DumpExtension($app['var_dumper.cloner']));
         }
         return $twig;
     });
     $app->extend('twig.loader.filesystem', function ($loader, $app) {
         $loader->addPath($app['debug.templates_path'], 'Debug');
         return $loader;
     });
     $app['debug.templates_path'] = function () {
         $r = new \ReflectionClass('Symfony\\Bundle\\DebugBundle\\DependencyInjection\\Configuration');
         return dirname(dirname($r->getFileName())) . '/Resources/views';
     };
 }
开发者ID:jeromemacias,项目名称:silex-debug,代码行数:40,代码来源:DebugServiceProvider.php

示例5: testHtmlDump

    public function testHtmlDump()
    {
        $e = $this->getTestException(1);
        ExceptionCaster::$srcContext = -1;
        $cloner = new VarCloner();
        $cloner->setMaxItems(1);
        $dumper = new HtmlDumper();
        $dumper->setDumpHeader('<foo></foo>');
        $dumper->setDumpBoundaries('<bar>', '</bar>');
        $dump = $dumper->dump($cloner->cloneVar($e)->withRefHandles(false), true);
        $expectedDump = <<<'EODUMP'
<foo></foo><bar><span class=sf-dump-note>Exception</span> {<samp>
  #<span class=sf-dump-protected title="Protected property">message</span>: "<span class=sf-dump-str title="3 characters">foo</span>"
  #<span class=sf-dump-protected title="Protected property">code</span>: <span class=sf-dump-num>0</span>
  #<span class=sf-dump-protected title="Protected property">file</span>: "<span class=sf-dump-str title="%sExceptionCasterTest.php
%d characters"><span class=sf-dump-ellipsis>%sTests</span>%eCaster%eExceptionCasterTest.php</span>"
  #<span class=sf-dump-protected title="Protected property">line</span>: <span class=sf-dump-num>25</span>
  -<span class=sf-dump-private title="Private property defined in class:&#10;`Exception`">trace</span>: {<samp>
    <span class=sf-dump-meta title="%sExceptionCasterTest.php
Stack level %d."><span class=sf-dump-ellipsis>%sVarDumper%eTests</span>%eCaster%eExceptionCasterTest.php</span>: <span class=sf-dump-num>25</span>
     &hellip;12
  </samp>}
</samp>}
</bar>
EODUMP;
        $this->assertStringMatchesFormat($expectedDump, $dump);
    }
开发者ID:ayoah,项目名称:symfony,代码行数:27,代码来源:ExceptionCasterTest.php


注:本文中的Symfony\Component\VarDumper\Cloner\VarCloner::setMaxItems方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。