Back to Authentication class

Method getInstance

public static \Joomla\CMS\Authentication\Authentication
getInstance
(string $pluginType = 'authentication')
Returns the global authentication object, only creating it if it doesn't already exist.
Parameters
  • string $pluginType The plugin type to run authorisation and authentication on
Returns
  • \Joomla\CMS\Authentication\Authentication The global Authentication object
Since
  • 1.7.0

Method getInstance - Source code

/**
 * Returns the global authentication object, only creating it
 * if it doesn't already exist.
 *
 * @param   string  $pluginType  The plugin type to run authorisation and authentication on
 *
 * @return  Authentication  The global Authentication object
 *
 * @since   1.7.0
 */
public static function getInstance(string $pluginType = 'authentication')
{
    if (empty(self::$instance[$pluginType])) {
        self::$instance[$pluginType] = new static($pluginType);
    }
    return self::$instance[$pluginType];
}