public function getNextId() { $ids = array_keys($this->data); if (count($ids)) { $id = max($ids) + 1; return $id; } return 1; }