Issues (389)

library/PhpGedcom/Writer/RepoRef.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 PhpGedcom\Writer;
16
17
class RepoRef
18
{
19
    /**
20
     * @param \PhpGedcom\Record\RepoRef $reporef
21
     * @param int                       $level
22
     *
23
     * @return string
24
     */
25
    public static function convert(\PhpGedcom\Record\RepoRef &$reporef, $level)
26
    {
27
        $output = '';
28
        $_repo = $reporef->getRepo();
0 ignored issues
show
The method getRepo() does not exist on PhpGedcom\Record\RepoRef. 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
        $_repo = $reporef->getRepo();
Loading history...
29
        if (empty($_sour)) {
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $_sour seems to never exist and therefore empty should always be true.
Loading history...
30
            return $output;
31
        } else {
32
            $output .= $level.' REPO '.$_repo."\n";
0 ignored issues
show
Are you sure $_repo of type PhpGedcom\Record\RepoRef|mixed|null 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.' REPO './** @scrutinizer ignore-type */ $_repo."\n";
Loading history...
33
        }
34
        // level up
35
        $level++;
36
37
        // Note array
38
        $note = $reporef->getNote();
0 ignored issues
show
The method getNote() does not exist on PhpGedcom\Record\RepoRef. 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 = $reporef->getNote();
Loading history...
39
        if (!empty($note) && count($note) > 0) {
0 ignored issues
show
It seems like $note can also be of type PhpGedcom\Record\RepoRef; 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

39
        if (!empty($note) && count(/** @scrutinizer ignore-type */ $note) > 0) {
Loading history...
40
            foreach ($note as $item) {
41
                $_convert = \PhpGedcom\Writer\NoteRef::convert($item, $level);
42
                $output .= $_convert;
43
            }
44
        }
45
46
        // _caln array
47
        $_caln = $reporef->getCaln();
0 ignored issues
show
The method getCaln() does not exist on PhpGedcom\Record\RepoRef. 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

47
        /** @scrutinizer ignore-call */ 
48
        $_caln = $reporef->getCaln();
Loading history...
48
        if (!empty($_caln) && count($_caln) > 0) {
49
            foreach ($_caln as $item) {
50
                $_convert = \PhpGedcom\Writer\Caln::convert($item, $level);
51
                $output .= $_convert;
52
            }
53
        }
54
55
        return $output;
56
    }
57
}
58