1. sfTimerManager.class.php
  2. /** * sfTimerManager is a container for sfTimer objects. * * @package symfony * @subpackage util * @author Fabien Potencier * @version SVN: $Id: sfTimerManager.class.php 13339 2008-11-25 14:58:05Z fabien $ */
  3. class sfTimerManager
  4. {
  5. static public $timers = array();
  6. /**
  7. * Gets a sfTimer instance.
  8. *
  9. * It returns the timer named $name or create a new one if it does not exist.
  10. *
  11. * @param string $name The name of the timer
  12. *
  13. * @return sfTimer The timer instance
  14. */
  15. public static function getTimer($name)
  16. {
  17. if (!isset(self::$timers[$name]))
  18. {
  19. self::$timers[$name] = new sfTimer($name);
  20. }
  21. self::$timers[$name]->startTimer();
  22. return self::$timers[$name];
  23. }
  24. /**
  25. * Gets all sfTimer instances stored in sfTimerManager.
  26. *
  27. * @return array An array of all sfTimer instances
  28. */
  29. public static function getTimers()
  30. {
  31. return self::$timers;
  32. }
  33. /**
  34. * Clears all sfTimer instances stored in sfTimerManager.
  35. */
  36. public static function clearTimers()
  37. {
  38. self::$timers = array();
  39. }
  40. }

Debug toolbar