Issues (384)

src/Writer/SourRef.php (13 issues)

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 Gedcom\Writer;
16
17
class SourRef
18
{
19
    /**
20
     * @param int $level
21
     *
22
     * @return string
23
     */
24
    public static function convert(\Gedcom\Record\SourRef &$sour, $level)
25
    {
26
        $output = '';
27
        $_sour = $sour->getSour();
0 ignored issues
show
The method getSour() does not exist on Gedcom\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

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

29
            $output .= $level.' SOUR './** @scrutinizer ignore-type */ $_sour."\n";
Loading history...
30
        }
31
        $level++;
32
        // protected $_text    = null;
33
        $_text = $sour->getText();
0 ignored issues
show
The method getText() does not exist on Gedcom\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

33
        /** @scrutinizer ignore-call */ 
34
        $_text = $sour->getText();
Loading history...
34
        if (!empty($_text)) {
35
            $output .= $level.' TEXT '.$_text."\n";
0 ignored issues
show
Are you sure $_text of type Gedcom\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

35
            $output .= $level.' TEXT './** @scrutinizer ignore-type */ $_text."\n";
Loading history...
36
        }
37
        // protected $_note    = array();
38
        $note = $sour->getNote();
0 ignored issues
show
The method getNote() does not exist on Gedcom\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

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

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

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

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

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

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

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

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

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