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 Gedcom\Parser\Head; |
||
16 | |||
17 | class Plac extends \Gedcom\Parser\Component |
||
18 | { |
||
19 | public static function parse(\Gedcom\Parser $parser) |
||
20 | { |
||
21 | $record = $parser->getCurrentLineRecord(); |
||
22 | $depth = (int) $record[0]; |
||
23 | |||
24 | $plac = new \Gedcom\Record\Head\Plac(); |
||
25 | |||
26 | $parser->forward(); |
||
27 | |||
28 | while (!$parser->eof()) { |
||
29 | $record = $parser->getCurrentLineRecord(); |
||
30 | $recordType = strtoupper(trim($record[1])); |
||
31 | $currentDepth = (int) $record[0]; |
||
32 | |||
33 | if ($currentDepth <= $depth) { |
||
34 | $parser->back(); |
||
35 | break; |
||
36 | } |
||
37 | |||
38 | switch ($recordType) { |
||
39 | case 'FORM': |
||
40 | $plac->setForm(trim($record[2])); |
||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||
41 | break; |
||
42 | default: |
||
43 | $parser->logUnhandledRecord(self::class.' @ '.__LINE__); |
||
44 | } |
||
45 | |||
46 | $parser->forward(); |
||
47 | } |
||
48 | |||
49 | return $plac; |
||
50 | } |
||
51 | } |
||
52 |