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; |
||||||
16 | |||||||
17 | class NoteRef 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 | $note = new \Gedcom\Record\NoteRef(); |
||||||
25 | |||||||
26 | if (count($record) < 3) { |
||||||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||||||
27 | $parser->logSkippedRecord('Missing note information; '.self::class, ' @ '.__LINE__); |
||||||
0 ignored issues
–
show
The call to
Gedcom\Parser::logSkippedRecord() has too many arguments starting with ' @ ' . __LINE__ .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue. If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above. ![]() |
|||||||
28 | $parser->skipToNextLevel($depth); |
||||||
29 | |||||||
30 | return null; |
||||||
31 | } |
||||||
32 | |||||||
33 | if (preg_match('/^@(.*)@$/', trim($record[2]))) { |
||||||
34 | $note->setIsReference(true); |
||||||
35 | $note->setNote($parser->normalizeIdentifier($record[2])); |
||||||
0 ignored issues
–
show
The method
setNote() does not exist on Gedcom\Record\NoteRef . 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
![]() |
|||||||
36 | } else { |
||||||
37 | $parser->getCurrentLine(); |
||||||
38 | $note->setIsReference(false); |
||||||
39 | $note->setNote($parser->parseMultiLineRecord()); |
||||||
40 | } |
||||||
41 | |||||||
42 | $parser->forward(); |
||||||
43 | |||||||
44 | while (!$parser->eof()) { |
||||||
45 | $record = $parser->getCurrentLineRecord(); |
||||||
46 | $recordType = strtoupper(trim($record[1])); |
||||||
47 | $currentDepth = (int) $record[0]; |
||||||
48 | |||||||
49 | if ($currentDepth <= $depth) { |
||||||
50 | $parser->back(); |
||||||
51 | break; |
||||||
52 | } |
||||||
53 | |||||||
54 | switch ($recordType) { |
||||||
55 | case 'SOUR': |
||||||
56 | $sour = \Gedcom\Parser\SourRef::parse($parser); |
||||||
57 | $note->addSour($sour); |
||||||
58 | break; |
||||||
59 | default: |
||||||
60 | $parser->logUnhandledRecord(self::class.' @ '.__LINE__); |
||||||
61 | } |
||||||
62 | |||||||
63 | $parser->forward(); |
||||||
64 | } |
||||||
65 | |||||||
66 | return $note; |
||||||
67 | } |
||||||
68 | } |
||||||
69 |