Explicitly specify decorator name.
[htmlpurifier.git] / library / HTMLPurifier / DefinitionCache / Decorator.php
blob37db816faa30c5884d481994239912a878d8cb9d
1 <?php
3 class HTMLPurifier_DefinitionCache_Decorator extends HTMLPurifier_DefinitionCache
6 /**
7 * Cache object we are decorating
8 * @var HTMLPurifier_DefinitionCache
9 */
10 public $cache;
12 /**
13 * The name of the decorator
14 * @var string
16 public $name;
18 public function __construct() {}
20 /**
21 * Lazy decorator function
23 * @param HTMLPurifier_DefinitionCache $cache Reference to cache object to decorate
25 * @return HTMLPurifier_DefinitionCache_Decorator
27 public function decorate(&$cache)
29 $decorator = $this->copy();
30 // reference is necessary for mocks in PHP 4
31 $decorator->cache =& $cache;
32 $decorator->type = $cache->type;
33 return $decorator;
36 /**
37 * Cross-compatible clone substitute
39 public function copy()
41 return new HTMLPurifier_DefinitionCache_Decorator();
44 public function add($def, $config)
46 return $this->cache->add($def, $config);
49 public function set($def, $config)
51 return $this->cache->set($def, $config);
54 public function replace($def, $config)
56 return $this->cache->replace($def, $config);
59 public function get($config)
61 return $this->cache->get($config);
64 public function remove($config)
66 return $this->cache->remove($config);
69 public function flush($config)
71 return $this->cache->flush($config);
74 public function cleanup($config)
76 return $this->cache->cleanup($config);
80 // vim: et sw=4 sts=4