Ejemplo n.º 1
0
 /**
  * Visits the conclusion.
  *
  * @param \Gedcomx\Conclusion\Conclusion $conclusion
  */
 protected function visitConclusion(Conclusion $conclusion)
 {
     $sourceReferences = $conclusion->getSources();
     if ($sourceReferences !== null) {
         /** @var SourceReference $sourceReference */
         foreach ($sourceReferences as $sourceReference) {
             $sourceReference->accept($this);
         }
     }
     $notes = $conclusion->getNotes();
     if ($notes !== null) {
         /** @var Note $note */
         foreach ($notes as $note) {
             $note->accept($this);
         }
     }
 }
Ejemplo n.º 2
0
 /**
  * Remove a conclusion from this person.
  *
  * @param Conclusion            $conclusion
  * @param StateTransitionOption $option,...
  *
  * @return PersonState
  * @throws Exception\GedcomxApplicationException
  */
 protected function deleteConclusion(Conclusion $conclusion, StateTransitionOption $option = null)
 {
     $link = $conclusion->getLink(Rel::CONCLUSION);
     if ($link == null) {
         $conclusion->getLink(Rel::SELF);
     }
     if ($link == null || $link->getHref() == null) {
         throw new GedcomxApplicationException("Conclusion cannot be deleted: missing link.");
     }
     $request = $this->createAuthenticatedGedcomxRequest('DELETE', $link->getHref());
     return $this->stateFactory->createState('PersonState', $this->client, $request, $this->passOptionsTo('invoke', array($request), func_get_args()), $this->accessToken);
 }
Ejemplo n.º 3
0
 /**
  * Writes the contents of this FieldValue 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->resource) {
         $writer->writeAttribute('resource', $this->resource);
     }
     if ($this->datatype) {
         $writer->writeAttribute('datatype', $this->datatype);
     }
     if ($this->type) {
         $writer->writeAttribute('type', $this->type);
     }
     if ($this->labelId) {
         $writer->writeAttribute('labelId', $this->labelId);
     }
     parent::writeXmlContents($writer);
     if ($this->text) {
         $writer->startElementNs('gx', 'text', null);
         $writer->text($this->text);
         $writer->endElement();
     }
 }
Ejemplo n.º 4
0
 /**
  * Writes the contents of this Fact 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->primary) {
         $writer->writeAttribute('primary', $this->primary);
     }
     if ($this->type) {
         $writer->writeAttribute('type', $this->type);
     }
     parent::writeXmlContents($writer);
     if ($this->date) {
         $writer->startElementNs('gx', 'date', null);
         $this->date->writeXmlContents($writer);
         $writer->endElement();
     }
     if ($this->place) {
         $writer->startElementNs('gx', 'place', null);
         $this->place->writeXmlContents($writer);
         $writer->endElement();
     }
     if ($this->value) {
         $writer->startElementNs('gx', 'value', null);
         $writer->text($this->value);
         $writer->endElement();
     }
     if ($this->qualifiers) {
         foreach ($this->qualifiers as $i => $x) {
             $writer->startElementNs('gx', 'qualifier', 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();
         }
     }
 }
Ejemplo n.º 5
0
 /**
  * Writes the contents of this Gender 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->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();
         }
     }
 }
Ejemplo n.º 6
0
 /**
  * Merges data from provided object with current object
  *
  * @param Subject|ExtensibleData $subject Assumes \Gedcomx\Conclusion\Subject or a subclass
  */
 protected function embed(ExtensibleData $subject)
 {
     $this->extracted = $this->extracted == null ? $subject->extracted : $this->extracted;
     if ($subject->identifiers != null) {
         if ($this->identifiers == null) {
             $this->identifiers = array();
         }
         $this->identifiers = array_merge($this->identifiers, $subject->identifiers);
     }
     if ($subject->media != null) {
         if ($this->media == null) {
             $this->media = array();
         }
         $this->media = array_merge($this->media, $subject->media);
     }
     if ($subject->evidence != null) {
         if ($this->evidence == null) {
             $this->evidence = array();
         }
         $this->evidence = array_merge($this->evidence, $subject->evidence);
     }
     parent::embed($subject);
 }
Ejemplo n.º 7
0
 /**
  * Writes the contents of this EventRole 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->type) {
         $writer->writeAttribute('type', $this->type);
     }
     parent::writeXmlContents($writer);
     if ($this->person) {
         $writer->startElementNs('gx', 'person', null);
         $this->person->writeXmlContents($writer);
         $writer->endElement();
     }
     if ($this->details) {
         $writer->startElementNs('gx', 'details', null);
         $writer->text($this->details);
         $writer->endElement();
     }
 }
Ejemplo n.º 8
0
 /**
  * Writes the contents of this Document 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->textType) {
         $writer->writeAttribute('textType', $this->textType);
     }
     if ($this->extracted) {
         $writer->writeAttribute('extracted', $this->extracted);
     }
     if ($this->type) {
         $writer->writeAttribute('type', $this->type);
     }
     parent::writeXmlContents($writer);
     if ($this->text) {
         $writer->startElementNs('gx', 'text', null);
         $writer->text($this->text);
         $writer->endElement();
     }
 }
Ejemplo n.º 9
0
 /**
  * Writes the contents of this Name 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->type) {
         $writer->writeAttribute('type', $this->type);
     }
     parent::writeXmlContents($writer);
     if ($this->preferred) {
         $writer->startElementNs('gx', 'preferred', null);
         $writer->text($this->preferred);
         $writer->endElement();
     }
     if ($this->date) {
         $writer->startElementNs('gx', 'date', null);
         $this->date->writeXmlContents($writer);
         $writer->endElement();
     }
     if ($this->nameForms) {
         foreach ($this->nameForms as $i => $x) {
             $writer->startElementNs('gx', 'nameForm', null);
             $x->writeXmlContents($writer);
             $writer->endElement();
         }
     }
 }