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


PHP CliDumper::setColors方法代码示例

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


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

示例1: getVarDumperDump

 private function getVarDumperDump($data)
 {
     $h = fopen('php://memory', 'r+b');
     $cloner = new VarCloner();
     $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:EnmanuelCode,项目名称:backend-laravel,代码行数:11,代码来源:VarDumperTestCase.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: __destruct

 public function __destruct()
 {
     if (0 === $this->clonesCount-- && !$this->isCollected && $this->data) {
         $this->clonesCount = 0;
         $this->isCollected = true;
         $h = headers_list();
         $i = count($h);
         array_unshift($h, 'Content-Type: ' . ini_get('default_mimetype'));
         while (0 !== stripos($h[$i], 'Content-Type:')) {
             --$i;
         }
         if ('cli' !== PHP_SAPI && stripos($h[$i], 'html')) {
             $dumper = new HtmlDumper('php://output', $this->charset);
         } else {
             $dumper = new CliDumper('php://output', $this->charset);
             $dumper->setColors(false);
         }
         foreach ($this->data as $i => $dump) {
             $this->data[$i] = null;
             if ($dumper instanceof HtmlDumper) {
                 $dump['name'] = $this->htmlEncode($dump['name']);
                 $dump['file'] = $this->htmlEncode($dump['file']);
                 if ('' !== $dump['file']) {
                     if ($this->fileLinkFormat) {
                         $link = strtr($this->fileLinkFormat, array('%f' => $dump['file'], '%l' => $dump['line']));
                         $dump['name'] = sprintf('<a href="%s" title="%s">%s</a>', $link, $dump['file'], $dump['name']);
                     } else {
                         $dump['name'] = sprintf('<abbr title="%s">%s</abbr>', $dump['file'], $dump['name']);
                     }
                 }
                 echo "\n<span class=\"sf-dump-meta\">{$dump['name']} on line {$dump['line']}:</span>";
             } else {
                 echo "{$dump['name']} on line {$dump['line']}:\n";
             }
             $dumper->dump($dump['data']);
         }
         $this->data = array();
         $this->dataCount = 0;
     }
 }
开发者ID:vadim2404,项目名称:symfony,代码行数:40,代码来源:DumpDataCollector.php

示例5: testBuggyRefs

    /**
     * @runInSeparateProcess
     * @preserveGlobalState disabled
     */
    public function testBuggyRefs()
    {
        if (PHP_VERSION_ID >= 50600) {
            $this->markTestSkipped('PHP 5.6 fixed refs counting');
        }
        $var = $this->getSpecialVars();
        $var = $var[0];
        $dumper = new CliDumper();
        $dumper->setColors(false);
        $cloner = new VarCloner();
        $data = $cloner->cloneVar($var)->withMaxDepth(3);
        $out = '';
        $dumper->dump($data, function ($line, $depth) use(&$out) {
            if ($depth >= 0) {
                $out .= str_repeat('  ', $depth) . $line . "\n";
            }
        });
        $this->assertSame(<<<EOTXT
array:1 [
  0 => array:1 [
    0 => array:1 [
      0 => array:1 [ …1]
    ]
  ]
]

EOTXT
, $out);
    }
开发者ID:kadvani1,项目名称:symfony,代码行数:33,代码来源:CliDumperTest.php

示例6: assertDumpEquals

 private function assertDumpEquals($dump, $data, $message = '')
 {
     $dumper = new CliDumper();
     $dumper->setColors(false);
     $this->assertSame(rtrim($dump), rtrim($dumper->dump($data, true)), $message);
 }
开发者ID:yceruto,项目名称:symfony,代码行数:6,代码来源:DataCollectorTest.php

示例7: dumpVar

 /**
  * Returns a string representation of the variable.
  *
  * Symfony VarDumper is used if installed, else print_r is used.
  *
  * @param mixed $var
  *
  * @return string
  */
 protected function dumpVar($var)
 {
     if (!class_exists('\\Symfony\\Component\\VarDumper\\VarDumper')) {
         return print_r($var, true);
     }
     $data = $this->getCloner()->cloneVar($var);
     $res = fopen('php://temp', 'r+');
     $dumper = new CliDumper($res);
     $dumper->setColors($this->output->isDecorated());
     $dumper->dump($data);
     $str = stream_get_contents($res, -1, 0);
     fclose($res);
     return $str;
 }
开发者ID:gmo,项目名称:beanstalk,代码行数:23,代码来源:AbstractCommand.php

示例8: testGet

    public function testGet()
    {
        require __DIR__ . '/Fixtures/dumb-var.php';
        $dumper = new CliDumper('php://output');
        $dumper->setColors(false);
        $cloner = new VarCloner();
        $cloner->addCasters(array(':stream' => function ($res, $a) {
            unset($a['uri']);
            return $a;
        }));
        $data = $cloner->cloneVar($var);
        ob_start();
        $dumper->dump($data);
        $out = ob_get_clean();
        $closureLabel = PHP_VERSION_ID >= 50400 ? 'public method' : 'function';
        $out = preg_replace('/[ \\t]+$/m', '', $out);
        $intMax = PHP_INT_MAX;
        $res1 = (int) $var['res'];
        $res2 = (int) $var[8];
        $this->assertStringMatchesFormat(<<<EOTXT
array:25 [
  "number" => 1
  0 => &1 null
  "const" => 1.1
  1 => true
  2 => false
  3 => NAN
  4 => INF
  5 => -INF
  6 => {$intMax}
  "str" => "déjà"
  7 => b"é@"
  "[]" => []
  "res" => :stream {@{$res1}
    wrapper_type: "plainfile"
    stream_type: "STDIO"
    mode: "r"
    unread_bytes: 0
    seekable: true
    timed_out: false
    blocked: true
    eof: false
    options: []
  }
  8 => :Unknown {@{$res2}}
  "obj" => Symfony\\Component\\VarDumper\\Tests\\Fixture\\DumbFoo {#%d
    +foo: "foo"
    +"bar": "bar"
  }
  "closure" => Closure {#%d
    reflection: """
      Closure [ <user> {$closureLabel} Symfony\\Component\\VarDumper\\Tests\\Fixture\\{closure} ] {
        @@ {$var['file']} {$var['line']} - {$var['line']}

        - Parameters [2] {
          Parameter #0 [ <required> \$a ]
          Parameter #1 [ <optional> PDO or NULL &\$b = NULL ]
        }
      }
      """
  }
  "line" => {$var['line']}
  "nobj" => array:1 [
    0 => &3 {#%d}
  ]
  "recurs" => &4 array:1 [
    0 => &4 array:1 [&4]
  ]
  9 => &1 null
  "sobj" => Symfony\\Component\\VarDumper\\Tests\\Fixture\\DumbFoo {#%d}
  "snobj" => &3 {#%d}
  "snobj2" => {#%d}
  "file" => "{$var['file']}"
  b"bin-key-é" => ""
]

EOTXT
, $out);
    }
开发者ID:hilmysyarif,项目名称:phpv8,代码行数:79,代码来源:CliDumperTest.php


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