Data   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 4
eloc 15
dl 0
loc 34
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A convert() 0 26 4
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\Head\Sour;
16
17
class Data
18
{
19
    /**
20
     * @param string $format
21
     * @param int    $level
22
     *
23
     * @return string
24
     */
25
    public static function convert(\Gedcom\Record\Head\Sour\Data &$data, $level)
26
    {
27
        $output = '';
28
        $_data = $data->getData();
0 ignored issues
show
Bug introduced by
The method getData() does not exist on Gedcom\Record\Head\Sour\Data. 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
        $_data = $data->getData();
Loading history...
29
        if ($_data) {
30
            $output .= $level.' DATA '.$_data."\n";
0 ignored issues
show
Bug introduced by
Are you sure $_data of type Gedcom\Record\Head\Sour\Data|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.' DATA './** @scrutinizer ignore-type */ $_data."\n";
Loading history...
31
        } else {
32
            return $output;
33
        }
34
35
        // level up
36
        $level++;
37
38
        // DATE
39
        $date = $corp->getDate();
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $corp seems to be never defined.
Loading history...
40
        if ($date) {
41
            $output .= $level.' DATE '.$date."\n";
42
        }
43
44
        // COPR
45
        $corp = $corp->getCorp();
46
        if ($corp) {
47
            $output .= $level.' COPR '.$corp."\n";
48
        }
49
50
        return $output;
51
    }
52
}
53