/** * * */ public static function parse(\PhpGedcom\Parser $parser) { $record = $parser->getCurrentLineRecord(); $depth = (int) $record[0]; $line = isset($record[2]) ? trim($record[2]) : ''; $addr = new \PhpGedcom\Record\Addr(); $addr->setAddr($line); $parser->forward(); while (!$parser->eof()) { $record = $parser->getCurrentLineRecord(); $recordType = strtolower(trim($record[1])); $currentDepth = (int) $record[0]; if ($currentDepth <= $depth) { $parser->back(); break; } if ($addr->hasAttribute($recordType)) { $addr->{'set' . $recordType}(trim($record[2])); } else { if ($recordType == 'cont') { // FIXME: Can have CONT on multiple attributes $addr->setAddr($addr->getAddr() . "\n"); if (isset($record[2])) { $addr->setAddr($addr->getAddr() . trim($record[2])); } } else { $parser->logUnhandledRecord(get_class() . ' @ ' . __LINE__); } } $parser->forward(); } return $addr; }
/** * * */ public static function parse(\PhpGedcom\Parser $parser) { $record = $parser->getCurrentLineRecord(); $depth = (int) $record[0]; $even = new \PhpGedcom\Record\SourRef\Even(); $even->setEven(trim($record[2])); $parser->forward(); while (!$parser->eof()) { $record = $parser->getCurrentLineRecord(); $recordType = strtoupper(trim($record[1])); $currentDepth = (int) $record[0]; if ($currentDepth <= $depth) { $parser->back(); break; } switch ($recordType) { case 'ROLE': $even->setRole(trim($record[2])); break; default: $parser->logUnhandledRecord(get_class() . ' @ ' . __LINE__); } $parser->forward(); } return $even; }
/** * * */ public static function parse(\PhpGedcom\Parser $parser) { $record = $parser->getCurrentLineRecord(); $depth = (int) $record[0]; $char = new \PhpGedcom\Record\Head\Char(); $char->setChar(trim($record[2])); $parser->forward(); while (!$parser->eof()) { $record = $parser->getCurrentLineRecord(); $recordType = strtoupper(trim($record[1])); $currentDepth = (int) $record[0]; if ($currentDepth <= $depth) { $parser->back(); break; } switch ($recordType) { case 'VERS': $char->setVers(trim($record[2])); break; default: $parser->logUnhandledRecord(get_class() . ' @ ' . __LINE__); } $parser->forward(); } return $char; }
/** * * */ public static function parse(\PhpGedcom\Parser $parser) { $record = $parser->getCurrentLineRecord(); $identifier = $parser->normalizeIdentifier($record[2]); $depth = (int) $record[0]; $caln = new \PhpGedcom\Record\Caln(); $caln->setCaln($identifier); $parser->forward(); while (!$parser->eof()) { $record = $parser->getCurrentLineRecord(); $recordType = strtolower(trim($record[1])); $lineDepth = (int) $record[0]; if ($lineDepth <= $depth) { $parser->back(); break; } if ($caln->hasAttribute($recordType)) { $caln->{'set' . $recordType}(trim($record[2])); } else { $parser->logUnhandledRecord(get_class() . ' @ ' . __LINE__); } $parser->forward(); } return $caln; }
/** * * */ public static function parse(\PhpGedcom\Parser $parser) { $record = $parser->getCurrentLineRecord(); $depth = (int) $record[0]; $data = new \PhpGedcom\Record\Head\Sour\Data(); $data->setData(trim($record[2])); $parser->forward(); while (!$parser->eof()) { $record = $parser->getCurrentLineRecord(); $recordType = strtoupper(trim($record[1])); $currentDepth = (int) $record[0]; if ($currentDepth <= $depth) { $parser->back(); break; } switch ($recordType) { case 'DATE': $data->setDate(trim($record[2])); break; case 'COPR': $data->setCopr(trim($record[2])); break; default: $parser->logUnhandledRecord(get_class() . ' @ ' . __LINE__); } $parser->forward(); } return $data; }
/** * * */ public static function parse(\PhpGedcom\Parser $parser) { $record = $parser->getCurrentLineRecord(); $identifier = $parser->normalizeIdentifier($record[1]); $depth = (int) $record[0]; $subn = new \PhpGedcom\Record\Subn(); $subn->setId($identifier); $parser->getGedcom()->setSubn($subn); $parser->forward(); while (!$parser->eof()) { $record = $parser->getCurrentLineRecord(); $currentDepth = (int) $record[0]; $recordType = strtoupper(trim($record[1])); if ($currentDepth <= $depth) { $parser->back(); break; } switch ($recordType) { case 'SUBM': $subn->setSubm($parser->normalizeIdentifier($record[2])); break; case 'FAMF': $subn->setFamf(trim($record[2])); break; case 'TEMP': $subn->setTemp(trim($record[2])); break; case 'ANCE': $subn->setAnce(trim($record[2])); break; case 'DESC': $subn->setDesc(trim($record[2])); break; case 'ORDI': $subn->setOrdi(trim($record[2])); break; case 'RIN': $subn->setRin(trim($record[2])); break; default: $parser->logUnhandledRecord(get_class() . ' @ ' . __LINE__); } $parser->forward(); } return $subn; }