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 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 Gedcom\Writer; |
||||||
| 16 | |||||||
| 17 | class Note |
||||||
| 18 | { |
||||||
| 19 | /** |
||||||
| 20 | * @param \Gedcom\Record\Note $sour |
||||||
| 21 | * @param int $level |
||||||
| 22 | * |
||||||
| 23 | * @return string |
||||||
| 24 | */ |
||||||
| 25 | public static function convert(\Gedcom\Record\Note &$note) |
||||||
| 26 | { |
||||||
| 27 | $level = 0; |
||||||
| 28 | $output = ''; |
||||||
| 29 | $id = $note->getId(); |
||||||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||||||
| 30 | if (!empty($id)) { |
||||||
| 31 | $output .= $level.' '.$id.' '." NOTE \n"; |
||||||
|
0 ignored issues
–
show
Are you sure
$id of type Gedcom\Record\Note|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...
|
|||||||
| 32 | } else { |
||||||
| 33 | return $output; |
||||||
| 34 | } |
||||||
| 35 | |||||||
| 36 | // Level Up |
||||||
| 37 | $level++; |
||||||
| 38 | // RIN |
||||||
| 39 | $rin = $note->getRin(); |
||||||
|
0 ignored issues
–
show
The method
getRin() does not exist on Gedcom\Record\Note. 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...
|
|||||||
| 40 | if ($rin) { |
||||||
| 41 | $output .= $level.' RIN '.$rin."\n"; |
||||||
|
0 ignored issues
–
show
Are you sure
$rin of type Gedcom\Record\Note|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...
|
|||||||
| 42 | } |
||||||
| 43 | |||||||
| 44 | // cont |
||||||
| 45 | $cont = $note->getNote(); |
||||||
|
0 ignored issues
–
show
The method
getNote() does not exist on Gedcom\Record\Note. 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...
|
|||||||
| 46 | if ($cont) { |
||||||
| 47 | $output .= $level.' CONT '.$cont."\n"; |
||||||
|
0 ignored issues
–
show
Are you sure
$cont of type Gedcom\Record\Note|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...
|
|||||||
| 48 | } |
||||||
| 49 | |||||||
| 50 | // REFN |
||||||
| 51 | $refn = $note->getRefn(); |
||||||
|
0 ignored issues
–
show
The method
getRefn() does not exist on Gedcom\Record\Note. 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...
|
|||||||
| 52 | if (!empty($refn) && count($refn) > 0) { |
||||||
|
0 ignored issues
–
show
It seems like
$refn can also be of type Gedcom\Record\Note; 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...
|
|||||||
| 53 | foreach ($refn as $item) { |
||||||
| 54 | if ($item) { |
||||||
| 55 | $_convert = \Gedcom\Writer\Refn::convert($item, $level); |
||||||
| 56 | $output .= $_convert; |
||||||
| 57 | } |
||||||
| 58 | } |
||||||
| 59 | } |
||||||
| 60 | // CHAN |
||||||
| 61 | $chan = $note->getChan(); |
||||||
|
0 ignored issues
–
show
The method
getChan() does not exist on Gedcom\Record\Note. 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...
|
|||||||
| 62 | if ($chan) { |
||||||
| 63 | $_convert = \Gedcom\Writer\Chan::convert($chan, $level); |
||||||
|
0 ignored issues
–
show
It seems like
$chan can also be of type Gedcom\Record\Note; however, parameter $chan of Gedcom\Writer\Chan::convert() does only seem to accept Gedcom\Record\Chan, 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...
|
|||||||
| 64 | $output .= $_convert; |
||||||
| 65 | } |
||||||
| 66 | |||||||
| 67 | // SOUR array |
||||||
| 68 | $sour = $note->getSour(); |
||||||
|
0 ignored issues
–
show
The method
getSour() does not exist on Gedcom\Record\Note. 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...
|
|||||||
| 69 | if (!empty($sour) && count($sour) > 0) { |
||||||
| 70 | foreach ($sour as $item) { |
||||||
| 71 | if ($item) { |
||||||
| 72 | $_convert = \Gedcom\Writer\SourRef::convert($item, $level); |
||||||
| 73 | $output .= $_convert; |
||||||
| 74 | } |
||||||
| 75 | } |
||||||
| 76 | } |
||||||
| 77 | |||||||
| 78 | return $output; |
||||||
| 79 | } |
||||||
| 80 | } |
||||||
| 81 |