Development

/branches/1.3/lib/debug/sfTimerManager.class.php

You must first sign up to be able to contribute.

root/branches/1.3/lib/debug/sfTimerManager.class.php

Revision 13339, 1.3 kB (checked in by fabien, 6 years ago)

[1.1, 1.2] reverted r12807 (closes #4287)

  • Property svn:mime-type set to text/x-php
  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
Line 
1 <?php
2
3 /*
4  * This file is part of the symfony package.
5  * (c) 2004-2006 Fabien Potencier <fabien.potencier@symfony-project.com>
6  *
7  * For the full copyright and license information, please view the LICENSE
8  * file that was distributed with this source code.
9  */
10
11 /**
12  * sfTimerManager is a container for sfTimer objects.
13  *
14  * @package    symfony
15  * @subpackage util
16  * @author     Fabien Potencier <fabien.potencier@symfony-project.com>
17  * @version    SVN: $Id$
18  */
19 class sfTimerManager
20 {
21   static public $timers = array();
22
23   /**
24    * Gets a sfTimer instance.
25    *
26    * It returns the timer named $name or create a new one if it does not exist.
27    *
28    * @param string $name The name of the timer
29    *
30    * @return sfTimer The timer instance
31    */
32   public static function getTimer($name)
33   {
34     if (!isset(self::$timers[$name]))
35     {
36       self::$timers[$name] = new sfTimer($name);
37     }
38
39     self::$timers[$name]->startTimer();
40
41     return self::$timers[$name];
42   }
43
44   /**
45    * Gets all sfTimer instances stored in sfTimerManager.
46    *
47    * @return array An array of all sfTimer instances
48    */
49   public static function getTimers()
50   {
51     return self::$timers;
52   }
53
54   /**
55    * Clears all sfTimer instances stored in sfTimerManager.
56    */
57   public static function clearTimers()
58   {
59     self::$timers = array();
60   }
61 }
62
Note: See TracBrowser for help on using the browser.