コード例 #1
0
ファイル: profiler.php プロジェクト: roadrunner/php-profiler
 /**
  * End a step
  *
  * End a step by name, or end all steps in the current tree.
  *
  * @param string $nodeName ends the first-found step with this name. (Note: a warning is generated if it's not the current step, because this is probably unintentional!)
  * @param bool $nuke denotes whether you are intentionally attempting to terminate the entire step-stack.  If true, the warning mentioned is not generated.
  *
  * @return bool|ProfilerNode|ProfilerGhostNode returns null if you ended the top-level step node, or the parent to the ended node, or a ghost node if the profiler is disabled.
  */
 public static function end($nodeName, $nuke = false)
 {
     if (!self::isEnabled()) {
         return self::$ghostNode;
     }
     if (self::$currentNode == null) {
         return;
     }
     while (self::$currentNode && self::$currentNode->getName() != $nodeName) {
         if (!$nuke) {
             trigger_error("Ending profile node '" . self::$currentNode->getName() . "' out of order (Requested end: '{$nodeName}')", E_USER_WARNING);
         }
         self::$currentNode = self::$currentNode->end(self::$profilerKey);
         self::$depthCount--;
     }
     if (self::$currentNode && self::$currentNode->getName() == $nodeName) {
         self::$currentNode = self::$currentNode->end(self::$profilerKey);
         self::$depthCount--;
     }
     return self::$currentNode;
 }