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

Fams   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 13
dl 0
loc 29
rs 10
c 0
b 0
f 0
wmc 5

1 Method

Rating   Name   Duplication   Size   Complexity  
A convert() 0 22 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          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 Fams
21
{
22
    /**
23
     * @param \PhpGedcom\Record\Indi\Fams $attr
24
     * @param int $level
25
     * @return string
26
     */
27
    public static function convert(\PhpGedcom\Record\Indi\Fams &$fams, $level = 0)
28
    {
29
        $output = '';
30
        // NAME
31
        $_fams = $fams->getFams();
0 ignored issues
show
Bug introduced by
The method getFams() does not exist on PhpGedcom\Record\Indi\Fams. 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
        $_fams = $fams->getFams();
Loading history...
32
        if(empty($_fams)){
33
            return $output;
34
        }
35
        $output.= $level." FAMS @".$_fams."@\n";
0 ignored issues
show
Bug introduced by
Are you sure $_fams of type PhpGedcom\Record\Indi\Fams|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

35
        $output.= $level." FAMS @"./** @scrutinizer ignore-type */ $_fams."@\n";
Loading history...
36
        // level up
37
        $level++;
38
        
39
        // note
40
        $note = $fams->getNote();
0 ignored issues
show
Bug introduced by
The method getNote() does not exist on PhpGedcom\Record\Indi\Fams. 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
        $note = $fams->getNote();
Loading history...
41
        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\Fams; 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

41
        if(!empty($note) && count(/** @scrutinizer ignore-type */ $note) > 0){
Loading history...
42
            foreach($note as $item){
43
                $_convert = \PhpGedcom\Writer\NoteRef::convert($item, $level);
44
                $output.=$_convert;
45
            }
46
        }
47
48
        return $output;
49
    }
50
}
51