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 ObjeRef |
||||||
18 | { |
||||||
19 | /** |
||||||
20 | * @param \PhpGedcom\Record\ObjeRef $note |
||||||
21 | * @param int $level |
||||||
22 | * |
||||||
23 | * @return string |
||||||
24 | */ |
||||||
25 | public static function convert(\PhpGedcom\Record\ObjeRef &$obje, $level) |
||||||
26 | { |
||||||
27 | $output = ''; |
||||||
28 | |||||||
29 | // $_note |
||||||
30 | $_obje = $obje->getObje(); |
||||||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||||||
31 | if (!empty($_note)) { |
||||||
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||||||
32 | $output .= $level.' OBJE '.$_obje."\n"; |
||||||
0 ignored issues
–
show
Are you sure
$_obje of type PhpGedcom\Record\ObjeRef|mixed|null 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
![]() |
|||||||
33 | } else { |
||||||
34 | $output .= $level." OBJE \n"; |
||||||
35 | } |
||||||
36 | |||||||
37 | $level++; |
||||||
38 | // _form |
||||||
39 | $_form = $obje->getForm(); |
||||||
0 ignored issues
–
show
The method
getForm() does not exist on PhpGedcom\Record\ObjeRef . 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
![]() |
|||||||
40 | if (!empty($_form)) { |
||||||
41 | $output .= $level.' FORM '.$_form."\n"; |
||||||
0 ignored issues
–
show
Are you sure
$_form of type PhpGedcom\Record\ObjeRef|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
![]() |
|||||||
42 | } |
||||||
43 | |||||||
44 | // _titl |
||||||
45 | $_titl = $obje->getTitl(); |
||||||
0 ignored issues
–
show
The method
getTitl() does not exist on PhpGedcom\Record\ObjeRef . 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
![]() |
|||||||
46 | if (!empty($_titl)) { |
||||||
47 | $output .= $level.' TITL '.$_titl."\n"; |
||||||
0 ignored issues
–
show
Are you sure
$_titl of type PhpGedcom\Record\ObjeRef|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
![]() |
|||||||
48 | } |
||||||
49 | |||||||
50 | // _file |
||||||
51 | $_file = $obje->getFile(); |
||||||
0 ignored issues
–
show
The method
getFile() does not exist on PhpGedcom\Record\ObjeRef . 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
![]() |
|||||||
52 | if (!empty($_file)) { |
||||||
53 | $output .= $level.' FILE '.$_file."\n"; |
||||||
0 ignored issues
–
show
Are you sure
$_file of type PhpGedcom\Record\ObjeRef|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
![]() |
|||||||
54 | } |
||||||
55 | |||||||
56 | // $_note = array() |
||||||
57 | $_note = $obje->getNote(); |
||||||
0 ignored issues
–
show
The method
getNote() does not exist on PhpGedcom\Record\ObjeRef . 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
![]() |
|||||||
58 | if (!empty($_note) && count($_note) > 0) { |
||||||
0 ignored issues
–
show
It seems like
$_note can also be of type PhpGedcom\Record\ObjeRef ; 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
![]() |
|||||||
59 | foreach ($_note as $item) { |
||||||
60 | $_convert = \PhpGedcom\Writer\NoteRef::convert($item, $level); |
||||||
61 | $output .= $_convert; |
||||||
62 | } |
||||||
63 | } |
||||||
64 | |||||||
65 | return $output; |
||||||
66 | } |
||||||
67 | } |
||||||
68 |