/** * Flattens the object into a GEDCOM compliant format * * This method guarantees compliance, not re-creation of * the original order of the records. * * @param int $lvl indicates the level at which this record * should be generated * @param string $ver represents the version of the GEDCOM standard * * @return string a return character delimited string of gedcom records * * @access public * @since Method available since Release 0.0.1 */ public function to_gedcom($lvl, $ver) { if (!isset($ver) || $ver === '') { $ver = $this->ver; } $ged_rec = ''; if (strpos($ver, '5.5.1') == 0) { if (isset($this->rp_name) && $this->rp_name != '') { $ged_rec .= $this->rp_name->to_gedcom($lvl, $ver); } $lvl2 = $lvl + 1; for ($i = 0; $i < count($this->phonetic_names); $i++) { $str .= "\n" . $this->phonetic_names[$i]->to_gedcom($lvl2, $ver); } for ($i = 0; $i < count($this->romanized_names); $i++) { $str .= "\n" . $this->romanized_names[$i]->to_gedcom($lvl2, $ver); } } return $ged_rec; }