Addr   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 13
dl 0
loc 29
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A convert() 0 20 2
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 Addr
18
{
19
    /**
20
     * @param \PhpGedcom\Record\Addr $addr
21
     * @param string                 $format
22
     * @param int                    $level
23
     *
24
     * @return string
25
     */
26
    public static function convert(\PhpGedcom\Record\Addr &$addr, $format = self::GEDCOM55, $level = 1)
0 ignored issues
show
Bug introduced by
The constant PhpGedcom\Writer\Addr::GEDCOM55 was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
Unused Code introduced by
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

26
    public static function convert(\PhpGedcom\Record\Addr &$addr, /** @scrutinizer ignore-unused */ $format = self::GEDCOM55, $level = 1)

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...
27
    {
28
        $addrs = explode("\n", $addr->getAddr());
29
30
        $output = "{$level} ADDR ".$addrs[0]."\n";
31
32
        array_shift($addrs);
33
34
        foreach ($addrs as $cont) {
35
            $output .= ($level + 1).' CONT '.$cont."\n";
36
        }
37
38
        $output .= ($level + 1).' ADR1 '.$addr->adr1."\n".
0 ignored issues
show
Bug introduced by
The property adr1 is declared protected in PhpGedcom\Record\Addr and cannot be accessed from this context.
Loading history...
39
            ($level + 1).' ADR2 '.$addr->getAdr2()."\n".
40
            ($level + 1).' CITY '.$addr->getCity()."\n".
41
            ($level + 1).' STAE '.$addr->getStae()."\n".
42
            ($level + 1).' POST '.$addr->getPost()."\n".
43
            ($level + 1).' CTRY '.$addr->getCtry()."\n";
44
45
        return $output;
46
    }
47
}
48