<?php
namespace Main\IteratorPattern;

require_once 'Object.php';
require_once 'QuotesIterator.php';

use \Main\Object;

class Quotes extends Object
{
	// Attributes
	private $_quotes = [];
	
	// Constructor
	
	public function __construct()
	{
	}
	
	// Methods for properties
	// Getters and Setters
	public function GetIterator()
	{
		// Using the SRP design principle, we don't
		// provide the functions for reading through
		// the array here. Instead we seperate that
		// responsibility and give it to a
		// QuotesIterator class.
		
		// We pass the QuotesIterator object an array of
		// values not the $_quotes array because we don't want
		// the user messing with the values held in
		// the $_quotes attribute.
		return new QuotesIterator(array_values($this->_quotes));
	}
	
	// Methods
	public function Add(Quotation $quote)
	{
		$this->_quotes[] = $quote;	
	}
	
	
}
?>