Prepended constants with C_ to avoid reserved words as per https://www.php.net/manual...
[htmlpurifier/darkodev.git] / library / HTMLPurifier / StringHash.php
blobc07370197a968a4677ce88aff28fd87b0732853f
1 <?php
3 /**
4 * This is in almost every respect equivalent to an array except
5 * that it keeps track of which keys were accessed.
7 * @warning For the sake of backwards compatibility with early versions
8 * of PHP 5, you must not use the $hash[$key] syntax; if you do
9 * our version of offsetGet is never called.
11 class HTMLPurifier_StringHash extends ArrayObject
13 /**
14 * @type array
16 protected $accessed = array();
18 /**
19 * Retrieves a value, and logs the access.
20 * @param mixed $index
21 * @return mixed
23 public function offsetGet($index)
25 $this->accessed[$index] = true;
26 return parent::offsetGet($index);
29 /**
30 * Returns a lookup array of all array indexes that have been accessed.
31 * @return array in form array($index => true).
33 public function getAccessed()
35 return $this->accessed;
38 /**
39 * Resets the access array.
41 public function resetAccessed()
43 $this->accessed = array();
47 // vim: et sw=4 sts=4