SourRef   A
last analyzed

Complexity

Total Complexity 10

Size/Duplication

Total Lines 54
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
B convert() 0 46 10
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;
16
17
class SourRef
18
{
19
    /**
20
     * @param \PhpGedcom\Record\SourRef $sour
21
     * @param int                       $level
22
     *
23
     * @return string
24
     */
25
    public static function convert(\PhpGedcom\Record\SourRef &$sour, $level)
26
    {
27
        $output = '';
28
        $_sour = $sour->getSour();
0 ignored issues
show
Bug introduced by
The method getSour() does not exist on PhpGedcom\Record\SourRef. 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

28
        /** @scrutinizer ignore-call */ 
29
        $_sour = $sour->getSour();
Loading history...
29
        if (!empty($_sour)) {
30
            $output .= $level.' SOUR '.$_sour."\n";
0 ignored issues
show
Bug introduced by
Are you sure $_sour of type PhpGedcom\Record\SourRef|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

30
            $output .= $level.' SOUR './** @scrutinizer ignore-type */ $_sour."\n";
Loading history...
31
        }
32
        $level++;
33
        // protected $_text    = null;
34
        $_text = $sour->getText();
0 ignored issues
show
Bug introduced by
The method getText() does not exist on PhpGedcom\Record\SourRef. 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
        $_text = $sour->getText();
Loading history...
35
        if (!empty($_text)) {
36
            $output .= $level.' TEXT '.$_text."\n";
0 ignored issues
show
Bug introduced by
Are you sure $_text of type PhpGedcom\Record\SourRef|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.' TEXT './** @scrutinizer ignore-type */ $_text."\n";
Loading history...
37
        }
38
        // protected $_note    = array();
39
        $note = $sour->getNote();
0 ignored issues
show
Bug introduced by
The method getNote() does not exist on PhpGedcom\Record\SourRef. 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

39
        /** @scrutinizer ignore-call */ 
40
        $note = $sour->getNote();
Loading history...
40
        if ($note && count($note) > 0) {
0 ignored issues
show
Bug introduced by
It seems like $note can also be of type PhpGedcom\Record\SourRef; 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

40
        if ($note && count(/** @scrutinizer ignore-type */ $note) > 0) {
Loading history...
41
            foreach ($note as $item) {
42
                $_convert = \PhpGedcom\Writer\NoteRef::convert($item, $level);
43
                $output .= $_convert;
44
            }
45
        }
46
        // protected $_data    = null;
47
        $_data = $sour->getData();
0 ignored issues
show
Bug introduced by
The method getData() does not exist on PhpGedcom\Record\SourRef. 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

47
        /** @scrutinizer ignore-call */ 
48
        $_data = $sour->getData();
Loading history...
48
        if ($_data) {
49
            $_convert = \PhpGedcom\Writer\Sour\Data::convert($_data, $level);
0 ignored issues
show
Bug introduced by
It seems like $_data can also be of type PhpGedcom\Record\SourRef; however, parameter $data of PhpGedcom\Writer\Sour\Data::convert() does only seem to accept PhpGedcom\Record\Sour\Data, 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

49
            $_convert = \PhpGedcom\Writer\Sour\Data::convert(/** @scrutinizer ignore-type */ $_data, $level);
Loading history...
50
            $output .= $_convert;
51
        }
52
        // protected $_page setPage
53
        $_page = $sour->getPage();
0 ignored issues
show
Bug introduced by
The method getPage() does not exist on PhpGedcom\Record\SourRef. 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

53
        /** @scrutinizer ignore-call */ 
54
        $_page = $sour->getPage();
Loading history...
54
        if (!empty($_page)) {
55
            $output .= $level.' PAGE '.$_page."\n";
0 ignored issues
show
Bug introduced by
Are you sure $_page of type PhpGedcom\Record\SourRef|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

55
            $output .= $level.' PAGE './** @scrutinizer ignore-type */ $_page."\n";
Loading history...
56
        }
57
        // protected $_even    = null;
58
        $_even = $sour->getData();
59
        if ($_even) {
60
            $_convert = \PhpGedcom\Writer\SourRef\Even::convert($_even, $level);
0 ignored issues
show
Bug introduced by
It seems like $_even can also be of type PhpGedcom\Record\SourRef; however, parameter $even of PhpGedcom\Writer\SourRef\Even::convert() does only seem to accept PhpGedcom\Record\SourRef\Even, 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

60
            $_convert = \PhpGedcom\Writer\SourRef\Even::convert(/** @scrutinizer ignore-type */ $_even, $level);
Loading history...
61
            $output .= $_convert;
62
        }
63
        // protected $_quay
64
        $_quay = $sour->getQuay();
0 ignored issues
show
Bug introduced by
The method getQuay() does not exist on PhpGedcom\Record\SourRef. 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

64
        /** @scrutinizer ignore-call */ 
65
        $_quay = $sour->getQuay();
Loading history...
65
        if (!empty($_quay)) {
66
            $output .= $level.' QUAY '.$_quay."\n";
0 ignored issues
show
Bug introduced by
Are you sure $_quay of type PhpGedcom\Record\SourRef|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

66
            $output .= $level.' QUAY './** @scrutinizer ignore-type */ $_quay."\n";
Loading history...
67
        }
68
        // protected $_obje    = array();
69
        // This is not defined in parser.
70
        return $output;
71
    }
72
}
73