當前位置: 首頁>>代碼示例>>PHP>>正文


PHP HtmlDumper::setStyles方法代碼示例

本文整理匯總了PHP中Symfony\Component\VarDumper\Dumper\HtmlDumper::setStyles方法的典型用法代碼示例。如果您正苦於以下問題:PHP HtmlDumper::setStyles方法的具體用法?PHP HtmlDumper::setStyles怎麽用?PHP HtmlDumper::setStyles使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Symfony\Component\VarDumper\Dumper\HtmlDumper的用法示例。


在下文中一共展示了HtmlDumper::setStyles方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getDumper

 private function getDumper()
 {
     if (!$this->htmlDumper && class_exists('Symfony\\Component\\VarDumper\\Cloner\\VarCloner')) {
         $this->htmlDumperOutput = new HtmlDumperOutput();
         // re-use the same var-dumper instance, so it won't re-render the global styles/scripts on each dump.
         $this->htmlDumper = new HtmlDumper($this->htmlDumperOutput);
         $styles = array('default' => 'color:#FFFFFF; line-height:normal; font:12px "Inconsolata", "Fira Mono", "Source Code Pro", Monaco, Consolas, "Lucida Console", monospace !important; word-wrap: break-word; white-space: pre-wrap; position:relative; z-index:99999; word-break: normal', 'num' => 'color:#BCD42A', 'const' => 'color: #4bb1b1;', 'str' => 'color:#BCD42A', 'note' => 'color:#ef7c61', 'ref' => 'color:#A0A0A0', 'public' => 'color:#FFFFFF', 'protected' => 'color:#FFFFFF', 'private' => 'color:#FFFFFF', 'meta' => 'color:#FFFFFF', 'key' => 'color:#BCD42A', 'index' => 'color:#ef7c61');
         $this->htmlDumper->setStyles($styles);
     }
     return $this->htmlDumper;
 }
開發者ID:lyrasoft,項目名稱:lyrasoft.github.io,代碼行數:11,代碼來源:TemplateHelper.php

示例2: dump

 /**
  * Format the given value into a human readable string.
  *
  * @param  mixed $value
  * @return string
  */
 public function dump($value)
 {
     if (class_exists('Symfony\\Component\\VarDumper\\Cloner\\VarCloner')) {
         static $dumper = null;
         // re-use the same var-dumper instance, so it won't re-render the global styles/scripts on each dump.
         if (!$dumper) {
             $dumper = new HtmlDumper();
             $styles = array('default' => '', 'num' => '', 'const' => '', 'str' => '', 'note' => '', 'ref' => '', 'public' => '', 'protected' => '', 'private' => '', 'meta' => '', 'key' => '', 'index' => '');
             $dumper->setStyles($styles);
         }
         $cloner = new VarCloner();
         return $dumper->dump($cloner->cloneVar($value));
     }
     return print_r($value, true);
 }
開發者ID:jeremycherfas,項目名稱:grav-blog,代碼行數:21,代碼來源:TemplateHelper.php


注:本文中的Symfony\Component\VarDumper\Dumper\HtmlDumper::setStyles方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。