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


PHP Dumper::objectRecursionProtection方法代码示例

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


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

示例1: dump

 /**
  * Dump information about a variable
  *
  * @param mixed $data,...
  * @access public
  * @static
  */
 public static function dump($data, $capture = false)
 {
     // If we're capturing call dump() with just data and capture the output
     if ($capture === DUMPER_CAPTURE) {
         ob_start();
         Dumper::dump($data);
         $str = ob_get_clean();
         return $str;
     }
     $clearObjectRecursionProtection = false;
     if (self::$objectRecursionProtection === NULL) {
         self::$objectRecursionProtection = array();
         $clearObjectRecursionProtection = true;
     }
     // disabled
     if (!Dumper::_debug()) {
         return false;
     }
     // more arguments
     if (func_num_args() > 1) {
         $_ = func_get_args();
         foreach ($_ as $d) {
             Dumper::dump($d);
         }
         return;
     }
     // find caller
     $_ = debug_backtrace();
     while ($d = array_pop($_)) {
         $callback = self::$lineNumberTestCallback;
         $function = strToLower($d['function']);
         if (in_array($function, array("krumo", "k", "kd")) || strToLower(@$d['class']) == 'krumo' || is_callable($callback) && $callback($d)) {
             break;
         }
     }
     $showVersion = Dumper::_config('display', 'show_version', TRUE);
     $showCallInfo = Dumper::_config('display', 'show_call_info', TRUE);
     $krumoUrl = 'https://github.com/oodle/krumo';
     //////////////////////
     // Start HTML header//
     //////////////////////
     print "<div class=\"dumper-root\">\n";
     print "\t<ul class=\"dumper-node dumper-first\">\n";
     // The actual item itself
     print Dumper::_dump($data);
     if ($showVersion || $showCallInfo) {
         print "\t\t<li class=\"dumper-footnote\" onDblClick=\"toggle_expand_all();\">\n";
         if ($showCallInfo && isset($d['file']) && $d['file']) {
             print "<span class=\"dumper-call\" style=\"white-space:nowrap;\">";
             print "Called from <strong><code>" . $d['file'] . "</code></strong>, ";
             print "line <strong><code>" . $d['line'] . "</code></strong></span>";
         }
         if ($showVersion) {
             $version = Dumper::version();
             print "<span class=\"dumper-version\" style=\"white-space:nowrap;\">\n";
             print "<strong class=\"dumper-version-number\">Krumo version {$version}</strong> | <a href=\"{$krumoUrl}\" target=\"_blank\">{$krumoUrl}</a>\n";
             print "</span>\n";
         }
         print "</li>";
     }
     print "</ul></div>\n";
     print "<!-- Dumper - HTML -->\n\n";
     // Output the CSS and JavaScript AFTER the HTML
     Dumper::_css();
     ////////////////////
     // End HTML header//
     ////////////////////
     // flee the hive
     $_recursion_marker = Dumper::_marker();
     if ($hive =& Dumper::_hive($dummy)) {
         foreach ($hive as $i => $bee) {
             if (is_object($bee)) {
                 if (($hash = spl_object_hash($bee)) && isset(self::$objectRecursionProtection[$hash])) {
                     unset(self::$objectRecursionProtection[$hash]);
                 }
             } elseif (isset($hive[$i]->{$_recursion_marker})) {
                 unset($hive[$i][$_recursion_marker]);
             }
         }
     }
     if ($clearObjectRecursionProtection) {
         self::$objectRecursionProtection = NULL;
     }
     // End of dump()
 }
开发者ID:aleksabp,项目名称:bolt,代码行数:92,代码来源:class.dumper.php


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