Issues (384)

src/Writer/Head.php (7 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          Kristopher Wilson <[email protected]>
9
 * @copyright       Copyright (c) 2010-2013, Kristopher Wilson
10
 * @license         MIT
11
 *
12
 * @link            http://github.com/mrkrstphr/php-gedcom
13
 */
14
15
namespace Gedcom\Writer;
16
17
class Head
18
{
19
    /**
20
     * @param string $format
21
     *
22
     * @return string
23
     */
24
    public static function convert(\Gedcom\Record\Head &$head, $format = self::GEDCOM55)
0 ignored issues
show
The parameter $format is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

24
    public static function convert(\Gedcom\Record\Head &$head, /** @scrutinizer ignore-unused */ $format = self::GEDCOM55)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
The constant Gedcom\Writer\Head::GEDCOM55 was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
25
    {
26
        $level = 0;
27
        $output = $level." HEAD\n";
28
29
        // level up
30
        $level++;
31
32
        //SOUR
33
        $sour = $head->getSour();
34
        if ($sour) {
0 ignored issues
show
$sour is of type Gedcom\Record\Head\Sour, thus it always evaluated to true.
Loading history...
35
            $_convert = \Gedcom\Writer\Head\Sour::convert($sour, $level);
36
            $output .= $_convert;
37
        }
38
39
        // DEST
40
        $dest = $head->getDest();
41
        if ($dest) {
42
            $output .= $level.' DEST '.$dest."\n";
43
        }
44
45
        //Subm
46
        $subm = $head->getSubm();
47
        if ($subm) {
48
            $output .= $level.' SUBM '.$subm."\n";
49
        }
50
51
        // SUBN
52
        $subn = $head->getSubn();
53
        if ($subn) {
54
            $output .= $level.' SUBN '.$subn."\n";
55
        }
56
57
        // FILE
58
        $file = $head->getFile();
59
        if ($file) {
60
            $output .= $level.' FILE '.$file."\n";
61
        }
62
63
        // COPR
64
        $copr = $head->getCopr();
65
        if ($copr) {
66
            $output .= $level.' COPR '.$copr."\n";
67
        }
68
69
        // LANG
70
        $lang = $head->getLang();
71
        if ($lang) {
72
            $output .= $level.' LANG '.$lang."\n";
73
        }
74
        // DATE
75
        $date = $head->getDate();
76
        if ($date) {
0 ignored issues
show
$date is of type Gedcom\Record\Head\Date, thus it always evaluated to true.
Loading history...
77
            $_convert = \Gedcom\Writer\Head\Date::convert($date, $level);
78
            $output .= $_convert;
79
        }
80
81
        // GEDC
82
        $gedc = $head->getGedc();
83
        if ($gedc) {
0 ignored issues
show
$gedc is of type Gedcom\Record\Head\Gedc, thus it always evaluated to true.
Loading history...
84
            $_convert = \Gedcom\Writer\Head\Gedc::convert($gedc, $level);
85
            $output .= $_convert;
86
        }
87
88
        // CHAR
89
        $char = $head->getChar();
90
        if ($char) {
0 ignored issues
show
$char is of type Gedcom\Record\Head\Char, thus it always evaluated to true.
Loading history...
91
            $_convert = \Gedcom\Writer\Head\Char::convert($char, $level);
92
            $output .= $_convert;
93
        }
94
        // PLAC
95
        $plac = $head->getPlac();
96
        if ($plac) {
0 ignored issues
show
$plac is of type Gedcom\Record\Head\Plac, thus it always evaluated to true.
Loading history...
97
            $_convert = \Gedcom\Writer\Head\Plac::convert($plac, $level);
98
            $output .= $_convert;
99
        }
100
101
        // NOTE
102
        $note = $head->getNote();
103
        if ($note) {
104
            $output .= $level.' NOTE '.$note."\n";
105
        }
106
        //
107
        /*
108
            +1 SUBM @<XREF:SUBM>@  {1:1}
109
            +1 SUBN @<XREF:SUBN>@  {0:1}
110
            +1 FILE <FILE_NAME>  {0:1}
111
            +1 COPR <COPYRIGHT_GEDCOM_FILE>  {0:1}
112
            +1 GEDC        {1:1}
113
              +2 VERS <VERSION_NUMBER>  {1:1}
114
              +2 FORM <GEDCOM_FORM>  {1:1}
115
            +1 CHAR <CHARACTER_SET>  {1:1}
116
              +2 VERS <VERSION_NUMBER>  {0:1}
117
            +1 LANG <LANGUAGE_OF_TEXT>  {0:1}
118
            +1 PLAC        {0:1}
119
              +2 FORM <PLACE_HIERARCHY>  {1:1}
120
            +1 NOTE <GEDCOM_CONTENT_DESCRIPTION>  {0:1}
121
              +2 [CONT|CONC] <GEDCOM_CONTENT_DESCRIPTION>  {0:M}
122
        */
123
124
        return $output;
125
    }
126
}
127