Issues (384)

src/Parser/RepoRef.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 RepoRef extends \Gedcom\Parser\Component
18
{
19
    public static function parse(\Gedcom\Parser $parser)
20
    {
21
        $record = $parser->getCurrentLineRecord();
22
        $depth = (int) $record[0];
23
        if (isset($record[2])) {
24
            $identifier = $parser->normalizeIdentifier($record[2]);
25
        } else {
26
            $parser->skipToNextLevel($depth);
27
28
            return null;
29
        }
30
31
        $repo = new \Gedcom\Record\RepoRef();
32
        $repo->setRepo($identifier);
0 ignored issues
show
The method setRepo() does not exist on Gedcom\Record\RepoRef. 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

32
        $repo->/** @scrutinizer ignore-call */ 
33
               setRepo($identifier);
Loading history...
33
34
        $parser->forward();
35
36
        while (!$parser->eof()) {
37
            $record = $parser->getCurrentLineRecord();
38
            $currentDepth = (int) $record[0];
39
            $recordType = strtoupper(trim($record[1]));
40
41
            if ($currentDepth <= $depth) {
42
                $parser->back();
43
                break;
44
            }
45
46
            switch ($recordType) {
47
                case 'CALN':
48
                    $repo->addCaln(\Parser\Caln::parse($parser));
0 ignored issues
show
The type Parser\Caln was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
The method addCaln() does not exist on Gedcom\Record\RepoRef. 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

48
                    $repo->/** @scrutinizer ignore-call */ 
49
                           addCaln(\Parser\Caln::parse($parser));
Loading history...
49
                    break;
50
                case 'NOTE':
51
                    $note = \Gedcom\Parser\NoteRef::parse($parser);
52
                    if ($note) {
53
                        $repo->addNote($note);
54
                    }
55
                    break;
56
                default:
57
                    $parser->logUnhandledRecord(self::class.' @ '.__LINE__);
58
            }
59
60
            $parser->forward();
61
        }
62
63
        return $repo;
64
    }
65
}
66