Exemplo n.º 1
0
 public static function XMLRelationshipData()
 {
     //  MOTHER
     $birthDate = new \DateTime('January 21, 1923');
     $birth = new Fact(array("type" => FactType::BIRTH, "date" => new DateInfo(array("original" => $birthDate->format("F d, Y"))), "place" => new PlaceReference(array("description" => "possibly, maybe, don't know", "original" => 'Flagstaff, Arizona, United States'))));
     $deathDate = new \DateTime('October 12, 1987');
     $death = new Fact(array("type" => FactType::DEATH, "date" => new DateInfo(array("original" => $deathDate->format("F d, Y"))), "place" => new PlaceReference(array("description" => "One. Two. Buckle my shoe.", "original" => 'San Antonio, Texas, United States'))));
     $facts = array();
     $facts[] = $birth;
     $facts[] = $death;
     $mother = new Person();
     $mother->setGender(new Gender(array("type" => GenderType::FEMALE)));
     $mother->setLiving(false);
     $mother->setPrincipal(false);
     $name = PersonBuilder::makeName('Hildegard', 'Schmidlab');
     $mother->setNames(array($name));
     $mother->setFacts($facts);
     $display = new DisplayProperties(array("birthDate" => $birth->getDate()->getDateTime()->format("d M Y"), "birthPlace" => $birth->getPlace()->getOriginal(), "gender" => GenderType::FEMALE, "lifespan" => $birth->getDate()->getDateTime()->format("d M Y") . " - " . $death->getDate()->getDateTime()->format("d M Y"), "name" => $name->toString()));
     $mother->setDisplayExtension($display);
     //  FATHER
     $birthDate = new \DateTime('February 2, 1915');
     $birth = new Fact(array("type" => FactType::BIRTH, "date" => new DateInfo(array("original" => $birthDate->format("F d, Y"))), "place" => new PlaceReference(array("description" => "possibly, maybe, don't know", "original" => 'Flagstaff, Arizona, United States'))));
     $deathDate = new \DateTime('January 12, 1977');
     $death = new Fact(array("type" => FactType::DEATH, "date" => new DateInfo(array("original" => $deathDate->format("F d, Y"))), "place" => new PlaceReference(array("description" => "One. Two. Buckle my shoe.", "original" => 'San Antonio, Texas, United States'))));
     $facts = array();
     $facts[] = $birth;
     $facts[] = $death;
     $father = new Person();
     $father->setGender(new Gender(array("type" => GenderType::MALE)));
     $father->setLiving(false);
     $father->setPrincipal(false);
     $name = PersonBuilder::makeName('Marvin', 'Schmidlab');
     $father->setNames(array($name));
     $father->setFacts($facts);
     $display = new DisplayProperties(array("birthDate" => $birth->getDate()->getDateTime()->format("d M Y"), "birthPlace" => $birth->getPlace()->getOriginal(), "gender" => GenderType::MALE, "lifespan" => $birth->getDate()->getDateTime()->format("d M Y") . " - " . $death->getDate()->getDateTime()->format("d M Y"), "name" => $name->toString()));
     $father->setDisplayExtension($display);
     //  CHILD
     $birthDate = new \DateTime('March 12, 1935');
     $birth = new Fact(array("type" => FactType::BIRTH, "date" => new DateInfo(array("original" => $birthDate->format("F d, Y"))), "place" => new PlaceReference(array("description" => "possibly, maybe, don't know", "original" => 'Santa Fe, New Mexico, United States'))));
     $deathDate = new \DateTime('January 2, 2007');
     $death = new Fact(array("type" => FactType::DEATH, "date" => new DateInfo(array("original" => $deathDate->format("F d, Y"))), "place" => new PlaceReference(array("description" => "One. Two. Buckle my shoe.", "original" => 'San Antonio, Texas, United States'))));
     $facts = array();
     $facts[] = $birth;
     $facts[] = $death;
     $child = new Person();
     $child->setGender(new Gender(array("type" => GenderType::MALE)));
     $child->setLiving(false);
     $child->setPrincipal(false);
     $name = PersonBuilder::makeName('Englebert', 'Schmidlab');
     $child->setNames(array($name));
     $child->setFacts($facts);
     $display = new DisplayProperties(array("birthDate" => $birth->getDate()->getDateTime()->format("d M Y"), "birthPlace" => $birth->getPlace()->getOriginal(), "gender" => GenderType::MALE, "lifespan" => $birth->getDate()->getDateTime()->format("d M Y") . " - " . $death->getDate()->getDateTime()->format("d M Y"), "name" => $name->toString()));
     $child->setDisplayExtension($display);
     return array('father' => $father, 'mother' => $mother, 'child' => $child);
 }
Exemplo n.º 2
0
 public static function buildPerson($gender)
 {
     /*
      * Can't use faker for dates. It doesn't deal well with negative timestamps.
      */
     switch ($gender) {
         case 'male':
             $gender = GenderType::MALE;
             break;
         case 'female':
             $gender = GenderType::FEMALE;
             break;
         default:
             $gender = self::faker()->boolean() ? GenderType::FEMALE : GenderType::MALE;
     }
     $birth = FactBuilder::birth();
     $death = FactBuilder::death($birth);
     $facts = array();
     $facts[] = $birth;
     $living = false;
     if ($death->getDate()->getDateTime()->getTimestamp() > time()) {
         $living = true;
     } else {
         $facts[] = $death;
     }
     $person = new Person();
     $person->setGender(new Gender(array("type" => $gender)));
     $person->setLiving($living);
     $person->setPrincipal(false);
     $name = self::birthName($gender);
     $person->setNames(array($name));
     $person->setFacts($facts);
     $display = new DisplayProperties(array("birthDate" => $birth->getDate()->getDateTime()->format("d M Y"), "birthPlace" => $birth->getPlace()->getOriginal(), "gender" => $gender, "lifespan" => $birth->getDate()->getDateTime()->format("d M Y") . " - " . ($living ? '' : $death->getDate()->getDateTime()->format("d M Y")), "name" => $name->toString()));
     $person->setDisplayExtension($display);
     return $person;
 }