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\Sour; |
||||||
16 | |||||||
17 | class Data 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 | $data = new \Gedcom\Record\Sour\Data(); |
||||||
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 'EVEN': |
||||||
40 | $data->addEven(\Gedcom\Parser\Sour\Data\Even::parse($parser)); |
||||||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||||||
41 | break; |
||||||
42 | case 'DATE': // not in 5.5.1 |
||||||
43 | $data->setDate(trim($record[2])); |
||||||
0 ignored issues
–
show
The method
setDate() does not exist on Gedcom\Record\Sour\Data . 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
![]() |
|||||||
44 | break; |
||||||
45 | case 'AGNC': |
||||||
46 | $data->setAgnc(trim($record[2])); |
||||||
0 ignored issues
–
show
The method
setAgnc() does not exist on Gedcom\Record\Sour\Data . 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 | break; |
||||||
48 | case 'NOTE': |
||||||
49 | $note = \Gedcom\Parser\NoteRef::parse($parser); |
||||||
50 | if ($note) { |
||||||
51 | $data->addNote($note); |
||||||
52 | } |
||||||
53 | break; |
||||||
54 | case 'TEXT': // not in 5.5.1 |
||||||
55 | $data->setText($parser->parseMultiLineRecord()); |
||||||
0 ignored issues
–
show
The method
setText() does not exist on Gedcom\Record\Sour\Data . 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 | break; |
||||||
57 | default: |
||||||
58 | $parser->logUnhandledRecord(self::class.' @ '.__LINE__); |
||||||
59 | } |
||||||
60 | |||||||
61 | $parser->forward(); |
||||||
62 | } |
||||||
63 | |||||||
64 | return $data; |
||||||
65 | } |
||||||
66 | } |
||||||
67 |