familytree365 /
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 Xiang Ming <[email protected]> |
||||
| 9 | * @copyright Copyright (c) 2010-2013, Xiang Ming |
||||
| 10 | * @license MIT |
||||
| 11 | * |
||||
| 12 | * @link http://github.com/mrkrstphr/php-gedcom |
||||
| 13 | */ |
||||
| 14 | |||||
| 15 | namespace Gedcom\Writer\Head; |
||||
| 16 | |||||
| 17 | class Sour |
||||
| 18 | { |
||||
| 19 | /** |
||||
| 20 | * @param string $format |
||||
| 21 | * @param int $level |
||||
| 22 | * |
||||
| 23 | * @return string |
||||
| 24 | */ |
||||
| 25 | public static function convert(\Gedcom\Record\Head\Sour &$sour, $level) |
||||
| 26 | { |
||||
| 27 | $output = ''; |
||||
| 28 | $_sour = $sour->getSour(); |
||||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||||
| 29 | if ($_sour) { |
||||
| 30 | $output .= $level.' SOUR '.$_sour."\n"; |
||||
|
0 ignored issues
–
show
Are you sure
$_sour of type Gedcom\Record\Head\Sour|mixed can be used in concatenation?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
| 31 | } else { |
||||
| 32 | return $output; |
||||
| 33 | } |
||||
| 34 | |||||
| 35 | // level up |
||||
| 36 | $level++; |
||||
| 37 | |||||
| 38 | // VERS |
||||
| 39 | $vers = $sour->getVersion(); |
||||
| 40 | if ($vers) { |
||||
|
0 ignored issues
–
show
|
|||||
| 41 | $output .= $level.' VERS '.$vers."\n"; |
||||
| 42 | } |
||||
| 43 | |||||
| 44 | // NAME |
||||
| 45 | $name = $sour->getName(); |
||||
| 46 | if ($name) { |
||||
|
0 ignored issues
–
show
|
|||||
| 47 | $output .= $level.' NAME '.$name."\n"; |
||||
| 48 | } |
||||
| 49 | |||||
| 50 | // CORP |
||||
| 51 | $corp = $sour->getCorp(); |
||||
| 52 | if ($corp) { |
||||
|
0 ignored issues
–
show
|
|||||
| 53 | $_convert = \Gedcom\Writer\Head\Sour\Corp::convert($corp, $level); |
||||
| 54 | $output .= $_convert; |
||||
| 55 | } |
||||
| 56 | |||||
| 57 | // DATA |
||||
| 58 | $data = $sour->getData(); |
||||
| 59 | if ($data) { |
||||
|
0 ignored issues
–
show
|
|||||
| 60 | $_convert = \Gedcom\Writer\Head\Sour\Data::convert($data, $level); |
||||
| 61 | $output .= $_convert; |
||||
| 62 | } |
||||
| 63 | |||||
| 64 | return $output; |
||||
| 65 | } |
||||
| 66 | } |
||||
| 67 |