예제 #1
0
 /**
  * Start a new step
  *
  * This is the most-called method of the profiler.  It initializes and returns a new step node.
  *
  * @param string $nodeName name/identifier for your step. is used later in the output to identify this step
  *
  * @return ProfilerNode|ProfilerGhostNode returns an instance of a {@link ProfilerNode} if the profiler is enabled, or a {@link ProfilerGhostNode} if it's disabled
  */
 public static function start($nodeName)
 {
     if (!self::isEnabled()) {
         return self::$ghostNode;
     }
     $newNode = new ProfilerNode($nodeName, ++self::$depthCount, self::$currentNode, self::$profilerKey);
     if (self::$currentNode) {
         self::$currentNode->addChild($newNode);
     } else {
         self::$topNodes[] = $newNode;
     }
     self::$currentNode = $newNode;
     return self::$currentNode;
 }