Issues (384)

src/Writer/Head/Sour.php (6 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\Head;
16
17
class Sour
18
{
19
    /**
20
     * @param string $format
21
     * @param int    $level
22
     *
23
     * @return string
24
     */
25
    public static function convert(\Gedcom\Record\Head\Sour &$sour, $level)
26
    {
27
        $output = '';
28
        $_sour = $sour->getSour();
0 ignored issues
show
The method getSour() does not exist on Gedcom\Record\Head\Sour. 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 ($_sour) {
30
            $output .= $level.' SOUR '.$_sour."\n";
0 ignored issues
show
Are you sure $_sour of type Gedcom\Record\Head\Sour|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
        } else {
32
            return $output;
33
        }
34
35
        // level up
36
        $level++;
37
38
        // VERS
39
        $vers = $sour->getVersion();
40
        if ($vers) {
0 ignored issues
show
$vers is of type Gedcom\Record\Head\Sour\Version, thus it always evaluated to true.
Loading history...
41
            $output .= $level.' VERS '.$vers."\n";
42
        }
43
44
        // NAME
45
        $name = $sour->getName();
46
        if ($name) {
0 ignored issues
show
$name is of type Gedcom\Record\Head\Sour\Name, thus it always evaluated to true.
Loading history...
47
            $output .= $level.' NAME '.$name."\n";
48
        }
49
50
        // CORP
51
        $corp = $sour->getCorp();
52
        if ($corp) {
0 ignored issues
show
$corp is of type Gedcom\Record\Head\Sour\Corp, thus it always evaluated to true.
Loading history...
53
            $_convert = \Gedcom\Writer\Head\Sour\Corp::convert($corp, $level);
54
            $output .= $_convert;
55
        }
56
57
        // DATA
58
        $data = $sour->getData();
59
        if ($data) {
0 ignored issues
show
$data is of type Gedcom\Record\Head\Sour\Data, thus it always evaluated to true.
Loading history...
60
            $_convert = \Gedcom\Writer\Head\Sour\Data::convert($data, $level);
61
            $output .= $_convert;
62
        }
63
64
        return $output;
65
    }
66
}
67