/** * Add the given content to the archive. * * @param string $name The name of the content in the archive * @param array $attributes An array of key value pairs * @param string $content The content to add to the archive */ protected function addEntry($name, $attributes, $content) { $this->manifest->addEntry($name); foreach ($attributes as $key => $value) { $this->manifest->addAttributeToEntry($name, $key, $value); } $entry = new GedcomxFileEntry($name, $content, $attributes); $this->entries[] = $entry; }
/** * Read an entry from the archive and look for manifest properties. * * @param string $name * * @return \Gedcomx\GedcomxFile\GedcomxFileEntry */ public function readEntry($name) { $entry = new GedcomxFileEntry($name); $entry->setContents($this->archive->getFromName($name)); $manifestAttrs = $this->manifest->getEntryAttributes($name); if ($manifestAttrs != null) { foreach ($manifestAttrs as $attr) { $entry->addAttribute($attr->getKey(), $attr->getValue()); } } else { $this->warnings[] = 'No manifest attributes found for ' . $name; } return $entry; }