1<?php
2
3/**
4 * Smarty Method RegisterCacheResource
5 *
6 * Smarty::registerCacheResource() method
7 *
8 * @package    Smarty
9 * @subpackage PluginsInternal
10 * @author     Uwe Tews
11 */
12class Smarty_Internal_Method_RegisterCacheResource
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::registerCacheResource()
25     * @link http://www.smarty.net/docs/en/api.register.cacheresource.tpl
26     *
27     * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
28     * @param string                                                          $name name of resource type
29     * @param \Smarty_CacheResource                                           $resource_handler
30     *
31     * @return \Smarty|\Smarty_Internal_Template
32     */
33    public function registerCacheResource(
34        Smarty_Internal_TemplateBase $obj,
35        $name,
36        Smarty_CacheResource $resource_handler
37    ) {
38        $smarty = $obj->_getSmartyObj();
39        $smarty->registered_cache_resources[ $name ] = $resource_handler;
40        return $obj;
41    }
42}
43