From 9b00670abc69426bc984ef89451f993a37b8f339 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julio=20L=C3=B3pez?= Date: Thu, 30 May 2019 09:14:21 -0400 Subject: [PATCH] Add `_attr` property to EVEN Record to capture data from incoming record --- library/PhpGedcom/Parser/Indi/Attr.php | 1 - library/PhpGedcom/Parser/Indi/Even.php | 5 +++++ library/PhpGedcom/Record/Indi/Even.php | 5 +++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/library/PhpGedcom/Parser/Indi/Attr.php b/library/PhpGedcom/Parser/Indi/Attr.php index 4aa99a48..99cad602 100644 --- a/library/PhpGedcom/Parser/Indi/Attr.php +++ b/library/PhpGedcom/Parser/Indi/Attr.php @@ -40,7 +40,6 @@ public static function parse(\PhpGedcom\Parser $parser) return null; } - if (isset($record[2])) { $attr->setAttr(trim($record[2])); } diff --git a/library/PhpGedcom/Parser/Indi/Even.php b/library/PhpGedcom/Parser/Indi/Even.php index 77cdd2e1..988c2c1e 100644 --- a/library/PhpGedcom/Parser/Indi/Even.php +++ b/library/PhpGedcom/Parser/Indi/Even.php @@ -49,6 +49,11 @@ public static function parse(\PhpGedcom\Parser $parser) $even->setType(trim($record[1])); } + // ensures we capture any data following the EVEN type + if (isset($record[2]) && !empty($record[2])) { + $even->setAttr(trim($record[2])); + } + $parser->forward(); while (!$parser->eof()) { diff --git a/library/PhpGedcom/Record/Indi/Even.php b/library/PhpGedcom/Record/Indi/Even.php index 47335135..646b2aa8 100644 --- a/library/PhpGedcom/Record/Indi/Even.php +++ b/library/PhpGedcom/Record/Indi/Even.php @@ -27,6 +27,11 @@ class Even extends Record implements Record\Objectable, Record\Sourceable, Recor */ protected $type; + /** + * @var string + */ + protected $_attr; + /** * @var string */