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\Sour; |
||||||
| 16 | |||||||
| 17 | class Data |
||||||
| 18 | { |
||||||
| 19 | /** |
||||||
| 20 | * @param int $level |
||||||
| 21 | * |
||||||
| 22 | * @return string |
||||||
| 23 | */ |
||||||
| 24 | public static function convert(\Gedcom\Record\Sour\Data &$data, $level = 0) |
||||||
| 25 | { |
||||||
| 26 | $output = $level." DATA\n"; |
||||||
| 27 | $level++; |
||||||
| 28 | |||||||
| 29 | // $_date; |
||||||
| 30 | $date = $data->getDate(); |
||||||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||||||
| 31 | if (!empty($date)) { |
||||||
| 32 | $output .= $level.' DATE '.$date."\n"; |
||||||
|
0 ignored issues
–
show
Are you sure
$date of type Gedcom\Record\Sour\Data|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...
|
|||||||
| 33 | } |
||||||
| 34 | |||||||
| 35 | // $_agnc AGNC |
||||||
| 36 | $_agnc = $data->getAgnc(); |
||||||
|
0 ignored issues
–
show
The method
getAgnc() does not exist on Gedcom\Record\Sour\Data. Since you implemented __call, consider adding a @method annotation.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 37 | if (!empty($_agnc)) { |
||||||
| 38 | $output .= $level.' AGNC '.$_agnc."\n"; |
||||||
|
0 ignored issues
–
show
Are you sure
$_agnc of type Gedcom\Record\Sour\Data|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...
|
|||||||
| 39 | } |
||||||
| 40 | |||||||
| 41 | // $_text |
||||||
| 42 | $_text = $data->getText(); |
||||||
|
0 ignored issues
–
show
The method
getText() does not exist on Gedcom\Record\Sour\Data. Since you implemented __call, consider adding a @method annotation.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 43 | if (!empty($_text)) { |
||||||
| 44 | $output .= $level.' TEXT '.$_text."\n"; |
||||||
|
0 ignored issues
–
show
Are you sure
$_text of type Gedcom\Record\Sour\Data|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...
|
|||||||
| 45 | } |
||||||
| 46 | |||||||
| 47 | // $_note |
||||||
| 48 | $note = $data->getNote(); |
||||||
|
0 ignored issues
–
show
The method
getNote() does not exist on Gedcom\Record\Sour\Data. Since you implemented __call, consider adding a @method annotation.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 49 | if ($note && count($note) > 0) { |
||||||
|
0 ignored issues
–
show
It seems like
$note can also be of type Gedcom\Record\Sour\Data; however, parameter $value of count() does only seem to accept Countable|array, maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 50 | foreach ($note as $item) { |
||||||
| 51 | $_convert = \Gedcom\Writer\NoteRef::convert($item, $level); |
||||||
| 52 | $output .= $_convert; |
||||||
| 53 | } |
||||||
| 54 | } |
||||||
| 55 | |||||||
| 56 | // $_even |
||||||
| 57 | $_even = $data->getEven(); |
||||||
|
0 ignored issues
–
show
The method
getEven() does not exist on Gedcom\Record\Sour\Data. Since you implemented __call, consider adding a @method annotation.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 58 | if ($_even && count($_even) > 0) { |
||||||
| 59 | foreach ($_even as $item) { |
||||||
| 60 | $_convert = \Gedcom\Writer\Sour\Data\Even::convert($item, $level); |
||||||
| 61 | $output .= $_convert; |
||||||
| 62 | } |
||||||
| 63 | } |
||||||
| 64 | |||||||
| 65 | return $output; |
||||||
| 66 | } |
||||||
| 67 | } |
||||||
| 68 |