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