Back to Profiler class

Method getInstance

public static \Joomla\CMS\Profiler\Profiler
getInstance
(mixed $prefix = '')
Returns the global Profiler object, only creating it if it doesn't already exist.
Parameters
  • string $prefix Prefix used to distinguish profiler objects.
Returns
  • \Joomla\CMS\Profiler\Profiler The Profiler object.
Since
  • 1.7.0
Class: Profiler
Project: Joomla

Method getInstance - Source code

/**
 * Returns the global Profiler object, only creating it
 * if it doesn't already exist.
 *
 * @param   string  $prefix  Prefix used to distinguish profiler objects.
 *
 * @return  Profiler  The Profiler object.
 *
 * @since   1.7.0
 */
public static function getInstance($prefix = '')
{
    if (empty(self::$instances[$prefix])) {
        self::$instances[$prefix] = new static($prefix);
    }
    return self::$instances[$prefix];
}