1<?php
2
3/**
4 * Smarty Method UnregisterCacheResource
5 *
6 * Smarty::unregisterCacheResource() method
7 *
8 * @package    Smarty
9 * @subpackage PluginsInternal
10 * @author     Uwe Tews
11 */
12class Smarty_Internal_Method_UnregisterCacheResource
13{
14    /**
15     * Valid for Smarty and template object
16     *
17     * @var int
18     */
19    public $objMap = 3;
20
21    /**
22     * Registers a resource to fetch a template
23     *
24     * @api  Smarty::unregisterCacheResource()
25     * @link http://www.smarty.net/docs/en/api.unregister.cacheresource.tpl
26     *
27     * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
28     * @param                                                                 $name
29     *
30     * @return \Smarty|\Smarty_Internal_Template
31     */
32    public function unregisterCacheResource(Smarty_Internal_TemplateBase $obj, $name)
33    {
34        $smarty = $obj->_getSmartyObj();
35        if (isset($smarty->registered_cache_resources[ $name ])) {
36            unset($smarty->registered_cache_resources[ $name ]);
37        }
38        return $obj;
39    }
40}
41