<?php
namespace Main\IteratorPattern;

use \Iterator;

/*
 * Using the Standard PHP Library (SPL) class Iterator
 */

class QuotesIterator implements Iterator
{
	// Attributes
	private $_key;
	private $_values;
	
	// Constructor
	
	public function __construct(array $values)
	{		
		$this->_values = $values;
		$this->_key = 0;
	}
	
	// Methods for properties
	// Getters and Setters
	
	// Methods
	public function current()
	{
		return $this->_values[$this->_key];
	}
	
	public function key()
	{
		return $this->_key;	
	}
	
	public function next()
	{
		$this->_key++;
	}
	
	public function rewind()
	{
		$this->_index = 0;
	}
	
	public function valid()
	{
		return isset($this->_values[$this->_key]);
	}
}
?>