Caln   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 25
dl 0
loc 38
rs 10
c 0
b 0
f 0
wmc 5

1 Method

Rating   Name   Duplication   Size   Complexity  
A parse() 0 36 5
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 PhpGedcom\Parser\Sour\Repo;
16
17
class Caln extends \PhpGedcom\Parser\Component
18
{
19
    public static function parse(\PhpGedcom\Parser $parser)
20
    {
21
        $caln = new \PhpGedcom\Record\Sour\Repo\Caln();
22
        $record = $parser->getCurrentLineRecord();
23
        $depth = (int) $record[0];
24
        if (isset($record[2])) {
25
            $_caln = $record[2];
26
            $caln->setCaln($_caln);
0 ignored issues
show
Bug introduced by
The method setCaln() does not exist on PhpGedcom\Record\Sour\Repo\Caln. 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

26
            $caln->/** @scrutinizer ignore-call */ 
27
                   setCaln($_caln);
Loading history...
27
        } else {
28
            return null;
29
        }
30
31
        $parser->forward();
32
33
        while (!$parser->eof()) {
34
            $record = $parser->getCurrentLineRecord();
35
            $recordType = strtoupper(trim($record[1]));
36
            $currentDepth = (int) $record[0];
37
38
            if ($currentDepth <= $depth) {
39
                $parser->back();
40
                break;
41
            }
42
43
            switch ($recordType) {
44
                case 'MEDI':
45
                    $caln->setMedi(trim($record[2]));
0 ignored issues
show
Bug introduced by
The method setMedi() does not exist on PhpGedcom\Record\Sour\Repo\Caln. 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

45
                    $caln->/** @scrutinizer ignore-call */ 
46
                           setMedi(trim($record[2]));
Loading history...
46
                    break;
47
                default:
48
                    $parser->logUnhandledRecord(get_class().' @ '.__LINE__);
49
            }
50
51
            $parser->forward();
52
        }
53
54
        return $caln;
55
    }
56
}
57