1 <?php
defined('IN_CMS') or die('No direct access allowed.');
3 class Items
implements Iterator
{
6 private $items = array();
8 public function __construct($array) {
10 $this->items
= $array;
13 public function rewind() {
17 public function current() {
18 return $this->items
[$this->position
];
21 public function key() {
22 return $this->position
;
25 public function next() {
29 public function valid() {
30 return isset($this->items
[$this->position
]);
33 public function length() {
34 return count($this->items
);
37 public function first() {
38 return isset($this->items
[0]) ?
$this->items
[0] : false;
41 public function last() {
42 $index = count($this->items
) - 1;
43 return isset($this->items
[$index]) ?
$this->items
[$index] : false;