Passed
Branch master (6a7148)
by Curtis
01:48
created

Famc   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 16
dl 0
loc 35
rs 10
c 0
b 0
f 0
wmc 6

1 Method

Rating   Name   Duplication   Size   Complexity  
A convert() 0 28 6
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          Xiang Ming <[email protected]>
9
 * @copyright       Copyright (c) 2010-2013, Xiang Ming
10
 * @package         php-gedcom 
11
 * @license         MIT
12
 * @link            http://github.com/mrkrstphr/php-gedcom
13
 */
14
15
namespace PhpGedcom\Writer\Indi;
16
17
/**
18
 *
19
 */
20
class Famc
21
{
22
    /**
23
     * @param \PhpGedcom\Record\Indi\Famc $attr
24
     * @param int $level
25
     * @return string
26
     */
27
    public static function convert(\PhpGedcom\Record\Indi\Famc &$famc, $level = 0)
28
    {
29
        $output = '';
30
        // NAME
31
        $_famc = $famc->getFams();
0 ignored issues
show
Bug introduced by
The method getFams() does not exist on PhpGedcom\Record\Indi\Famc. 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

31
        /** @scrutinizer ignore-call */ 
32
        $_famc = $famc->getFams();
Loading history...
32
        if(empty($_fams)){
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $_fams does not exist. Did you maybe mean $_famc?
Loading history...
33
            return $output;
34
        }
35
        $output.= $level." FAMC @".$_famc."@\n";
0 ignored issues
show
Bug introduced by
Are you sure $_famc of type PhpGedcom\Record\Indi\Famc|mixed|null can be used in concatenation? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

35
        $output.= $level." FAMC @"./** @scrutinizer ignore-type */ $_famc."@\n";
Loading history...
36
        // level up
37
        $level++;
38
        
39
        // PEDI
40
        $pedi = $famc->getPedi();
0 ignored issues
show
Bug introduced by
The method getPedi() does not exist on PhpGedcom\Record\Indi\Famc. 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
        /** @scrutinizer ignore-call */ 
41
        $pedi = $famc->getPedi();
Loading history...
41
        if(!empty($pedi)){
42
            $output.=$level." PEDI ".$pedi."\n";
0 ignored issues
show
Bug introduced by
Are you sure $pedi of type PhpGedcom\Record\Indi\Famc|mixed can be used in concatenation? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

42
            $output.=$level." PEDI "./** @scrutinizer ignore-type */ $pedi."\n";
Loading history...
43
        }
44
        
45
        // note
46
        $note = $famc->getSour();
0 ignored issues
show
Bug introduced by
The method getSour() does not exist on PhpGedcom\Record\Indi\Famc. 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

46
        /** @scrutinizer ignore-call */ 
47
        $note = $famc->getSour();
Loading history...
47
        if(!empty($note) && count($note) > 0){
0 ignored issues
show
Bug introduced by
It seems like $note can also be of type PhpGedcom\Record\Indi\Famc; however, parameter $var of count() does only seem to accept Countable|array, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

47
        if(!empty($note) && count(/** @scrutinizer ignore-type */ $note) > 0){
Loading history...
48
            foreach($note as $item){
49
                $_convert = \PhpGedcom\Writer\NoteRef::convert($item, $level);
50
                $output.=$_convert;
51
            }
52
        }
53
54
        return $output;
55
    }
56
}
57