genealogiawebsite /
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 Kristopher Wilson <[email protected]> |
||||||
| 9 | * @copyright Copyright (c) 2010-2013, Kristopher Wilson |
||||||
| 10 | * @license MIT |
||||||
| 11 | * |
||||||
| 12 | * @link http://github.com/mrkrstphr/php-gedcom |
||||||
| 13 | */ |
||||||
| 14 | |||||||
| 15 | namespace PhpGedcom\Parser; |
||||||
| 16 | |||||||
| 17 | class Plac extends \PhpGedcom\Parser\Component |
||||||
| 18 | { |
||||||
| 19 | public static function parse(\PhpGedcom\Parser $parser) |
||||||
| 20 | { |
||||||
| 21 | $record = $parser->getCurrentLineRecord(); |
||||||
| 22 | $depth = (int) $record[0]; |
||||||
| 23 | if (isset($record[2])) { |
||||||
| 24 | $_plac = trim($record[2]); |
||||||
| 25 | } else { |
||||||
| 26 | $parser->skipToNextLevel($depth); |
||||||
| 27 | |||||||
| 28 | return null; |
||||||
| 29 | } |
||||||
| 30 | |||||||
| 31 | $plac = new \PhpGedcom\Record\Plac(); |
||||||
| 32 | $plac->setPlac($_plac); |
||||||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||||||
| 33 | |||||||
| 34 | $parser->forward(); |
||||||
| 35 | |||||||
| 36 | while (!$parser->eof()) { |
||||||
| 37 | $record = $parser->getCurrentLineRecord(); |
||||||
| 38 | $currentDepth = (int) $record[0]; |
||||||
| 39 | $recordType = strtoupper(trim($record[1])); |
||||||
| 40 | |||||||
| 41 | if ($currentDepth <= $depth) { |
||||||
| 42 | $parser->back(); |
||||||
| 43 | break; |
||||||
| 44 | } |
||||||
| 45 | |||||||
| 46 | switch ($recordType) { |
||||||
| 47 | case 'FORM': |
||||||
| 48 | $plac->setForm(trim($record[2])); |
||||||
|
0 ignored issues
–
show
The method
setForm() does not exist on PhpGedcom\Record\Plac. 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...
|
|||||||
| 49 | break; |
||||||
| 50 | case 'FONE': |
||||||
| 51 | $fone = \PhpGedcom\Parser\Plac\Fone::parse($parser); |
||||||
| 52 | $plac->setFone($fone); |
||||||
|
0 ignored issues
–
show
The method
setFone() does not exist on PhpGedcom\Record\Plac. 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...
|
|||||||
| 53 | break; |
||||||
| 54 | case 'ROMN': |
||||||
| 55 | $romn = \PhpGedcom\Parser\Plac\Romn::parse($parser); |
||||||
| 56 | $plac->setRomn($romn); |
||||||
|
0 ignored issues
–
show
The method
setRomn() does not exist on PhpGedcom\Record\Plac. 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...
|
|||||||
| 57 | break; |
||||||
| 58 | case 'NOTE': |
||||||
| 59 | if ($note = \PhpGedcom\Parser\NoteRef::parse($parser)) { |
||||||
| 60 | $plac->addNote($note); |
||||||
| 61 | } |
||||||
| 62 | break; |
||||||
| 63 | case 'MAP': |
||||||
| 64 | $map = \PhpGedcom\Parser\Plac\Map::parse($parser); |
||||||
| 65 | $plac->setMap($map); |
||||||
|
0 ignored issues
–
show
The method
setMap() does not exist on PhpGedcom\Record\Plac. 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...
|
|||||||
| 66 | break; |
||||||
| 67 | default: |
||||||
| 68 | $parser->logUnhandledRecord(get_class().' @ '.__LINE__); |
||||||
| 69 | } |
||||||
| 70 | |||||||
| 71 | $parser->forward(); |
||||||
| 72 | } |
||||||
| 73 | |||||||
| 74 | return $plac; |
||||||
| 75 | } |
||||||
| 76 | } |
||||||
| 77 |