]> git.immae.eu Git - github/wallabag/wallabag.git/blame - inc/3rdparty/htmlpurifier/HTMLPurifier/StringHash.php
remove autoload section in composer.json
[github/wallabag/wallabag.git] / inc / 3rdparty / htmlpurifier / HTMLPurifier / StringHash.php
CommitLineData
d4949327
NL
1<?php\r
2\r
3/**\r
4 * This is in almost every respect equivalent to an array except\r
5 * that it keeps track of which keys were accessed.\r
6 *\r
7 * @warning For the sake of backwards compatibility with early versions\r
8 * of PHP 5, you must not use the $hash[$key] syntax; if you do\r
9 * our version of offsetGet is never called.\r
10 */\r
11class HTMLPurifier_StringHash extends ArrayObject\r
12{\r
13 /**\r
14 * @type array\r
15 */\r
16 protected $accessed = array();\r
17\r
18 /**\r
19 * Retrieves a value, and logs the access.\r
20 * @param mixed $index\r
21 * @return mixed\r
22 */\r
23 public function offsetGet($index)\r
24 {\r
25 $this->accessed[$index] = true;\r
26 return parent::offsetGet($index);\r
27 }\r
28\r
29 /**\r
30 * Returns a lookup array of all array indexes that have been accessed.\r
31 * @return array in form array($index => true).\r
32 */\r
33 public function getAccessed()\r
34 {\r
35 return $this->accessed;\r
36 }\r
37\r
38 /**\r
39 * Resets the access array.\r
40 */\r
41 public function resetAccessed()\r
42 {\r
43 $this->accessed = array();\r
44 }\r
45}\r
46\r
47// vim: et sw=4 sts=4\r