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 PhpGedcom\Writer; |
||||||
16 | |||||||
17 | class Obje |
||||||
18 | { |
||||||
19 | /** |
||||||
20 | * @param \PhpGedcom\Record\Obje $sour |
||||||
21 | * @param int $level |
||||||
22 | * |
||||||
23 | * @return string |
||||||
24 | */ |
||||||
25 | public static function convert(\PhpGedcom\Record\Obje &$obje) |
||||||
26 | { |
||||||
27 | $level = 0; |
||||||
28 | $output = ''; |
||||||
29 | $id = $obje->getId(); |
||||||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||||||
30 | if ($id) { |
||||||
31 | $output .= $level.' '.$id." OBJE\n"; |
||||||
0 ignored issues
–
show
Are you sure
$id of type PhpGedcom\Record\Obje|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
![]() |
|||||||
32 | } else { |
||||||
33 | return $output; |
||||||
34 | } |
||||||
35 | |||||||
36 | // level up |
||||||
37 | $level++; |
||||||
38 | |||||||
39 | // FORM |
||||||
40 | $form = $obje->getName(); |
||||||
0 ignored issues
–
show
The method
getName() does not exist on PhpGedcom\Record\Obje . 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
![]() |
|||||||
41 | if ($form) { |
||||||
42 | $output .= $level.' FORM '.$form."\n"; |
||||||
0 ignored issues
–
show
Are you sure
$form of type PhpGedcom\Record\Obje|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
![]() |
|||||||
43 | } |
||||||
44 | |||||||
45 | // TITL |
||||||
46 | $titl = $obje->getTitl(); |
||||||
0 ignored issues
–
show
The method
getTitl() does not exist on PhpGedcom\Record\Obje . 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
![]() |
|||||||
47 | if ($titl) { |
||||||
48 | $output .= $level.' TITL '.$titl."\n"; |
||||||
0 ignored issues
–
show
Are you sure
$titl of type PhpGedcom\Record\Obje|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
![]() |
|||||||
49 | } |
||||||
50 | |||||||
51 | // OBJE |
||||||
52 | // This is same as FORM |
||||||
53 | |||||||
54 | // RIN |
||||||
55 | $rin = $obje->getRin(); |
||||||
0 ignored issues
–
show
The method
getRin() does not exist on PhpGedcom\Record\Obje . 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
![]() |
|||||||
56 | if ($rin) { |
||||||
57 | $output .= $level.' RIN '.$rin."\n"; |
||||||
0 ignored issues
–
show
Are you sure
$rin of type PhpGedcom\Record\Obje|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
![]() |
|||||||
58 | } |
||||||
59 | |||||||
60 | // REFN |
||||||
61 | $refn = $obje->getRefn(); |
||||||
0 ignored issues
–
show
The method
getRefn() does not exist on PhpGedcom\Record\Obje . 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
![]() |
|||||||
62 | if (!empty($refn) && count($refn) > 0) { |
||||||
0 ignored issues
–
show
It seems like
$refn can also be of type PhpGedcom\Record\Obje ; however, parameter $var 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
![]() |
|||||||
63 | foreach ($refn as $item) { |
||||||
64 | if ($item) { |
||||||
65 | $_convert = \PhpGedcom\Writer\Refn::convert($item, $level); |
||||||
66 | $output .= $_convert; |
||||||
67 | } |
||||||
68 | } |
||||||
69 | } |
||||||
70 | |||||||
71 | // BLOB |
||||||
72 | $blob = $obje->getBlob(); |
||||||
0 ignored issues
–
show
The method
getBlob() does not exist on PhpGedcom\Record\Obje . 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
![]() |
|||||||
73 | if ($blob) { |
||||||
74 | $output .= $level.' BLOB '.$blob."\n"; |
||||||
0 ignored issues
–
show
Are you sure
$blob of type PhpGedcom\Record\Obje|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
![]() |
|||||||
75 | } |
||||||
76 | |||||||
77 | // NOTE |
||||||
78 | $note = $obje->getNote(); |
||||||
0 ignored issues
–
show
The method
getNote() does not exist on PhpGedcom\Record\Obje . 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
![]() |
|||||||
79 | if ($note && count($note) > 0) { |
||||||
80 | foreach ($note as $item) { |
||||||
81 | if ($item) { |
||||||
82 | $_convert = \PhpGedcom\Writer\NoteRef::convert($item, $level); |
||||||
83 | $output .= $_convert; |
||||||
84 | } |
||||||
85 | } |
||||||
86 | } |
||||||
87 | |||||||
88 | // CHAN |
||||||
89 | $chan = $obje->getChan(); |
||||||
0 ignored issues
–
show
The method
getChan() does not exist on PhpGedcom\Record\Obje . 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
![]() |
|||||||
90 | if ($chan) { |
||||||
91 | $_convert = \PhpGedcom\Writer\Chan::convert($chan, $level); |
||||||
0 ignored issues
–
show
It seems like
$chan can also be of type PhpGedcom\Record\Obje ; however, parameter $chan of PhpGedcom\Writer\Chan::convert() does only seem to accept PhpGedcom\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
![]() |
|||||||
92 | $output .= $_convert; |
||||||
93 | } |
||||||
94 | |||||||
95 | // FILE |
||||||
96 | $file = $obje->getFile(); |
||||||
0 ignored issues
–
show
The method
getFile() does not exist on PhpGedcom\Record\Obje . 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
![]() |
|||||||
97 | if ($file) { |
||||||
98 | $output .= $level.' FILE '.$file."\n"; |
||||||
0 ignored issues
–
show
Are you sure
$file of type PhpGedcom\Record\Obje|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
![]() |
|||||||
99 | } |
||||||
100 | |||||||
101 | // |
||||||
102 | return $output; |
||||||
103 | } |
||||||
104 | } |
||||||
105 |