Chan   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 15
dl 0
loc 33
rs 10
c 0
b 0
f 0
wmc 6

1 Method

Rating   Name   Duplication   Size   Complexity  
A convert() 0 25 6
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 Chan
18
{
19
    /**
20
     * @param \PhpGedcom\Record\Chan $note
21
     * @param int                    $level
22
     *
23
     * @return string
24
     */
25
    public static function convert(\PhpGedcom\Record\Chan &$chan, $level)
26
    {
27
        $output = $level." CHAN \n";
28
        // level up
29
        $level++;
30
        // DATE
31
        $_date = $chan->getDate();
32
        if (!empty($_date)) {
33
            $output .= $level.' DATE '.$_date."\n";
34
        }
35
        // TIME
36
        $_time = $chan->getDate();
37
        if (!empty($_time)) {
38
            $output .= $level.' DATE '.$_time."\n";
39
        }
40
        // $_note = array()
41
        $_note = $chan->getNote();
42
        if (!empty($_note) && count($_note) > 0) {
43
            foreach ($_note as $item) {
44
                $_convert = \PhpGedcom\Writer\NoteRef::convert($item, $level);
45
                $output .= $_convert;
46
            }
47
        }
48
49
        return $output;
50
    }
51
}
52