Back to Pathway class

Method getInstance

public static \Joomla\CMS\Pathway\Pathway
getInstance
(mixed $client)
Returns a Pathway object
Parameters
  • string $client The name of the client
Returns
  • \Joomla\CMS\Pathway\Pathway A Pathway object.
Since
  • 1.5
Deprecated
  • 5.0
-
  • \RuntimeException
Class: Pathway
Project: Joomla

Method getInstance - Source code

/**
 * Returns a Pathway object
 *
 * @param   string  $client  The name of the client
 *
 * @return  Pathway  A Pathway object.
 *
 * @since       1.5
 * @throws      \RuntimeException
 * @deprecated  5.0 Get the instance from the application, eg. $application->getPathway()
 */
public static function getInstance($client)
{
    if (empty(self::$instances[$client])) {
        // Create a Pathway object
        $name = ucfirst($client) . 'Pathway';
        if (!Factory::getContainer()->has($name)) {
            throw new \RuntimeException(Text::sprintf('JLIB_APPLICATION_ERROR_PATHWAY_LOAD', $client), 500);
        }
        self::$instances[$client] = Factory::getContainer()->get($name);
    }
    return self::$instances[$client];
}