Slgs   A
last analyzed

Complexity

Total Complexity 11

Size/Duplication

Total Lines 58
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 27
dl 0
loc 58
rs 10
c 0
b 0
f 0
wmc 11

1 Method

Rating   Name   Duplication   Size   Complexity  
B convert() 0 50 11
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
 * @license         MIT
11
 *
12
 * @link            http://github.com/mrkrstphr/php-gedcom
13
 */
14
15
namespace PhpGedcom\Writer\Fam;
16
17
class Slgs
18
{
19
    /**
20
     * @param \PhpGedcom\Record\Fam\Slgs $slgs
21
     * @param int                        $level
22
     *
23
     * @return string
24
     */
25
    public static function convert(\PhpGedcom\Record\Fam\Slgs &$slgs, $level)
26
    {
27
        $output = '';
28
        $output .= $level." SLGS \n";
29
30
        // Level up
31
        $level++;
32
33
        // $STAT;
34
        $stat = $slgs->getStat();
0 ignored issues
show
Bug introduced by
The method getStat() does not exist on PhpGedcom\Record\Fam\Slgs. 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

34
        /** @scrutinizer ignore-call */ 
35
        $stat = $slgs->getStat();
Loading history...
35
        if (!empty($stat)) {
36
            $output .= $level.' STAT '.$stat."\n";
0 ignored issues
show
Bug introduced by
Are you sure $stat of type PhpGedcom\Record\Fam\Slgs|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

36
            $output .= $level.' STAT './** @scrutinizer ignore-type */ $stat."\n";
Loading history...
37
        }
38
39
        // $date;
40
        $date = $slgs->getDate();
0 ignored issues
show
Bug introduced by
The method getDate() does not exist on PhpGedcom\Record\Fam\Slgs. 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
        $date = $slgs->getDate();
Loading history...
41
        if (!empty($date)) {
42
            $output .= $level.' DATE '.$date."\n";
0 ignored issues
show
Bug introduced by
Are you sure $date of type PhpGedcom\Record\Fam\Slgs|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.' DATE './** @scrutinizer ignore-type */ $date."\n";
Loading history...
43
        }
44
45
        // PLAC
46
        $plac = $slgs->getPlac();
0 ignored issues
show
Bug introduced by
The method getPlac() does not exist on PhpGedcom\Record\Fam\Slgs. 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
        $plac = $slgs->getPlac();
Loading history...
47
        if (!empty($plac)) {
48
            $output .= $level.' PLAC '.$plac."\n";
0 ignored issues
show
Bug introduced by
Are you sure $plac of type PhpGedcom\Record\Fam\Slgs|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

48
            $output .= $level.' PLAC './** @scrutinizer ignore-type */ $plac."\n";
Loading history...
49
        }
50
51
        // $TEMP;
52
        $temp = $slgs->getTemp();
0 ignored issues
show
Bug introduced by
The method getTemp() does not exist on PhpGedcom\Record\Fam\Slgs. 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

52
        /** @scrutinizer ignore-call */ 
53
        $temp = $slgs->getTemp();
Loading history...
53
        if (!empty($temp)) {
54
            $output .= $level.' TEMP '.$temp."\n";
0 ignored issues
show
Bug introduced by
Are you sure $temp of type PhpGedcom\Record\Fam\Slgs|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

54
            $output .= $level.' TEMP './** @scrutinizer ignore-type */ $temp."\n";
Loading history...
55
        }
56
57
        // $sour = array();
58
        $sour = $slgs->getSour();
0 ignored issues
show
Bug introduced by
The method getSour() does not exist on PhpGedcom\Record\Fam\Slgs. 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

58
        /** @scrutinizer ignore-call */ 
59
        $sour = $slgs->getSour();
Loading history...
59
        if (!empty($sour) && count($sour) > 0) {
0 ignored issues
show
Bug introduced by
It seems like $sour can also be of type PhpGedcom\Record\Fam\Slgs; 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

59
        if (!empty($sour) && count(/** @scrutinizer ignore-type */ $sour) > 0) {
Loading history...
60
            foreach ($sour as $item) {
61
                $_convert = \PhpGedcom\Writer\SourRef::convert($item, $level);
62
                $output .= $_convert;
63
            }
64
        }
65
        // $note = array();
66
        $note = $slgs->getNote();
0 ignored issues
show
Bug introduced by
The method getNote() does not exist on PhpGedcom\Record\Fam\Slgs. 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

66
        /** @scrutinizer ignore-call */ 
67
        $note = $slgs->getNote();
Loading history...
67
        if (!empty($note) && count($note) > 0) {
68
            foreach ($note as $item) {
69
                $_convert = \PhpGedcom\Writer\NoteRef::convert($item, $level);
70
                $output .= $_convert;
71
            }
72
        }
73
74
        return $output;
75
    }
76
}
77