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 Asso |
||||||
18 | { |
||||||
19 | /** |
||||||
20 | * @param \Gedcom\Record\Indi\Asso $attr |
||||||
21 | * @param int $level |
||||||
22 | * |
||||||
23 | * @return string |
||||||
24 | */ |
||||||
25 | public static function convert(\Gedcom\Record\Indi\Asso &$asso, $level = 0) |
||||||
26 | { |
||||||
27 | $output = ''; |
||||||
28 | // _indi |
||||||
29 | $_indi = $asso->getIndi(); |
||||||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||||||
30 | if (empty($_indi)) { |
||||||
31 | return $output; |
||||||
32 | } |
||||||
33 | $output .= $level.' ASSO '.$_indi."\n"; |
||||||
0 ignored issues
–
show
Are you sure
$_indi of type Gedcom\Record\Indi\Asso|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
![]() |
|||||||
34 | // level up |
||||||
35 | $level++; |
||||||
36 | |||||||
37 | // RELA |
||||||
38 | $rela = $asso->getRela(); |
||||||
0 ignored issues
–
show
The method
getRela() does not exist on Gedcom\Record\Indi\Asso . 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
![]() |
|||||||
39 | if (!empty($rela)) { |
||||||
40 | $output .= $level.' RELA '.$rela."\n"; |
||||||
0 ignored issues
–
show
Are you sure
$rela of type Gedcom\Record\Indi\Asso|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
![]() |
|||||||
41 | } |
||||||
42 | // sour |
||||||
43 | $sour = $asso->getSour(); |
||||||
0 ignored issues
–
show
The method
getSour() does not exist on Gedcom\Record\Indi\Asso . 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
![]() |
|||||||
44 | if (!empty($sour) && count($sour) > 0) { |
||||||
0 ignored issues
–
show
It seems like
$sour can also be of type Gedcom\Record\Indi\Asso ; 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
![]() |
|||||||
45 | foreach ($sour as $item) { |
||||||
46 | $_convert = \Gedcom\Writer\SourRef::convert($item, $level); |
||||||
47 | $output .= $_convert; |
||||||
48 | } |
||||||
49 | } |
||||||
50 | |||||||
51 | // note |
||||||
52 | $note = $asso->getSour(); |
||||||
53 | if (!empty($note) && count($note) > 0) { |
||||||
54 | foreach ($note as $item) { |
||||||
55 | $_convert = \Gedcom\Writer\NoteRef::convert($item, $level); |
||||||
56 | $output .= $_convert; |
||||||
57 | } |
||||||
58 | } |
||||||
59 | |||||||
60 | return $output; |
||||||
61 | } |
||||||
62 | } |
||||||
63 |