$val) { $val = html::conditional_escape($val); $out .= " $name=\"$val\""; } return $out; } abstract class IterableErrors implements \IteratorAggregate, \ArrayAccess, \Countable { protected $errors; function __construct(array $errors=null) { if (is_null($errors)) $errors = array(); $this->errors = $errors; } function getIterator() { return new \ArrayIterator($this->errors); } function count() { return count($this->errors); } function offsetExists($offset) { return isset($this->errors[$offset]); } function offsetGet($offset) { return $this->errors[$offset]; } function offsetSet($offset, $value) { $this->errors[$offset] = $value; } function offsetUnset($offset) { unset($this->errors[$offset]); } } class ErrorDict extends IterableErrors { function __toString() { return $this->asUl(); } function asUl() { $html = '