Even   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 23
dl 0
loc 36
rs 10
c 0
b 0
f 0
wmc 5

1 Method

Rating   Name   Duplication   Size   Complexity  
A parse() 0 34 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\Data;
16
17
class Even extends \PhpGedcom\Parser\Component
18
{
19
    public static function parse(\PhpGedcom\Parser $parser)
20
    {
21
        $record = $parser->getCurrentLineRecord();
22
        $depth = (int) $record[0];
23
24
        $even = new \PhpGedcom\Record\Sour\Data\Even();
25
26
        $parser->forward();
27
28
        while (!$parser->eof()) {
29
            $record = $parser->getCurrentLineRecord();
30
            $recordType = strtoupper(trim($record[1]));
31
            $currentDepth = (int) $record[0];
32
33
            if ($currentDepth <= $depth) {
34
                $parser->back();
35
                break;
36
            }
37
38
            switch ($recordType) {
39
                case 'DATE':
40
                    $even->setDate(trim($record[2]));
0 ignored issues
show
Bug introduced by
The method setDate() does not exist on PhpGedcom\Record\Sour\Data\Even. 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

40
                    $even->/** @scrutinizer ignore-call */ 
41
                           setDate(trim($record[2]));
Loading history...
41
                    break;
42
                case 'PLAC':
43
                    $even->setPlac(trim($record[2]));
0 ignored issues
show
Bug introduced by
The method setPlac() does not exist on PhpGedcom\Record\Sour\Data\Even. 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

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