Date::convert()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 19
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 11
dl 0
loc 19
c 0
b 0
f 0
rs 9.9
cc 3
nc 3
nop 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          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 Gedcom\Writer\Head;
16
17
class Date
18
{
19
    /**
20
     * @param string $format
21
     * @param int    $level
22
     *
23
     * @return string
24
     */
25
    public static function convert(\Gedcom\Record\Head\Date &$date, $level)
26
    {
27
        $output = '';
28
        $_date = $date->getDate();
0 ignored issues
show
Bug introduced by
The method getDate() does not exist on Gedcom\Record\Head\Date. 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
        $_date = $date->getDate();
Loading history...
29
        if ($_date) {
30
            $output .= $level.' DATE '.$_date."\n";
0 ignored issues
show
Bug introduced by
Are you sure $_date of type Gedcom\Record\Head\Date|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.' DATE './** @scrutinizer ignore-type */ $_date."\n";
Loading history...
31
        } else {
32
            return $output;
33
        }
34
35
        // level up
36
        $level++;
37
        // Time
38
        $time = $date->getTime();
0 ignored issues
show
Bug introduced by
The method getTime() does not exist on Gedcom\Record\Head\Date. 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
        $time = $date->getTime();
Loading history...
39
        if ($time) {
40
            $output .= $level.' TIME '.$time."\n";
0 ignored issues
show
Bug introduced by
Are you sure $time of type Gedcom\Record\Head\Date|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

40
            $output .= $level.' TIME './** @scrutinizer ignore-type */ $time."\n";
Loading history...
41
        }
42
43
        return $output;
44
    }
45
}
46