Issues (384)

src/Parser/ObjeRef.php (3 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;
16
17
class ObjeRef 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
        $obje = new \Gedcom\Record\ObjeRef();
25
26
        if (isset($record[2])) {
27
            $obje->setIsReference(true);
28
            $obje->setObje($parser->normalizeIdentifier($record[2]));
0 ignored issues
show
The method setObje() does not exist on Gedcom\Record\ObjeRef. 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

28
            $obje->/** @scrutinizer ignore-call */ 
29
                   setObje($parser->normalizeIdentifier($record[2]));
Loading history...
29
        } else {
30
            $obje->setIsReference(false);
31
        }
32
33
        $parser->forward();
34
35
        while (!$parser->eof()) {
36
            $record = $parser->getCurrentLineRecord();
37
            $recordType = strtoupper(trim($record[1]));
38
            $currentDepth = (int) $record[0];
39
40
            if ($currentDepth <= $depth) {
41
                $parser->back();
42
                break;
43
            }
44
45
            switch ($recordType) {
46
                case 'TITL':
47
                    $obje->setTitl(trim($record[2]));
0 ignored issues
show
The method setTitl() does not exist on Gedcom\Record\ObjeRef. 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

47
                    $obje->/** @scrutinizer ignore-call */ 
48
                           setTitl(trim($record[2]));
Loading history...
48
                    break;
49
                case 'FILE':
50
                    $obje->setFile(\Gedcom\Parser\ObjeRef\File::parse($parser));
0 ignored issues
show
The method setFile() does not exist on Gedcom\Record\ObjeRef. 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

50
                    $obje->/** @scrutinizer ignore-call */ 
51
                           setFile(\Gedcom\Parser\ObjeRef\File::parse($parser));
Loading history...
51
                    break;
52
                default:
53
                    $parser->logUnhandledRecord(self::class.' @ '.__LINE__);
54
            }
55
56
            $parser->forward();
57
        }
58
59
        return $obje;
60
    }
61
}
62