/** * Writes the contents of this NameForm to an XML writer. The startElement is expected to be already provided. * * @param \XMLWriter $writer The XML writer. */ public function writeXmlContents(\XMLWriter $writer) { if ($this->lang) { $writer->writeAttribute('xml:lang', $this->lang); } parent::writeXmlContents($writer); if ($this->fullText) { $writer->startElementNs('gx', 'fullText', null); $writer->text($this->fullText); $writer->endElement(); } if ($this->parts) { foreach ($this->parts as $i => $x) { $writer->startElementNs('gx', 'part', null); $x->writeXmlContents($writer); $writer->endElement(); } } if ($this->fields) { foreach ($this->fields as $i => $x) { $writer->startElementNs('gx', 'field', null); $x->writeXmlContents($writer); $writer->endElement(); } } }
/** * Writes the contents of this NamePart to an XML writer. The startElement is expected to be already provided. * * @param \XMLWriter $writer The XML writer. */ public function writeXmlContents(\XMLWriter $writer) { if ($this->value) { $writer->writeAttribute('value', $this->value); } if ($this->type) { $writer->writeAttribute('type', $this->type); } parent::writeXmlContents($writer); if ($this->fields) { foreach ($this->fields as $i => $x) { $writer->startElementNs('gx', 'field', null); $x->writeXmlContents($writer); $writer->endElement(); } } if ($this->qualifiers) { foreach ($this->qualifiers as $i => $x) { $writer->startElementNs('gx', 'qualifier', null); $x->writeXmlContents($writer); $writer->endElement(); } } }
/** * Merges given data with current object * * @param FamilySearchPlatform|ExtensibleData $gedcomx Assumes Gedcomx\Gedcomx or a subclass */ public function embed(ExtensibleData $gedcomx) { $childRelationships = $gedcomx->getChildAndParentsRelationships(); if ($childRelationships != null) { foreach ($childRelationships as $chr) { $found = false; if ($chr->getId() != null) { if ($this->getChildAndParentsRelationships() != null) { foreach ($this->getChildAndParentsRelationships() as $target) { if ($chr->getId() == $target->getId()) { $target->embed($chr); $found = true; break; } } } } if (!$found) { $this->addChildAndParentsRelationship($chr); } } } $discussions = $gedcomx->getDiscussions(); if ($discussions != null) { foreach ($discussions as $d) { $found = false; if ($d->getId() != null) { if ($this->getDiscussions() != null) { foreach ($this->getDiscussions() as $target) { if ($d->getId() == $target->getId()) { $target->embed($d); $found = true; break; } } } } if (!$found) { $this->addDiscussion($d); } } } parent::embed($gedcomx); }
/** * Writes the contents of this Address to an XML writer. The startElement is expected to be already provided. * * @param \XMLWriter $writer The XML writer. */ public function writeXmlContents($writer) { parent::writeXmlContents($writer); if ($this->city) { $writer->startElementNs('gx', 'city', null); $writer->text($this->city); $writer->endElement(); } if ($this->country) { $writer->startElementNs('gx', 'country', null); $writer->text($this->country); $writer->endElement(); } if ($this->postalCode) { $writer->startElementNs('gx', 'postalCode', null); $writer->text($this->postalCode); $writer->endElement(); } if ($this->stateOrProvince) { $writer->startElementNs('gx', 'stateOrProvince', null); $writer->text($this->stateOrProvince); $writer->endElement(); } if ($this->street) { $writer->startElementNs('gx', 'street', null); $writer->text($this->street); $writer->endElement(); } if ($this->street2) { $writer->startElementNs('gx', 'street2', null); $writer->text($this->street2); $writer->endElement(); } if ($this->street3) { $writer->startElementNs('gx', 'street3', null); $writer->text($this->street3); $writer->endElement(); } if ($this->street4) { $writer->startElementNs('gx', 'street4', null); $writer->text($this->street4); $writer->endElement(); } if ($this->street5) { $writer->startElementNs('gx', 'street5', null); $writer->text($this->street5); $writer->endElement(); } if ($this->street6) { $writer->startElementNs('gx', 'street6', null); $writer->text($this->street6); $writer->endElement(); } if ($this->value) { $writer->startElementNs('gx', 'value', null); $writer->text($this->value); $writer->endElement(); } }
/** * Merges given data with current object * * @param ExtensibleData $data Assumes \Gedcomx\Links\HypermediaEnabledData or a subclass */ protected function embed(ExtensibleData $data) { parent::embed($data); }
/** * Embed the specified person into this one. * * @param ExtensibleData $person assumes \Gedcomx\Conclusion\Person or a subclass */ public function embed(ExtensibleData $person) { if ($this->private == null) { $this->private = $person->isPrivate(); } $this->living = $this->living == null ? $person->isLiving() : $this->living; $this->principal = $this->principal == null ? $person->principal : $this->principal; $this->gender = $this->gender == null ? $person->gender : $this->gender; if ($this->displayExtension != null && $person->displayExtension != null) { $this->displayExtension->embed($person->getDisplayExtension()); } else { if ($person->displayExtension != null) { $this->displayExtension = $person->displayExtension; } } if ($person->names != null) { if ($this->names == null) { $this->names = array(); } $this->names = array_merge($this->names, $person->names); } if ($person->facts != null) { if ($this->facts == null) { $this->facts = array(); } $this->facts = array_merge($this->facts, $person->facts); } if ($person->fields != null) { if ($this->fields == null) { $this->fields = array(); } $this->fields = array_merge($this->fields, $person->facts); } parent::embed($person); }
/** * Writes the contents of this PlaceDisplayProperties to an XML writer. The startElement is expected to be already * provided. * * @param \XMLWriter $writer The XML writer. */ public function writeXmlContents(\XMLWriter $writer) { parent::writeXmlContents($writer); if ($this->fullName) { $writer->startElementNs('gx', 'fullName', null); $writer->text($this->fullName); $writer->endElement(); } if ($this->name) { $writer->startElementNs('gx', 'name', null); $writer->text($this->name); $writer->endElement(); } if ($this->type) { $writer->startElementNs('gx', 'type', null); $writer->text($this->type); $writer->endElement(); } }
/** * Writes the contents of this DisplayProperties to an XML writer. The startElement is expected to be already * provided. * * @param \XMLWriter $writer The XML writer. */ public function writeXmlContents(\XMLWriter $writer) { parent::writeXmlContents($writer); if ($this->ascendancyNumber) { $writer->startElementNs('gx', 'ascendancyNumber', null); $writer->text($this->ascendancyNumber); $writer->endElement(); } if ($this->birthDate) { $writer->startElementNs('gx', 'birthDate', null); $writer->text($this->birthDate); $writer->endElement(); } if ($this->birthPlace) { $writer->startElementNs('gx', 'birthPlace', null); $writer->text($this->birthPlace); $writer->endElement(); } if ($this->deathDate) { $writer->startElementNs('gx', 'deathDate', null); $writer->text($this->deathDate); $writer->endElement(); } if ($this->deathPlace) { $writer->startElementNs('gx', 'deathPlace', null); $writer->text($this->deathPlace); $writer->endElement(); } if ($this->descendancyNumber) { $writer->startElementNs('gx', 'descendancyNumber', null); $writer->text($this->descendancyNumber); $writer->endElement(); } if ($this->gender) { $writer->startElementNs('gx', 'gender', null); $writer->text($this->gender); $writer->endElement(); } if ($this->lifespan) { $writer->startElementNs('gx', 'lifespan', null); $writer->text($this->lifespan); $writer->endElement(); } if ($this->marriageDate) { $writer->startElementNs('gx', 'marriageDate', null); $writer->text($this->marriageDate); $writer->endElement(); } if ($this->marriagePlace) { $writer->startElementNs('gx', 'marriagePlace', null); $writer->text($this->marriagePlace); $writer->endElement(); } if ($this->name) { $writer->startElementNs('gx', 'name', null); $writer->text($this->name); $writer->endElement(); } }
/** * Writes the contents of this PlaceReference to an XML writer. The startElement is expected to be already provided. * * @param \XMLWriter $writer The XML writer. */ public function writeXmlContents(\XMLWriter $writer) { if ($this->descriptionRef) { $writer->writeAttribute('description', $this->descriptionRef); } parent::writeXmlContents($writer); if ($this->original) { $writer->startElementNs('gx', 'original', null); $writer->text($this->original); $writer->endElement(); } if ($this->normalizedExtensions) { foreach ($this->normalizedExtensions as $i => $x) { $writer->startElementNs('gx', 'normalized', null); $x->writeXmlContents($writer); $writer->endElement(); } } if ($this->fields) { foreach ($this->fields as $i => $x) { $writer->startElementNs('gx', 'field', null); $x->writeXmlContents($writer); $writer->endElement(); } } }
/** * Merges given data with current object * * @param ExtensibleData $gedcomx Assumes Gedcomx\Gedcomx or a subclass */ public function embed(ExtensibleData $gedcomx) { $links = $gedcomx->getLinks(); if ($links != null) { foreach ($links as $link) { $found = false; if ($link->getRel() != null) { if ($this->getLinks() != null) { foreach ($this->getLinks() as $target) { if ($link->getRel() == $target->getRel()) { $found = true; break; } } } } if (!$found) { $this->addLink($link); } } } $persons = $gedcomx->getPersons(); if ($persons != null) { foreach ($persons as $person) { $found = false; if ($person->getId() != null) { if ($this->getPersons() != null) { foreach ($this->getPersons() as $target) { if ($person->getId() == $target->getId()) { $target->embed($person); $found = true; break; } } } } if (!$found) { $this->addPerson($person); } } } $relationships = $gedcomx->getRelationships(); if ($relationships != null) { foreach ($relationships as $relationship) { $found = false; if ($relationship->getId() != null) { if ($this->getRelationships() != null) { foreach ($this->getRelationships() as $target) { if ($relationship->getId() == $target->getId()) { $target->embed($relationship); $found = true; break; } } } } if (!$found) { $this->addRelationship($relationship); } } } $sourceDescriptions = $gedcomx->getSourceDescriptions(); if ($sourceDescriptions != null) { foreach ($sourceDescriptions as $sourceDescription) { $found = false; if ($sourceDescription->getId() != null) { if ($this->getSourceDescriptions() != null) { foreach ($this->getSourceDescriptions() as $target) { if ($sourceDescription->getId() == $target->getId()) { $target->embed($sourceDescription); $found = true; break; } } } } if (!$found) { $this->addSourceDescription($sourceDescription); } } } $agents = $gedcomx->getAgents(); if ($agents != null) { foreach ($agents as $agent) { $found = false; if ($agent->getId() != null) { if ($this->getAgents() != null) { foreach ($this->getAgents() as $target) { if ($agent->getId() == $target->getId()) { $target->embed($agent); $found = true; break; } } } } if (!$found) { $this->addAgent($agent); } } } $events = $gedcomx->getEvents(); if ($events != null) { foreach ($events as $event) { $found = false; if ($event->getId() != null) { if ($this->getEvents() != null) { foreach ($this->getEvents() as $target) { if ($event->getId() == $target->getId()) { $target->embed($event); $found = true; break; } } } } if (!$found) { addEvent(event); } } } $placeDescriptions = $gedcomx->getPlaces(); if ($placeDescriptions != null) { foreach ($placeDescriptions as $placeDescription) { $found = false; if ($placeDescription->getId() != null) { if ($this->getPlaces() != null) { foreach ($this->getPlaces() as $target) { if ($placeDescription->getId() == $target->getId()) { $target->embed(placeDescription); $found = true; break; } } } } if (!$found) { $this->addPlace($placeDescription); } } } $documents = $gedcomx->getDocuments(); if ($documents != null) { foreach ($documents as $document) { $found = false; if ($document->getId() != null) { if ($this->getDocuments() != null) { foreach ($this->getDocuments() as $target) { if ($document . getId() == $target->getId()) { $target->embed($document); $found = true; break; } } } } if (!$found) { $this->addDocument($document); } } } $collections = $gedcomx->getCollections(); if ($collections != null) { foreach ($collections as $collection) { $found = false; if ($collection->getId() != null) { if ($this->getCollections() != null) { foreach ($this->getCollections() as $target) { if ($collection->getId() == $target->getId()) { $target->embed($collection); $found = true; break; } } } } if (!$found) { $this->addCollection($collection); } } } $fields = $gedcomx->getFields(); if ($fields != null) { foreach ($fields as $field) { $found = false; if ($field->getId() != null) { if ($this->getFields() != null) { foreach ($this->getFields() as $target) { if ($field->getId() == $target->getId()) { $found = true; break; } } } } if (!$found) { $this->addField($field); } } } $recordDescriptors = $gedcomx->getRecordDescriptors(); if ($recordDescriptors != null) { foreach ($recordDescriptors as $recordDescriptor) { $found = false; if ($recordDescriptor->getId() != null) { if ($this->getRecordDescriptors() != null) { foreach ($this->getRecordDescriptors() as $target) { if ($recordDescriptor . getId() == $target->getId()) { $target->embed($recordDescriptor); $found = true; break; } } } } if (!$found) { $this->addRecordDescriptor(recordDescriptor); } } } }
/** * @param \Gedcomx\Common\ExtensibleData $discussion */ public function embed(ExtensibleData $discussion) { $comments = $discussion->getComments(); if ($comments != null) { foreach ($comments as $comment) { $found = false; if ($comment->getId() != null) { if ($this->getComments() != null) { foreach ($this->getComments() as $target) { if ($comment->getId() == $target->getId()) { $target->embed($comment); $found = true; break; } } } } if (!$found) { $this->addComment($comment); } } } parent::embed($discussion); }
protected function bindIfNeeded(ExtensibleData $candidate) { if ($this->{$resource} === null && $this->resourceId == $candidate->getId()) { $this->resource = $candidate; } }
/** * Writes the contents of this OnlineAccount to an XML writer. The startElement is expected to be already provided. * * @param \XMLWriter $writer The XML writer. */ public function writeXmlContents(\XMLWriter $writer) { parent::writeXmlContents($writer); if ($this->accountName) { $writer->startElementNs('gx', 'accountName', null); $writer->text($this->accountName); $writer->endElement(); } if ($this->serviceHomepage) { $writer->startElementNs('gx', 'serviceHomepage', null); $this->serviceHomepage->writeXmlContents($writer); $writer->endElement(); } }