1<?php
2require_once('ZoteroEntry.php');
3
4abstract class ZoteroRepository
5{
6	protected $entries = array();
7
8	/**
9	 * @return	ZoteroEntry
10	 */
11	public function getEntryByID($zoteroId)
12	{
13		$e = @$this->entries[$zoteroId];
14		if ($e != null)
15		{
16			return $e;
17		}
18		else
19		{
20			throw new ZoteroEntryNotFoundException("Zotero entry with ID " . $zoteroId . " not found.");
21		}
22	}
23
24	/**
25	 * @return	ZoteroEntry
26	 */
27	public function getEntryByCiteKey($citeKey)
28	{
29		foreach ($this->entries as $e)
30		{
31			if ($e->getCiteKey() === $citeKey)
32			{
33				return $e;
34			}
35		}
36		throw new ZoteroEntryNotFoundException("Zotero entry with cite key " . $citeKey . " not found.");
37	}
38
39	public function getAllEntries()
40	{
41		return $this->entries;
42	}
43
44	public function updateAndSaveEntries(array $entries)
45	{}
46
47	public function saveEntries(array $entries)
48    {
49        $this->entries = array();
50        $this->updateAndSaveEntries($entries);
51    }
52}
53?>
54