public static \Joomla\CMS\Categories\Categories|bool
getInstance
(mixed $extension, mixed $options = array())
/**
* Returns a reference to a Categories object
*
* @param string $extension Name of the categories extension
* @param array $options An array of options
*
* @return Categories|boolean Categories object on success, boolean false if an object does not exist
*
* @since 1.6
* @deprecated 5.0 Use the ComponentInterface to get the categories
*/
public static function getInstance($extension, $options = array())
{
$hash = md5(strtolower($extension) . serialize($options));
if (isset(self::$instances[$hash])) {
return self::$instances[$hash];
}
$categories = null;
try {
$parts = explode('.', $extension, 2);
$component = Factory::getApplication()->bootComponent($parts[0]);
if ($component instanceof CategoryServiceInterface) {
$categories = $component->getCategory($options, \count($parts) > 1 ? $parts[1] : '');
}
} catch (SectionNotFoundException $e) {
$categories = null;
}
self::$instances[$hash] = $categories;
return self::$instances[$hash];
}