4 * Smarty Method GetRegisteredObject
6 * Smarty::getRegisteredObject() method
9 * @subpackage PluginsInternal
12 class Smarty_Internal_Method_GetRegisteredObject
15 * Valid for Smarty and template object
22 * return a reference to a registered object
24 * @api Smarty::getRegisteredObject()
25 * @link http://www.smarty.net/docs/en/api.get.registered.object.tpl
27 * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
28 * @param string $object_name object name
31 * @throws \SmartyException if no such object is found
33 public function getRegisteredObject(Smarty_Internal_TemplateBase $obj, $object_name)
35 $smarty = $obj->_getSmartyObj();
36 if (!isset($smarty->registered_objects[ $object_name ])) {
37 throw new SmartyException("'$object_name' is not a registered object");
39 if (!is_object($smarty->registered_objects[ $object_name ][ 0 ])) {
40 throw new SmartyException("registered '$object_name' is not an object");
42 return $smarty->registered_objects[ $object_name ][ 0 ];