Issues (389)

library/PhpGedcom/Writer/Note.php (11 issues)

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

29
        /** @scrutinizer ignore-call */ 
30
        $id = $note->getId();
Loading history...
30
        if (!empty($id)) {
31
            $output .= $level.' '.$id.' '." NOTE \n";
0 ignored issues
show
Are you sure $id of type PhpGedcom\Record\Note|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

31
            $output .= $level.' './** @scrutinizer ignore-type */ $id.' '." NOTE \n";
Loading history...
32
        } else {
33
            return $output;
34
        }
35
36
        // Level Up
37
        $level++;
38
        // RIN
39
        $rin = $note->getRin();
0 ignored issues
show
The method getRin() does not exist on PhpGedcom\Record\Note. 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
        $rin = $note->getRin();
Loading history...
40
        if ($rin) {
41
            $output .= $level.' RIN '.$rin."\n";
0 ignored issues
show
Are you sure $rin of type PhpGedcom\Record\Note|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

41
            $output .= $level.' RIN './** @scrutinizer ignore-type */ $rin."\n";
Loading history...
42
        }
43
44
        // cont
45
        $cont = $note->getNote();
0 ignored issues
show
The method getNote() does not exist on PhpGedcom\Record\Note. 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

45
        /** @scrutinizer ignore-call */ 
46
        $cont = $note->getNote();
Loading history...
46
        if ($cont) {
47
            $output .= $level.' CONT '.$cont."\n";
0 ignored issues
show
Are you sure $cont of type PhpGedcom\Record\Note|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

47
            $output .= $level.' CONT './** @scrutinizer ignore-type */ $cont."\n";
Loading history...
48
        }
49
50
        // REFN
51
        $refn = $note->getRefn();
0 ignored issues
show
The method getRefn() does not exist on PhpGedcom\Record\Note. 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

51
        /** @scrutinizer ignore-call */ 
52
        $refn = $note->getRefn();
Loading history...
52
        if (!empty($refn) && count($refn) > 0) {
0 ignored issues
show
It seems like $refn can also be of type PhpGedcom\Record\Note; 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

52
        if (!empty($refn) && count(/** @scrutinizer ignore-type */ $refn) > 0) {
Loading history...
53
            foreach ($refn as $item) {
54
                if ($item) {
55
                    $_convert = \PhpGedcom\Writer\Refn::convert($item, $level);
56
                    $output .= $_convert;
57
                }
58
            }
59
        }
60
        // CHAN
61
        $chan = $note->getChan();
0 ignored issues
show
The method getChan() does not exist on PhpGedcom\Record\Note. 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

61
        /** @scrutinizer ignore-call */ 
62
        $chan = $note->getChan();
Loading history...
62
        if ($chan) {
63
            $_convert = \PhpGedcom\Writer\Chan::convert($chan, $level);
0 ignored issues
show
It seems like $chan can also be of type PhpGedcom\Record\Note; however, parameter $chan of PhpGedcom\Writer\Chan::convert() does only seem to accept PhpGedcom\Record\Chan, 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

63
            $_convert = \PhpGedcom\Writer\Chan::convert(/** @scrutinizer ignore-type */ $chan, $level);
Loading history...
64
            $output .= $_convert;
65
        }
66
67
        // SOUR array
68
        $sour = $note->getSour();
0 ignored issues
show
The method getSour() does not exist on PhpGedcom\Record\Note. 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

68
        /** @scrutinizer ignore-call */ 
69
        $sour = $note->getSour();
Loading history...
69
        if (!empty($sour) && count($sour) > 0) {
70
            foreach ($sour as $item) {
71
                if ($item) {
72
                    $_convert = \PhpGedcom\Writer\SourRef::convert($item, $level);
73
                    $output .= $_convert;
74
                }
75
            }
76
        }
77
78
        return $output;
79
    }
80
}
81