00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00018 abstract class AbstractList implements ArrayAccess, SimplifiedArrayAccess
00019 {
00020 protected $list = array();
00021
00022 public function offsetGet($offset)
00023 {
00024 if (isset($this->list[$offset]))
00025 return $this->list[$offset];
00026
00027 throw new MissingElementException(
00028 "no object found with index == '{$offset}'"
00029 );
00030 }
00031
00032 public function offsetUnset($offset)
00033 {
00034 unset($this->list[$offset]);
00035
00036 return $this;
00037 }
00038
00039 public function offsetExists($offset)
00040 {
00041 return isset($this->list[$offset]);
00042 }
00043
00044
00045
00046 public function clean()
00047 {
00048 $this->list = array();
00049 }
00050
00051 public function isEmpty()
00052 {
00053 return ($this->list === array());
00054 }
00055
00056 public function getList()
00057 {
00058 return $this->list;
00059 }
00060
00061 public function set($name, $var)
00062 {
00063 return $this->offsetSet($name, $var);
00064 }
00065
00066 public function get($name)
00067 {
00068 return $this->offsetGet($name);
00069 }
00070
00071 public function has($name)
00072 {
00073 return $this->offsetExists($name);
00074 }
00075
00076 public function drop($name)
00077 {
00078 return $this->offsetUnset($name);
00079 }
00080 }
00081 ?>