_listsById = array(); $this->_listsByName = array(); foreach ($data->lists->list as $list) { $list = new Zend_Service_RememberTheMilk_List($list); $this->_listsById[$list->getId()] = $list; $this->_listsByName[$list->getName()] = $list; } } /** * Implementation of IteratorAggregate::getIterator(). * * @return ArrayIterator */ public function getIterator() { return new ArrayIterator($this->_listsById); } /** * Implementation of IteratorAggregate::getLength(). * * @return int */ public function getLength() { return count($this->_listsById); } /** * Returns the list instance with the specified identifier. * * @param int $id Identifier for the list * @return Zend_Service_RememberTheMilk_List */ public function getListById($id) { if (isset($this->_listsById[$id])) { return $this->_listsById[$id]; } return null; } /** * Returns the list instance with the specified name. * * @param string $name Name of the list * @return Zend_Service_RememberTheMilk_List */ public function getListByName($name) { if (isset($this->_listsByName[$name])) { return $this->_listsByName[$name]; } return null; } }