Issues (384)

src/Parser/SourRef/Data.php (2 issues)

Labels
Severity
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\SourRef;
16
17
class Data extends \Gedcom\Parser\Component
18
{
19
    public static function parse(\Gedcom\Parser $parser)
20
    {
21
        $data = new \Gedcom\Record\SourRef\Data();
22
        $record = $parser->getCurrentLineRecord();
23
        $depth = (int) $record[0];
24
25
        $parser->forward();
26
27
        while (!$parser->eof()) {
28
            $record = $parser->getCurrentLineRecord();
29
            $recordType = strtoupper(trim($record[1]));
30
            $currentDepth = (int) $record[0];
31
32
            if ($currentDepth <= $depth) {
33
                $parser->back();
34
                break;
35
            }
36
37
            switch ($recordType) {
38
                case 'DATE':
39
                    $data->setDate(trim($record[2]));
0 ignored issues
show
The method setDate() does not exist on Gedcom\Record\SourRef\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 ignore-call  annotation

39
                    $data->/** @scrutinizer ignore-call */ 
40
                           setDate(trim($record[2]));
Loading history...
40
                    break;
41
                case 'TEXT':
42
                    $data->setText($parser->parseMultiLineRecord());
0 ignored issues
show
The method setText() does not exist on Gedcom\Record\SourRef\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 ignore-call  annotation

42
                    $data->/** @scrutinizer ignore-call */ 
43
                           setText($parser->parseMultiLineRecord());
Loading history...
43
                    break;
44
                default:
45
                    $parser->logUnhandledRecord(self::class.' @ '.__LINE__);
46
            }
47
48
            $parser->forward();
49
        }
50
51
        return $data;
52
    }
53
}
54