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
cc 3
eloc 11
nc 3
nop 2
dl 0
loc 19
rs 9.9
c 0
b 0
f 0
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\Head;
16
17
class Date
18
{
19
    /**
20
     * @param \PhpGedcom\Record\Head\Date $date
21
     * @param string                      $format
22
     * @param int                         $level
23
     *
24
     * @return string
25
     */
26
    public static function convert(\PhpGedcom\Record\Head\Date &$date, $level)
27
    {
28
        $output = '';
29
        $_date = $date->getDate();
0 ignored issues
show
Bug introduced by
The method getDate() does not exist on PhpGedcom\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

29
        /** @scrutinizer ignore-call */ 
30
        $_date = $date->getDate();
Loading history...
30
        if ($_date) {
31
            $output .= $level.' DATE '.$_date."\n";
0 ignored issues
show
Bug introduced by
Are you sure $_date of type PhpGedcom\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

31
            $output .= $level.' DATE './** @scrutinizer ignore-type */ $_date."\n";
Loading history...
32
        } else {
33
            return $output;
34
        }
35
36
        // level up
37
        $level++;
38
        // Time
39
        $time = $date->getTime();
0 ignored issues
show
Bug introduced by
The method getTime() does not exist on PhpGedcom\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

39
        /** @scrutinizer ignore-call */ 
40
        $time = $date->getTime();
Loading history...
40
        if ($time) {
41
            $output .= $level.' TIME '.$time."\n";
0 ignored issues
show
Bug introduced by
Are you sure $time of type PhpGedcom\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

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