modularsoftware /
php-gedcom
| 1 | <?php |
||||
| 2 | /** |
||||
| 3 | * php-gedcom. |
||||
| 4 | * |
||||
| 5 | * php-gedcom is a library for parsing, manipulating, importing and exporting |
||||
| 6 | * GEDCOM 5.5 files in PHP 5.3+. |
||||
| 7 | * |
||||
| 8 | * @author Kristopher Wilson <[email protected]> |
||||
| 9 | * @copyright Copyright (c) 2010-2013, Kristopher Wilson |
||||
| 10 | * @license MIT |
||||
| 11 | * |
||||
| 12 | * @link http://github.com/mrkrstphr/php-gedcom |
||||
| 13 | */ |
||||
| 14 | |||||
| 15 | namespace PhpGedcom\Writer; |
||||
| 16 | |||||
| 17 | class Head |
||||
| 18 | { |
||||
| 19 | /** |
||||
| 20 | * @param \PhpGedcom\Record\Head $head |
||||
| 21 | * @param string $format |
||||
| 22 | * |
||||
| 23 | * @return string |
||||
| 24 | */ |
||||
| 25 | public static function convert(\PhpGedcom\Record\Head &$head, $format = self::GEDCOM55) |
||||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
The parameter
$format is not used and could be removed.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for parameters that have been defined for a function or method, but which are not used in the method body. Loading history...
|
|||||
| 26 | { |
||||
| 27 | $level = 0; |
||||
| 28 | $output = $level." HEAD\n"; |
||||
| 29 | |||||
| 30 | // level up |
||||
| 31 | $level++; |
||||
| 32 | |||||
| 33 | //SOUR |
||||
| 34 | $sour = $head->getSour(); |
||||
| 35 | if ($sour) { |
||||
|
0 ignored issues
–
show
|
|||||
| 36 | $_convert = \PhpGedcom\Writer\Head\Sour::convert($sour, $level); |
||||
| 37 | $output .= $_convert; |
||||
| 38 | } |
||||
| 39 | |||||
| 40 | // DEST |
||||
| 41 | $dest = $head->getDest(); |
||||
| 42 | if ($dest) { |
||||
| 43 | $output .= $level.' DEST '.$dest."\n"; |
||||
| 44 | } |
||||
| 45 | |||||
| 46 | //Subm |
||||
| 47 | $subm = $head->getSubm(); |
||||
| 48 | if ($subm) { |
||||
| 49 | $output .= $level.' SUBM '.$subm."\n"; |
||||
| 50 | } |
||||
| 51 | |||||
| 52 | // SUBN |
||||
| 53 | $subn = $head->getSubn(); |
||||
| 54 | if ($subn) { |
||||
| 55 | $output .= $level.' SUBN '.$subn."\n"; |
||||
| 56 | } |
||||
| 57 | |||||
| 58 | // FILE |
||||
| 59 | $file = $head->getFile(); |
||||
| 60 | if ($file) { |
||||
| 61 | $output .= $level.' FILE '.$file."\n"; |
||||
| 62 | } |
||||
| 63 | |||||
| 64 | // COPR |
||||
| 65 | $copr = $head->getCopr(); |
||||
| 66 | if ($copr) { |
||||
| 67 | $output .= $level.' COPR '.$copr."\n"; |
||||
| 68 | } |
||||
| 69 | |||||
| 70 | // LANG |
||||
| 71 | $lang = $head->getLang(); |
||||
| 72 | if ($lang) { |
||||
| 73 | $output .= $level.' LANG '.$lang."\n"; |
||||
| 74 | } |
||||
| 75 | // DATE |
||||
| 76 | $date = $head->getDate(); |
||||
| 77 | if ($date) { |
||||
|
0 ignored issues
–
show
|
|||||
| 78 | $_convert = \PhpGedcom\Writer\Head\Date::convert($date, $level); |
||||
| 79 | $output .= $_convert; |
||||
| 80 | } |
||||
| 81 | |||||
| 82 | // GEDC |
||||
| 83 | $gedc = $head->getGedc(); |
||||
| 84 | if ($gedc) { |
||||
|
0 ignored issues
–
show
|
|||||
| 85 | $_convert = \PhpGedcom\Writer\Head\Gedc::convert($gedc, $level); |
||||
| 86 | $output .= $_convert; |
||||
| 87 | } |
||||
| 88 | |||||
| 89 | // CHAR |
||||
| 90 | $char = $head->getChar(); |
||||
| 91 | if ($char) { |
||||
|
0 ignored issues
–
show
|
|||||
| 92 | $_convert = \PhpGedcom\Writer\Head\Char::convert($char, $level); |
||||
| 93 | $output .= $_convert; |
||||
| 94 | } |
||||
| 95 | // PLAC |
||||
| 96 | $plac = $head->getPlac(); |
||||
| 97 | if ($plac) { |
||||
|
0 ignored issues
–
show
|
|||||
| 98 | $_convert = \PhpGedcom\Writer\Head\Plac::convert($plac, $level); |
||||
| 99 | $output .= $_convert; |
||||
| 100 | } |
||||
| 101 | |||||
| 102 | // NOTE |
||||
| 103 | $note = $head->getNote(); |
||||
| 104 | if ($note) { |
||||
| 105 | $output .= $level.' NOTE '.$note."\n"; |
||||
| 106 | } |
||||
| 107 | // |
||||
| 108 | /* |
||||
| 109 | +1 SUBM @<XREF:SUBM>@ {1:1} |
||||
| 110 | +1 SUBN @<XREF:SUBN>@ {0:1} |
||||
| 111 | +1 FILE <FILE_NAME> {0:1} |
||||
| 112 | +1 COPR <COPYRIGHT_GEDCOM_FILE> {0:1} |
||||
| 113 | +1 GEDC {1:1} |
||||
| 114 | +2 VERS <VERSION_NUMBER> {1:1} |
||||
| 115 | +2 FORM <GEDCOM_FORM> {1:1} |
||||
| 116 | +1 CHAR <CHARACTER_SET> {1:1} |
||||
| 117 | +2 VERS <VERSION_NUMBER> {0:1} |
||||
| 118 | +1 LANG <LANGUAGE_OF_TEXT> {0:1} |
||||
| 119 | +1 PLAC {0:1} |
||||
| 120 | +2 FORM <PLACE_HIERARCHY> {1:1} |
||||
| 121 | +1 NOTE <GEDCOM_CONTENT_DESCRIPTION> {0:1} |
||||
| 122 | +2 [CONT|CONC] <GEDCOM_CONTENT_DESCRIPTION> {0:M} |
||||
| 123 | */ |
||||
| 124 | |||||
| 125 | return $output; |
||||
| 126 | } |
||||
| 127 | } |
||||
| 128 |