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

SourRef   A

Complexity

Total Complexity 10

Size/Duplication

Total Lines 53
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 29
dl 0
loc 53
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
 * @package         php-gedcom 
11
 * @license         MIT
12
 * @link            http://github.com/mrkrstphr/php-gedcom
13
 */
14
15
namespace PhpGedcom\Writer;
16
17
/**
18
 *
19
 */
20
class SourRef
21
{
22
    /**
23
     * @param \PhpGedcom\Record\SourRef $sour
24
     * @param int $level
25
     * @return string
26
     */
27
    public static function convert(\PhpGedcom\Record\SourRef &$sour, $level)
28
    {
29
        $output = "";
30
        $_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

30
        /** @scrutinizer ignore-call */ 
31
        $_sour = $sour->getSour();
Loading history...
31
        if(!empty($_sour)){
32
            $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

32
            $output.=$level." SOUR "./** @scrutinizer ignore-type */ $_sour."\n";
Loading history...
33
        }
34
        $level++;
35
        // protected $_text    = null;
36
        $_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

36
        /** @scrutinizer ignore-call */ 
37
        $_text = $sour->getText();
Loading history...
37
        if(!empty($_text)){
38
            $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

38
            $output.=$level." TEXT "./** @scrutinizer ignore-type */ $_text."\n";
Loading history...
39
        }
40
        // protected $_note    = array();
41
        $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

41
        /** @scrutinizer ignore-call */ 
42
        $note = $sour->getNote();
Loading history...
42
        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

42
        if($note && count(/** @scrutinizer ignore-type */ $note) > 0){
Loading history...
43
            foreach($note as $item){
44
                $_convert = \PhpGedcom\Writer\NoteRef::convert($item, $level);
45
                $output.= $_convert;
46
            }
47
        }
48
        // protected $_data    = null;
49
        $_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

49
        /** @scrutinizer ignore-call */ 
50
        $_data = $sour->getData();
Loading history...
50
        if($_data){
51
            $_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

51
            $_convert = \PhpGedcom\Writer\Sour\Data::convert(/** @scrutinizer ignore-type */ $_data, $level);
Loading history...
52
            $output.= $_convert;
53
        }
54
        // protected $_page setPage 
55
        $_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

55
        /** @scrutinizer ignore-call */ 
56
        $_page = $sour->getPage();
Loading history...
56
        if(!empty($_page)){
57
            $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

57
            $output.=$level." PAGE "./** @scrutinizer ignore-type */ $_page."\n";
Loading history...
58
        }
59
        // protected $_even    = null;
60
        $_even = $sour->getData();
61
        if($_even){
62
            $_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

62
            $_convert = \PhpGedcom\Writer\SourRef\Even::convert(/** @scrutinizer ignore-type */ $_even, $level);
Loading history...
63
            $output.= $_convert;
64
        }
65
        // protected $_quay   
66
        $_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

66
        /** @scrutinizer ignore-call */ 
67
        $_quay = $sour->getQuay();
Loading history...
67
        if(!empty($_quay)){
68
            $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

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