| Conditions | 6 |
| Paths | 5 |
| Total Lines | 24 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 19 | public static function parse(\Gedcom\Parser $parser) |
||
| 20 | { |
||
| 21 | $record = $parser->getCurrentLineRecord(); |
||
| 22 | $depth = (int) $record[0]; |
||
| 23 | |||
| 24 | $parser->forward(); |
||
| 25 | $record = $parser->getCurrentLineRecord(); |
||
| 26 | |||
| 27 | if (isset($record[1])) { |
||
| 28 | $dat = new \Gedcom\Record\Date(); |
||
| 29 | if (!empty($record[2])) { |
||
| 30 | $dat->setDate($record[2]); |
||
| 31 | } |
||
| 32 | } else { |
||
| 33 | $parser->skipToNextLevel($depth); |
||
| 34 | |||
| 35 | return null; |
||
| 36 | } |
||
| 37 | |||
| 38 | if ($dat->getYear() && $dat->getMonth() && $dat->getDay()) { |
||
| 39 | return $dat->getYear().'-'.substr("0{$dat->getMonth()}", -2).'-'.substr("0{$dat->getDay()}", -2); |
||
| 40 | } |
||
| 41 | |||
| 42 | return $dat->getYear(); |
||
| 43 | } |
||
| 45 |
In PHP, under loose comparison (like
==, or!=, orswitchconditions), values of different types might be equal.For
integervalues, zero is a special case, in particular the following results might be unexpected: