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\Indi; |
||||||
| 16 | |||||||
| 17 | class Fams |
||||||
| 18 | { |
||||||
| 19 | /** |
||||||
| 20 | * @param \Gedcom\Record\Indi\Fams $attr |
||||||
| 21 | * @param int $level |
||||||
| 22 | * |
||||||
| 23 | * @return string |
||||||
| 24 | */ |
||||||
| 25 | public static function convert(\Gedcom\Record\Indi\Fams &$fams, $level = 0) |
||||||
| 26 | { |
||||||
| 27 | $output = ''; |
||||||
| 28 | // NAME |
||||||
| 29 | $_fams = $fams->getFams(); |
||||||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||||||
| 30 | if (empty($_fams)) { |
||||||
| 31 | return $output; |
||||||
| 32 | } |
||||||
| 33 | $output .= $level.' FAMS @'.$_fams."@\n"; |
||||||
|
0 ignored issues
–
show
Are you sure
$_fams of type Gedcom\Record\Indi\Fams|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...
|
|||||||
| 34 | // level up |
||||||
| 35 | $level++; |
||||||
| 36 | |||||||
| 37 | // note |
||||||
| 38 | $note = $fams->getNote(); |
||||||
|
0 ignored issues
–
show
The method
getNote() does not exist on Gedcom\Record\Indi\Fams. 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...
|
|||||||
| 39 | if (!empty($note) && count($note) > 0) { |
||||||
|
0 ignored issues
–
show
It seems like
$note can also be of type Gedcom\Record\Indi\Fams; 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...
|
|||||||
| 40 | foreach ($note as $item) { |
||||||
| 41 | $_convert = \Gedcom\Writer\NoteRef::convert($item, $level); |
||||||
| 42 | $output .= $_convert; |
||||||
| 43 | } |
||||||
| 44 | } |
||||||
| 45 | |||||||
| 46 | return $output; |
||||||
| 47 | } |
||||||
| 48 | } |
||||||
| 49 |