From 82d04f293a835031bd88bfa8c428e7f1b45c2b43 Mon Sep 17 00:00:00 2001 From: Curtis Delicata Date: Fri, 11 Sep 2020 21:36:36 +0000 Subject: [PATCH] Apply fixes from StyleCI --- library/PhpGedcom/Gedcom.php | 23 +- library/PhpGedcom/Parser.php | 565 ++++--- library/PhpGedcom/Parser/Addr.php | 25 +- library/PhpGedcom/Parser/Caln.php | 33 +- library/PhpGedcom/Parser/Chan.php | 19 +- library/PhpGedcom/Parser/Component.php | 12 +- library/PhpGedcom/Parser/Date.php | 46 +- library/PhpGedcom/Parser/Fam.php | 42 +- library/PhpGedcom/Parser/Fam/Anul.php | 8 +- library/PhpGedcom/Parser/Fam/Cens.php | 8 +- library/PhpGedcom/Parser/Fam/Div.php | 8 +- library/PhpGedcom/Parser/Fam/Divf.php | 8 +- library/PhpGedcom/Parser/Fam/Enga.php | 8 +- library/PhpGedcom/Parser/Fam/Even.php | 167 +-- library/PhpGedcom/Parser/Fam/Even/Husb.php | 33 +- library/PhpGedcom/Parser/Fam/Even/Wife.php | 33 +- library/PhpGedcom/Parser/Fam/Marb.php | 8 +- library/PhpGedcom/Parser/Fam/Marc.php | 8 +- library/PhpGedcom/Parser/Fam/Marl.php | 8 +- library/PhpGedcom/Parser/Fam/Marr.php | 8 +- library/PhpGedcom/Parser/Fam/Mars.php | 8 +- library/PhpGedcom/Parser/Fam/Slgs.php | 19 +- library/PhpGedcom/Parser/Fam/Slgs/Stat.php | 42 +- library/PhpGedcom/Parser/Head.php | 30 +- library/PhpGedcom/Parser/Head/Char.php | 34 +- library/PhpGedcom/Parser/Head/Date.php | 33 +- library/PhpGedcom/Parser/Head/Gedc.php | 19 +- library/PhpGedcom/Parser/Head/Plac.php | 19 +- library/PhpGedcom/Parser/Head/Sour.php | 33 +- library/PhpGedcom/Parser/Head/Sour/Corp.php | 34 +- library/PhpGedcom/Parser/Head/Sour/Data.php | 33 +- library/PhpGedcom/Parser/Indi.php | 329 ++-- library/PhpGedcom/Parser/Indi/Adop.php | 18 +- library/PhpGedcom/Parser/Indi/Asso.php | 34 +- library/PhpGedcom/Parser/Indi/Attr.php | 35 +- library/PhpGedcom/Parser/Indi/Bapl.php | 7 +- library/PhpGedcom/Parser/Indi/Bapm.php | 8 +- library/PhpGedcom/Parser/Indi/Barm.php | 8 +- library/PhpGedcom/Parser/Indi/Basm.php | 8 +- library/PhpGedcom/Parser/Indi/Birt.php | 13 +- library/PhpGedcom/Parser/Indi/Bles.php | 8 +- library/PhpGedcom/Parser/Indi/Buri.php | 8 +- library/PhpGedcom/Parser/Indi/Cast.php | 8 +- library/PhpGedcom/Parser/Indi/Cens.php | 8 +- library/PhpGedcom/Parser/Indi/Chr.php | 12 +- library/PhpGedcom/Parser/Indi/Chra.php | 8 +- library/PhpGedcom/Parser/Indi/Conf.php | 8 +- library/PhpGedcom/Parser/Indi/Conl.php | 8 +- library/PhpGedcom/Parser/Indi/Crem.php | 8 +- library/PhpGedcom/Parser/Indi/Deat.php | 8 +- library/PhpGedcom/Parser/Indi/Dscr.php | 8 +- library/PhpGedcom/Parser/Indi/Educ.php | 8 +- library/PhpGedcom/Parser/Indi/Emig.php | 8 +- library/PhpGedcom/Parser/Indi/Endl.php | 8 +- library/PhpGedcom/Parser/Indi/Even.php | 188 ++- library/PhpGedcom/Parser/Indi/Even/Plac.php | 19 +- library/PhpGedcom/Parser/Indi/Famc.php | 22 +- library/PhpGedcom/Parser/Indi/Fams.php | 22 +- library/PhpGedcom/Parser/Indi/Fcom.php | 8 +- library/PhpGedcom/Parser/Indi/Grad.php | 8 +- library/PhpGedcom/Parser/Indi/Idno.php | 8 +- library/PhpGedcom/Parser/Indi/Immi.php | 8 +- library/PhpGedcom/Parser/Indi/Lds.php | 36 +- library/PhpGedcom/Parser/Indi/Name.php | 34 +- library/PhpGedcom/Parser/Indi/Name/Fone.php | 33 +- library/PhpGedcom/Parser/Indi/Name/Romn.php | 34 +- library/PhpGedcom/Parser/Indi/Nati.php | 8 +- library/PhpGedcom/Parser/Indi/Natu.php | 8 +- library/PhpGedcom/Parser/Indi/Nchi.php | 8 +- library/PhpGedcom/Parser/Indi/Nmr.php | 8 +- library/PhpGedcom/Parser/Indi/Occu.php | 8 +- library/PhpGedcom/Parser/Indi/Ordn.php | 8 +- library/PhpGedcom/Parser/Indi/Prob.php | 8 +- library/PhpGedcom/Parser/Indi/Prop.php | 9 +- library/PhpGedcom/Parser/Indi/Reli.php | 8 +- library/PhpGedcom/Parser/Indi/Resi.php | 8 +- library/PhpGedcom/Parser/Indi/Reti.php | 8 +- library/PhpGedcom/Parser/Indi/Slgc.php | 11 +- library/PhpGedcom/Parser/Indi/Ssn.php | 8 +- library/PhpGedcom/Parser/Indi/Titl.php | 8 +- library/PhpGedcom/Parser/Indi/Will.php | 8 +- library/PhpGedcom/Parser/Note.php | 37 +- library/PhpGedcom/Parser/NoteRef.php | 19 +- library/PhpGedcom/Parser/Obje.php | 29 +- library/PhpGedcom/Parser/ObjeRef.php | 33 +- library/PhpGedcom/Parser/ObjeRef/File.php | 33 +- .../PhpGedcom/Parser/ObjeRef/File/Form.php | 32 +- library/PhpGedcom/Parser/Phon.php | 34 +- library/PhpGedcom/Parser/Plac.php | 31 +- library/PhpGedcom/Parser/Plac/Fone.php | 31 +- library/PhpGedcom/Parser/Plac/Map.php | 20 +- library/PhpGedcom/Parser/Plac/Romn.php | 31 +- library/PhpGedcom/Parser/Refn.php | 34 +- library/PhpGedcom/Parser/Repo.php | 31 +- library/PhpGedcom/Parser/RepoRef.php | 31 +- library/PhpGedcom/Parser/Sour.php | 33 +- library/PhpGedcom/Parser/Sour/Data.php | 19 +- library/PhpGedcom/Parser/Sour/Data/Even.php | 19 +- library/PhpGedcom/Parser/Sour/Repo.php | 21 +- library/PhpGedcom/Parser/Sour/Repo/Caln.php | 33 +- library/PhpGedcom/Parser/SourRef.php | 33 +- library/PhpGedcom/Parser/SourRef/Data.php | 29 +- library/PhpGedcom/Parser/SourRef/Even.php | 33 +- library/PhpGedcom/Parser/Subm.php | 39 +- library/PhpGedcom/Parser/Subn.php | 33 +- library/PhpGedcom/Record.php | 51 +- library/PhpGedcom/Record/Addr.php | 21 +- library/PhpGedcom/Record/Caln.php | 11 +- library/PhpGedcom/Record/Chan.php | 15 +- library/PhpGedcom/Record/Data.php | 11 +- library/PhpGedcom/Record/Date.php | 200 +-- library/PhpGedcom/Record/Fam.php | 218 +-- library/PhpGedcom/Record/Fam/Anul.php | 7 +- library/PhpGedcom/Record/Fam/Cens.php | 7 +- library/PhpGedcom/Record/Fam/Div.php | 7 +- library/PhpGedcom/Record/Fam/Enga.php | 7 +- library/PhpGedcom/Record/Fam/Even.php | 93 +- library/PhpGedcom/Record/Fam/Even/Husb.php | 7 +- library/PhpGedcom/Record/Fam/Even/Wife.php | 7 +- library/PhpGedcom/Record/Fam/Marb.php | 7 +- library/PhpGedcom/Record/Fam/Marc.php | 7 +- library/PhpGedcom/Record/Fam/Marl.php | 7 +- library/PhpGedcom/Record/Fam/Marr.php | 7 +- library/PhpGedcom/Record/Fam/Mars.php | 7 +- library/PhpGedcom/Record/Fam/Slgs.php | 27 +- library/PhpGedcom/Record/Fam/Slgs/Stat.php | 11 +- library/PhpGedcom/Record/Head.php | 28 +- library/PhpGedcom/Record/Head/Char.php | 8 +- library/PhpGedcom/Record/Head/Date.php | 7 +- library/PhpGedcom/Record/Head/Gedc.php | 76 +- library/PhpGedcom/Record/Head/Plac.php | 10 +- library/PhpGedcom/Record/Head/Sour.php | 148 +- library/PhpGedcom/Record/Head/Sour/Corp.php | 13 +- library/PhpGedcom/Record/Head/Sour/Data.php | 8 +- library/PhpGedcom/Record/Indi.php | 1329 +++++++++-------- library/PhpGedcom/Record/Indi/Adop.php | 7 +- library/PhpGedcom/Record/Indi/Asso.php | 27 +- library/PhpGedcom/Record/Indi/Attr.php | 37 +- library/PhpGedcom/Record/Indi/Bapl.php | 7 +- library/PhpGedcom/Record/Indi/Bapm.php | 7 +- library/PhpGedcom/Record/Indi/Barm.php | 7 +- library/PhpGedcom/Record/Indi/Basm.php | 7 +- library/PhpGedcom/Record/Indi/Birt.php | 11 +- library/PhpGedcom/Record/Indi/Bles.php | 7 +- library/PhpGedcom/Record/Indi/Buri.php | 7 +- library/PhpGedcom/Record/Indi/Cast.php | 7 +- library/PhpGedcom/Record/Indi/Cens.php | 7 +- library/PhpGedcom/Record/Indi/Chr.php | 7 +- library/PhpGedcom/Record/Indi/Chra.php | 7 +- library/PhpGedcom/Record/Indi/Conf.php | 7 +- library/PhpGedcom/Record/Indi/Conl.php | 7 +- library/PhpGedcom/Record/Indi/Crem.php | 7 +- library/PhpGedcom/Record/Indi/Deat.php | 7 +- library/PhpGedcom/Record/Indi/Dscr.php | 7 +- library/PhpGedcom/Record/Indi/Educ.php | 7 +- library/PhpGedcom/Record/Indi/Emig.php | 8 +- library/PhpGedcom/Record/Indi/Endl.php | 7 +- library/PhpGedcom/Record/Indi/Even.php | 45 +- library/PhpGedcom/Record/Indi/Even/Plac.php | 21 +- library/PhpGedcom/Record/Indi/Famc.php | 17 +- library/PhpGedcom/Record/Indi/Fams.php | 20 +- library/PhpGedcom/Record/Indi/Fcom.php | 7 +- library/PhpGedcom/Record/Indi/Grad.php | 7 +- library/PhpGedcom/Record/Indi/Idno.php | 7 +- library/PhpGedcom/Record/Indi/Immi.php | 7 +- library/PhpGedcom/Record/Indi/Lds.php | 27 +- library/PhpGedcom/Record/Indi/Name.php | 58 +- library/PhpGedcom/Record/Indi/Name/Fone.php | 89 +- library/PhpGedcom/Record/Indi/Name/Romn.php | 91 +- library/PhpGedcom/Record/Indi/Nati.php | 7 +- library/PhpGedcom/Record/Indi/Natu.php | 7 +- library/PhpGedcom/Record/Indi/Nchi.php | 7 +- library/PhpGedcom/Record/Indi/Nmr.php | 7 +- library/PhpGedcom/Record/Indi/Note.php | 5 +- library/PhpGedcom/Record/Indi/Occu.php | 7 +- library/PhpGedcom/Record/Indi/Ordn.php | 7 +- library/PhpGedcom/Record/Indi/Prob.php | 7 +- library/PhpGedcom/Record/Indi/Prop.php | 7 +- library/PhpGedcom/Record/Indi/Reli.php | 7 +- library/PhpGedcom/Record/Indi/Resi.php | 7 +- library/PhpGedcom/Record/Indi/Reti.php | 7 +- library/PhpGedcom/Record/Indi/Slgc.php | 10 +- library/PhpGedcom/Record/Indi/Ssn.php | 7 +- library/PhpGedcom/Record/Indi/Titl.php | 8 +- library/PhpGedcom/Record/Indi/Will.php | 7 +- library/PhpGedcom/Record/Note.php | 25 +- library/PhpGedcom/Record/NoteRef.php | 33 +- library/PhpGedcom/Record/Noteable.php | 10 +- library/PhpGedcom/Record/Obje.php | 37 +- library/PhpGedcom/Record/ObjeRef.php | 34 +- library/PhpGedcom/Record/ObjeRef/File.php | 8 +- .../PhpGedcom/Record/ObjeRef/File/Form.php | 11 +- library/PhpGedcom/Record/Objectable.php | 10 +- library/PhpGedcom/Record/Phon.php | 9 +- library/PhpGedcom/Record/Plac.php | 40 +- library/PhpGedcom/Record/Plac/Fone.php | 7 +- library/PhpGedcom/Record/Plac/Map.php | 7 +- library/PhpGedcom/Record/Plac/Romn.php | 7 +- library/PhpGedcom/Record/Refn.php | 11 +- library/PhpGedcom/Record/Repo.php | 525 ++++--- library/PhpGedcom/Record/RepoRef.php | 17 +- library/PhpGedcom/Record/Sour.php | 39 +- library/PhpGedcom/Record/Sour/Data.php | 19 +- library/PhpGedcom/Record/Sour/Data/Even.php | 7 +- library/PhpGedcom/Record/Sour/Repo.php | 28 +- library/PhpGedcom/Record/Sour/Repo/Caln.php | 11 +- library/PhpGedcom/Record/SourRef.php | 29 +- library/PhpGedcom/Record/SourRef/Data.php | 15 +- library/PhpGedcom/Record/SourRef/Even.php | 11 +- library/PhpGedcom/Record/Sourceable.php | 10 +- library/PhpGedcom/Record/Subm.php | 631 ++++---- library/PhpGedcom/Record/Subn.php | 39 +- library/PhpGedcom/Writer.php | 89 +- library/PhpGedcom/Writer/Addr.php | 36 +- library/PhpGedcom/Writer/Caln.php | 23 +- library/PhpGedcom/Writer/Chan.php | 25 +- library/PhpGedcom/Writer/Fam.php | 110 +- library/PhpGedcom/Writer/Fam/Even.php | 80 +- library/PhpGedcom/Writer/Fam/Even/Husb.php | 22 +- library/PhpGedcom/Writer/Fam/Even/Wife.php | 22 +- library/PhpGedcom/Writer/Fam/Slgs.php | 48 +- library/PhpGedcom/Writer/Head.php | 154 +- library/PhpGedcom/Writer/Head/Char.php | 25 +- library/PhpGedcom/Writer/Head/Date.php | 24 +- library/PhpGedcom/Writer/Head/Gedc.php | 23 +- library/PhpGedcom/Writer/Head/Plac.php | 18 +- library/PhpGedcom/Writer/Head/Sour.php | 37 +- library/PhpGedcom/Writer/Head/Sour/Corp.php | 32 +- library/PhpGedcom/Writer/Head/Sour/Data.php | 28 +- library/PhpGedcom/Writer/Indi.php | 138 +- library/PhpGedcom/Writer/Indi/Asso.php | 32 +- library/PhpGedcom/Writer/Indi/Attr.php | 13 +- library/PhpGedcom/Writer/Indi/Even.php | 77 +- library/PhpGedcom/Writer/Indi/Even/Plac.php | 33 +- library/PhpGedcom/Writer/Indi/Famc.php | 28 +- library/PhpGedcom/Writer/Indi/Fams.php | 22 +- library/PhpGedcom/Writer/Indi/Name.php | 52 +- library/PhpGedcom/Writer/Note.php | 48 +- library/PhpGedcom/Writer/NoteRef.php | 23 +- library/PhpGedcom/Writer/Obje.php | 62 +- library/PhpGedcom/Writer/ObjeRef.php | 39 +- library/PhpGedcom/Writer/Phon.php | 14 +- library/PhpGedcom/Writer/Refn.php | 25 +- library/PhpGedcom/Writer/Repo.php | 57 +- library/PhpGedcom/Writer/RepoRef.php | 35 +- library/PhpGedcom/Writer/Sour.php | 78 +- library/PhpGedcom/Writer/Sour/Data.php | 46 +- library/PhpGedcom/Writer/Sour/Data/Even.php | 24 +- library/PhpGedcom/Writer/SourRef.php | 46 +- library/PhpGedcom/Writer/SourRef/Even.php | 25 +- library/PhpGedcom/Writer/Subm.php | 70 +- library/PhpGedcom/Writer/Subn.php | 50 +- tests/bootstrap.php | 6 +- tests/issue/Issue00012Test.php | 4 +- tests/issue/Issue00017Test.php | 5 +- tests/issue/Issue00018Test.php | 5 +- tests/library/Gedcom/ParserTest.php | 75 +- 257 files changed, 4423 insertions(+), 5428 deletions(-) diff --git a/library/PhpGedcom/Gedcom.php b/library/PhpGedcom/Gedcom.php index cc13f74d..e57c35e4 100644 --- a/library/PhpGedcom/Gedcom.php +++ b/library/PhpGedcom/Gedcom.php @@ -1,22 +1,21 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom; /** - * Class Gedcom - * @package PhpGedcom + * Class Gedcom. */ class Gedcom { @@ -39,56 +38,56 @@ class Gedcom * * @var \PhpGedcom\Record\Sour[] */ - protected $sour = array(); + protected $sour = []; /** * Stores all the individuals contained within the GEDCOM file. * * @var \PhpGedcom\Record\Indi[] */ - protected $indi = array(); + protected $indi = []; /** * Stores all the individuals contained within the GEDCOM file. * * @var array */ - protected $uid2indi = array(); + protected $uid2indi = []; /** * Stores all the families contained within the GEDCOM file. * * @var \PhpGedcom\Record\Fam[] */ - protected $fam = array(); + protected $fam = []; /** * Stores all the notes contained within the GEDCOM file that are not inline. * * @var \PhpGedcom\Record\Note[] */ - protected $note = array(); + protected $note = []; /** * Stores all repositories that are contained within the GEDCOM file and referenced by sources. * * @var \PhpGedcom\Record\Repo[] */ - protected $repo = array(); + protected $repo = []; /** * Stores all the media objects that are contained within the GEDCOM file. * * @var \PhpGedcom\Record\Obje[] */ - protected $obje = array(); + protected $obje = []; /** * Stores information about all the submitters to the GEDCOM file. * * @var \PhpGedcom\Record\Subm[] */ - protected $subm = array(); + protected $subm = []; /** * Retrieves the header record of the GEDCOM file. diff --git a/library/PhpGedcom/Parser.php b/library/PhpGedcom/Parser.php index 56373239..e7b45759 100644 --- a/library/PhpGedcom/Parser.php +++ b/library/PhpGedcom/Parser.php @@ -1,318 +1,275 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom; -/** - * - */ -class Parser { - /** - * - */ - protected $_file = null; - - /** - * - */ - protected $_gedcom = null; - - /** - * - */ - protected $_errorLog = array(); - - /** - * - */ - protected $_linesParsed = 0; - - /** - * - */ - protected $_line = ''; - - /** - * - */ - protected $_lineRecord = null; - - /** - * - */ - protected $_linePieces = 0; - - /** - * - */ - protected $_returnedLine = ''; - - /** - * - */ - public function __construct(\PhpGedcom\Gedcom $gedcom = null) { - if (!is_null($gedcom)) { - $this->_gedcom = $gedcom; - } else { - $this->_gedcom = new \PhpGedcom\Gedcom(); - } - } - - /** - * - */ - public function forward() { - // if there was a returned line by back(), set that as our current - // line and blank out the returnedLine variable, otherwise grab - // the next line from the file - - if (!empty($this->_returnedLine)) { - $this->_line = $this->_returnedLine; - $this->_returnedLine = ''; - } else { - $this->_line = fgets($this->_file); - $this->_lineRecord = null; - $this->_linesParsed++; - } - - return $this; - } - - /** - * - */ - public function back() { - // our parser object encountered a line it wasn't meant to parse - // store this line for the previous parser to analyze - - $this->_returnedLine = $this->_line; - - return $this; - } - - /** - * Jump to the next level in the GEDCOM that is <= $level. This will leave the parser at the line above - * this level, such that calling $parser->forward() will result in landing at the correct level. - * - * @param int $level - */ - public function skipToNextLevel($level) { - $currentDepth = 999; - - while ($currentDepth > $level) { - $this->forward(); - $record = $this->getCurrentLineRecord(); - $currentDepth = (int) $record[0]; - } - - $this->back(); - } - - /** - * - */ - public function getGedcom() { - return $this->_gedcom; - } - - /** - * - */ - public function eof() { - return feof($this->_file); - } - - /** - * - * @return string - */ - public function parseMultiLineRecord() { - $record = $this->getCurrentLineRecord(); - - $depth = (int) $record[0]; - $data = isset($record[2]) ? trim($record[2]) : ''; - - $this->forward(); - - while (!$this->eof()) { - $record = $this->getCurrentLineRecord(); - $recordType = strtoupper(trim($record[1])); - $currentDepth = (int) $record[0]; - - if ($currentDepth <= $depth) { - $this->back(); - break; - } - - switch ($recordType) { - case 'CONT': - $data .= "\n"; - - if (isset($record[2])) { - $data .= trim($record[2]); - } - break; - case 'CONC': - if (isset($record[2])) { - $data .= ' ' . trim($record[2]); - } - break; - default: - $this->back(); - break 2; - } - - $this->forward(); - } - - return $data; - } - - /** - * - * @return string The current line - */ - public function getCurrentLine() { - return $this->_line; - } - - /** - * - */ - public function getCurrentLineRecord($pieces = 3) { - if (!is_null($this->_lineRecord)) { - if ($this->_linePieces == $pieces) { - return $this->_lineRecord; - } - } - - if (empty($this->_line)) { - return false; - } - - $line = trim($this->_line); - - $this->_lineRecord = explode(' ', $line, $pieces); - $this->_linePieces = $pieces; - - return $this->_lineRecord; - } - - /** - * - */ - protected function logError($error) { - $this->_errorLog[] = $error; - } - - /** - * - */ - public function logUnhandledRecord($additionalInfo = '') { - $this->logError( - $this->_linesParsed . ': (Unhandled) ' . trim(implode('|', $this->getCurrentLineRecord())) . - (!empty($additionalInfo) ? ' - ' . $additionalInfo : '') - ); - } - - public function logSkippedRecord($additionalInfo = '') { - $this->logError( - $this->_linesParsed . ': (Skipping) ' . trim(implode('|', $this->getCurrentLineRecord())) . - (!empty($additionalInfo) ? ' - ' . $additionalInfo : '') - ); - } - - /** - * - */ - public function getErrors() { - return $this->_errorLog; - } - - /** - * - */ - public function normalizeIdentifier($identifier) { - $identifier = trim($identifier); - $identifier = trim($identifier, '@'); - - return $identifier; - } - - /** - * - * @param string $fileName - * @return Gedcom - */ - public function parse($fileName) { - $this->_file = fopen($fileName, 'r'); #explode("\n", mb_convert_encoding($contents, 'UTF-8')); - - if (!$this->_file) { - return null; - } - - $this->forward(); - - while (!$this->eof()) { - $record = $this->getCurrentLineRecord(); - - if ($record === false) { - continue; - } - - $depth = (int) $record[0]; - - // We only process 0 level records here. Sub levels are processed - // in methods for those data types (individuals, sources, etc) - - if ($depth == 0) { - // Although not always an identifier (HEAD,TRLR): - if (isset($record[1])) { - $identifier = $this->normalizeIdentifier($record[1]); - } - - if (isset($record[1]) && trim($record[1]) == 'HEAD') { - Parser\Head::parse($this); - } else if (isset($record[2]) && trim($record[2]) == 'SUBN') { - Parser\Subn::parse($this); - } else if (isset($record[2]) && trim($record[2]) == 'SUBM') { - Parser\Subm::parse($this); - } else if (isset($record[2]) && $record[2] == 'SOUR') { - Parser\Sour::parse($this); - } else if (isset($record[2]) && $record[2] == 'INDI') { - Parser\Indi::parse($this); - } else if (isset($record[2]) && $record[2] == 'FAM') { - Parser\Fam::parse($this); - } else if (isset($record[2]) && substr(trim($record[2]), 0, 4) == 'NOTE') { - Parser\Note::parse($this); - } else if (isset($record[2]) && $record[2] == 'REPO') { - Parser\Repo::parse($this); - } else if (isset($record[2]) && $record[2] == 'OBJE') { - Parser\Obje::parse($this); - } else if (isset($record[1]) && trim($record[1]) == 'TRLR') { - // EOF - break; - } else { - $this->logUnhandledRecord(get_class() . ' @ ' . __LINE__); - } - } else { - $this->logUnhandledRecord(get_class() . ' @ ' . __LINE__); - } - - $this->forward(); - } - - return $this->getGedcom(); - } -} \ No newline at end of file +class Parser +{ + protected $_file = null; + + protected $_gedcom = null; + + protected $_errorLog = []; + + protected $_linesParsed = 0; + + protected $_line = ''; + + protected $_lineRecord = null; + + protected $_linePieces = 0; + + protected $_returnedLine = ''; + + public function __construct(\PhpGedcom\Gedcom $gedcom = null) + { + if (!is_null($gedcom)) { + $this->_gedcom = $gedcom; + } else { + $this->_gedcom = new \PhpGedcom\Gedcom(); + } + } + + public function forward() + { + // if there was a returned line by back(), set that as our current + // line and blank out the returnedLine variable, otherwise grab + // the next line from the file + + if (!empty($this->_returnedLine)) { + $this->_line = $this->_returnedLine; + $this->_returnedLine = ''; + } else { + $this->_line = fgets($this->_file); + $this->_lineRecord = null; + $this->_linesParsed++; + } + + return $this; + } + + public function back() + { + // our parser object encountered a line it wasn't meant to parse + // store this line for the previous parser to analyze + + $this->_returnedLine = $this->_line; + + return $this; + } + + /** + * Jump to the next level in the GEDCOM that is <= $level. This will leave the parser at the line above + * this level, such that calling $parser->forward() will result in landing at the correct level. + * + * @param int $level + */ + public function skipToNextLevel($level) + { + $currentDepth = 999; + + while ($currentDepth > $level) { + $this->forward(); + $record = $this->getCurrentLineRecord(); + $currentDepth = (int) $record[0]; + } + + $this->back(); + } + + public function getGedcom() + { + return $this->_gedcom; + } + + public function eof() + { + return feof($this->_file); + } + + /** + * @return string + */ + public function parseMultiLineRecord() + { + $record = $this->getCurrentLineRecord(); + + $depth = (int) $record[0]; + $data = isset($record[2]) ? trim($record[2]) : ''; + + $this->forward(); + + while (!$this->eof()) { + $record = $this->getCurrentLineRecord(); + $recordType = strtoupper(trim($record[1])); + $currentDepth = (int) $record[0]; + + if ($currentDepth <= $depth) { + $this->back(); + break; + } + + switch ($recordType) { + case 'CONT': + $data .= "\n"; + + if (isset($record[2])) { + $data .= trim($record[2]); + } + break; + case 'CONC': + if (isset($record[2])) { + $data .= ' '.trim($record[2]); + } + break; + default: + $this->back(); + break 2; + } + + $this->forward(); + } + + return $data; + } + + /** + * @return string The current line + */ + public function getCurrentLine() + { + return $this->_line; + } + + public function getCurrentLineRecord($pieces = 3) + { + if (!is_null($this->_lineRecord)) { + if ($this->_linePieces == $pieces) { + return $this->_lineRecord; + } + } + + if (empty($this->_line)) { + return false; + } + + $line = trim($this->_line); + + $this->_lineRecord = explode(' ', $line, $pieces); + $this->_linePieces = $pieces; + + return $this->_lineRecord; + } + + protected function logError($error) + { + $this->_errorLog[] = $error; + } + + public function logUnhandledRecord($additionalInfo = '') + { + $this->logError( + $this->_linesParsed.': (Unhandled) '.trim(implode('|', $this->getCurrentLineRecord())). + (!empty($additionalInfo) ? ' - '.$additionalInfo : '') + ); + } + + public function logSkippedRecord($additionalInfo = '') + { + $this->logError( + $this->_linesParsed.': (Skipping) '.trim(implode('|', $this->getCurrentLineRecord())). + (!empty($additionalInfo) ? ' - '.$additionalInfo : '') + ); + } + + public function getErrors() + { + return $this->_errorLog; + } + + public function normalizeIdentifier($identifier) + { + $identifier = trim($identifier); + $identifier = trim($identifier, '@'); + + return $identifier; + } + + /** + * @param string $fileName + * + * @return Gedcom + */ + public function parse($fileName) + { + $this->_file = fopen($fileName, 'r'); //explode("\n", mb_convert_encoding($contents, 'UTF-8')); + + if (!$this->_file) { + return null; + } + + $this->forward(); + + while (!$this->eof()) { + $record = $this->getCurrentLineRecord(); + + if ($record === false) { + continue; + } + + $depth = (int) $record[0]; + + // We only process 0 level records here. Sub levels are processed + // in methods for those data types (individuals, sources, etc) + + if ($depth == 0) { + // Although not always an identifier (HEAD,TRLR): + if (isset($record[1])) { + $identifier = $this->normalizeIdentifier($record[1]); + } + + if (isset($record[1]) && trim($record[1]) == 'HEAD') { + Parser\Head::parse($this); + } elseif (isset($record[2]) && trim($record[2]) == 'SUBN') { + Parser\Subn::parse($this); + } elseif (isset($record[2]) && trim($record[2]) == 'SUBM') { + Parser\Subm::parse($this); + } elseif (isset($record[2]) && $record[2] == 'SOUR') { + Parser\Sour::parse($this); + } elseif (isset($record[2]) && $record[2] == 'INDI') { + Parser\Indi::parse($this); + } elseif (isset($record[2]) && $record[2] == 'FAM') { + Parser\Fam::parse($this); + } elseif (isset($record[2]) && substr(trim($record[2]), 0, 4) == 'NOTE') { + Parser\Note::parse($this); + } elseif (isset($record[2]) && $record[2] == 'REPO') { + Parser\Repo::parse($this); + } elseif (isset($record[2]) && $record[2] == 'OBJE') { + Parser\Obje::parse($this); + } elseif (isset($record[1]) && trim($record[1]) == 'TRLR') { + // EOF + break; + } else { + $this->logUnhandledRecord(get_class().' @ '.__LINE__); + } + } else { + $this->logUnhandledRecord(get_class().' @ '.__LINE__); + } + + $this->forward(); + } + + return $this->getGedcom(); + } +} diff --git a/library/PhpGedcom/Parser/Addr.php b/library/PhpGedcom/Parser/Addr.php index 6cc8555e..7ace5ab1 100644 --- a/library/PhpGedcom/Parser/Addr.php +++ b/library/PhpGedcom/Parser/Addr.php @@ -1,34 +1,25 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Parser; -/** - * - * - */ class Addr extends \PhpGedcom\Parser\Component { - - /** - * - * - */ public static function parse(\PhpGedcom\Parser $parser) { $record = $parser->getCurrentLineRecord(); - $depth = (int)$record[0]; + $depth = (int) $record[0]; $line = isset($record[2]) ? trim($record[2]) : ''; $addr = new \PhpGedcom\Record\Addr(); @@ -38,7 +29,7 @@ public static function parse(\PhpGedcom\Parser $parser) while (!$parser->eof()) { $record = $parser->getCurrentLineRecord(); $recordType = strtolower(trim($record[1])); - $currentDepth = (int)$record[0]; + $currentDepth = (int) $record[0]; if ($currentDepth <= $depth) { $parser->back(); @@ -46,16 +37,16 @@ public static function parse(\PhpGedcom\Parser $parser) } if ($addr->hasAttribute($recordType)) { - $addr->{'set' . $recordType}(trim($record[2])); + $addr->{'set'.$recordType}(trim($record[2])); } else { if ($recordType == 'cont') { // FIXME: Can have CONT on multiple attributes - $addr->setAddr($addr->getAddr() . "\n"); + $addr->setAddr($addr->getAddr()."\n"); if (isset($record[2])) { - $addr->setAddr($addr->getAddr() . trim($record[2])); + $addr->setAddr($addr->getAddr().trim($record[2])); } } else { - $parser->logUnhandledRecord(get_class() . ' @ ' . __LINE__); + $parser->logUnhandledRecord(get_class().' @ '.__LINE__); } } diff --git a/library/PhpGedcom/Parser/Caln.php b/library/PhpGedcom/Parser/Caln.php index 4ffc2f2c..ea91e3f4 100644 --- a/library/PhpGedcom/Parser/Caln.php +++ b/library/PhpGedcom/Parser/Caln.php @@ -1,40 +1,31 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Parser; -/** - * - * - */ class Caln extends \PhpGedcom\Parser\Component { - - /** - * - * - */ public static function parse(\PhpGedcom\Parser $parser) { $record = $parser->getCurrentLineRecord(); - $depth = (int)$record[0]; - if(isset($record[2])){ - $identifier = $parser->normalizeIdentifier($record[2]); - } - else{ - $parser->skipToNextLevel($depth); - return null; + $depth = (int) $record[0]; + if (isset($record[2])) { + $identifier = $parser->normalizeIdentifier($record[2]); + } else { + $parser->skipToNextLevel($depth); + + return null; } $caln = new \PhpGedcom\Record\Caln(); @@ -45,7 +36,7 @@ public static function parse(\PhpGedcom\Parser $parser) while (!$parser->eof()) { $record = $parser->getCurrentLineRecord(); $recordType = strtolower(trim($record[1])); - $lineDepth = (int)$record[0]; + $lineDepth = (int) $record[0]; if ($lineDepth <= $depth) { $parser->back(); @@ -53,9 +44,9 @@ public static function parse(\PhpGedcom\Parser $parser) } if ($caln->hasAttribute($recordType)) { - $caln->{'set' . $recordType}(trim($record[2])); + $caln->{'set'.$recordType}(trim($record[2])); } else { - $parser->logUnhandledRecord(get_class() . ' @ ' . __LINE__); + $parser->logUnhandledRecord(get_class().' @ '.__LINE__); } $parser->forward(); diff --git a/library/PhpGedcom/Parser/Chan.php b/library/PhpGedcom/Parser/Chan.php index 5df7b589..5dc5dfc0 100644 --- a/library/PhpGedcom/Parser/Chan.php +++ b/library/PhpGedcom/Parser/Chan.php @@ -1,34 +1,25 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Parser; -/** - * - * - */ class Chan extends \PhpGedcom\Parser\Component { - - /** - * - * - */ public static function parse(\PhpGedcom\Parser $parser) { $record = $parser->getCurrentLineRecord(); - $depth = (int)$record[0]; + $depth = (int) $record[0]; $parser->forward(); @@ -37,7 +28,7 @@ public static function parse(\PhpGedcom\Parser $parser) while (!$parser->eof()) { $record = $parser->getCurrentLineRecord(); $recordType = trim($record[1]); - $currentDepth = (int)$record[0]; + $currentDepth = (int) $record[0]; if ($currentDepth <= $depth) { $parser->back(); @@ -58,7 +49,7 @@ public static function parse(\PhpGedcom\Parser $parser) } break; default: - $parser->logUnhandledRecord(get_class() . ' @ ' . __LINE__); + $parser->logUnhandledRecord(get_class().' @ '.__LINE__); } $parser->forward(); diff --git a/library/PhpGedcom/Parser/Component.php b/library/PhpGedcom/Parser/Component.php index 50aaf487..16484e4e 100644 --- a/library/PhpGedcom/Parser/Component.php +++ b/library/PhpGedcom/Parser/Component.php @@ -1,30 +1,22 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Parser; -/** - * - * - */ abstract class Component { - /** - * - */ public static function parse(\PhpGedcom\Parser $parser) { - } } diff --git a/library/PhpGedcom/Parser/Date.php b/library/PhpGedcom/Parser/Date.php index dc19a9c6..2ed23b40 100644 --- a/library/PhpGedcom/Parser/Date.php +++ b/library/PhpGedcom/Parser/Date.php @@ -1,42 +1,36 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Parser; -/** - * - * - */ -class Date extends \PhpGedcom\Parser\Component { +class Date extends \PhpGedcom\Parser\Component +{ + public static function parse(\PhpGedcom\Parser $parser) + { + $record = $parser->getCurrentLineRecord(); + $depth = (int) $record[0]; + if (isset($record[1])) { + $dat = new \PhpGedcom\Record\Date(); + if (!empty($record[2])) { + $dat->setDate($record[2]); + } + } else { + $parser->skipToNextLevel($depth); - /** - * - * - */ - public static function parse(\PhpGedcom\Parser $parser) { - $record = $parser->getCurrentLineRecord(); - $depth = (int) $record[0]; - if (isset($record[1])) { - $dat = new \PhpGedcom\Record\Date(); - if (!empty($record[2])) { - $dat->setDate($record[2]); - } - } else { - $parser->skipToNextLevel($depth); - return null; - } + return null; + } - return $dat; - } -} \ No newline at end of file + return $dat; + } +} diff --git a/library/PhpGedcom/Parser/Fam.php b/library/PhpGedcom/Parser/Fam.php index 6dc273c3..8a1a0d3c 100644 --- a/library/PhpGedcom/Parser/Fam.php +++ b/library/PhpGedcom/Parser/Fam.php @@ -1,26 +1,22 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Parser; -/** - * - * - */ class Fam extends \PhpGedcom\Parser\Component { - protected static $_eventTypes = array( + protected static $_eventTypes = [ 'ANUL', 'CENS', 'DIV', @@ -30,23 +26,19 @@ class Fam extends \PhpGedcom\Parser\Component 'MARB', 'MARC', 'MARL', - 'MARS' - ); + 'MARS', + ]; - /** - * - * - */ public static function parse(\PhpGedcom\Parser $parser) { $record = $parser->getCurrentLineRecord(); - $depth = (int)$record[0]; - if(isset($record[1])){ - $identifier = $parser->normalizeIdentifier($record[1]); - } - else{ - $parser->skipToNextLevel($depth); - return null; + $depth = (int) $record[0]; + if (isset($record[1])) { + $identifier = $parser->normalizeIdentifier($record[1]); + } else { + $parser->skipToNextLevel($depth); + + return null; } $fam = new \PhpGedcom\Record\Fam(); @@ -58,7 +50,7 @@ public static function parse(\PhpGedcom\Parser $parser) while (!$parser->eof()) { $record = $parser->getCurrentLineRecord(); - $currentDepth = (int)$record[0]; + $currentDepth = (int) $record[0]; $recordType = strtoupper(trim($record[1])); if ($currentDepth <= $depth) { @@ -82,11 +74,11 @@ public static function parse(\PhpGedcom\Parser $parser) case 'MARL': case 'MARS': $className = ucfirst(strtolower($recordType)); - $class = '\\PhpGedcom\\Parser\\Fam\\' . $className; + $class = '\\PhpGedcom\\Parser\\Fam\\'.$className; $even = $class::parse($parser); $fam->addEven($even); - break; + break; case 'HUSB': $fam->setHusb($parser->normalizeIdentifier($record[2])); break; @@ -109,7 +101,7 @@ public static function parse(\PhpGedcom\Parser $parser) case 'REFN': $ref = \PhpGedcom\Parser\Refn::parse($parser); $fam->addRefn($ref); - break; + break; case 'RIN': $fam->setRin(trim($record[2])); break; @@ -133,7 +125,7 @@ public static function parse(\PhpGedcom\Parser $parser) break; default: - $parser->logUnhandledRecord(get_class() . ' @ ' . __LINE__); + $parser->logUnhandledRecord(get_class().' @ '.__LINE__); } $parser->forward(); diff --git a/library/PhpGedcom/Parser/Fam/Anul.php b/library/PhpGedcom/Parser/Fam/Anul.php index 3b82f82a..cbfc8270 100644 --- a/library/PhpGedcom/Parser/Fam/Anul.php +++ b/library/PhpGedcom/Parser/Fam/Anul.php @@ -1,23 +1,19 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Parser\Fam; -/** - * - * - */ class Anul extends \PhpGedcom\Parser\Fam\Even { } diff --git a/library/PhpGedcom/Parser/Fam/Cens.php b/library/PhpGedcom/Parser/Fam/Cens.php index 959e9fec..72fc9238 100644 --- a/library/PhpGedcom/Parser/Fam/Cens.php +++ b/library/PhpGedcom/Parser/Fam/Cens.php @@ -1,23 +1,19 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Parser\Fam; -/** - * - * - */ class Cens extends \PhpGedcom\Parser\Fam\Even { } diff --git a/library/PhpGedcom/Parser/Fam/Div.php b/library/PhpGedcom/Parser/Fam/Div.php index 3c7941bd..1a17af9a 100644 --- a/library/PhpGedcom/Parser/Fam/Div.php +++ b/library/PhpGedcom/Parser/Fam/Div.php @@ -1,23 +1,19 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Parser\Fam; -/** - * - * - */ class Div extends \PhpGedcom\Parser\Fam\Even { } diff --git a/library/PhpGedcom/Parser/Fam/Divf.php b/library/PhpGedcom/Parser/Fam/Divf.php index 165a5d61..448105e6 100644 --- a/library/PhpGedcom/Parser/Fam/Divf.php +++ b/library/PhpGedcom/Parser/Fam/Divf.php @@ -1,23 +1,19 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Parser\Fam; -/** - * - * - */ class Divf extends \PhpGedcom\Parser\Fam\Even { } diff --git a/library/PhpGedcom/Parser/Fam/Enga.php b/library/PhpGedcom/Parser/Fam/Enga.php index a66eb00f..117f1a38 100644 --- a/library/PhpGedcom/Parser/Fam/Enga.php +++ b/library/PhpGedcom/Parser/Fam/Enga.php @@ -1,23 +1,19 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Parser\Fam; -/** - * - * - */ class Enga extends \PhpGedcom\Parser\Fam\Even { } diff --git a/library/PhpGedcom/Parser/Fam/Even.php b/library/PhpGedcom/Parser/Fam/Even.php index c006bf8a..9001c06f 100644 --- a/library/PhpGedcom/Parser/Fam/Even.php +++ b/library/PhpGedcom/Parser/Fam/Even.php @@ -1,110 +1,103 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Parser\Fam; -/** - * - * - */ -class Even extends \PhpGedcom\Parser\Component { - - /** - * - * - */ - public static function parse(\PhpGedcom\Parser $parser) { - $record = $parser->getCurrentLineRecord(); - $depth = (int) $record[0]; +class Even extends \PhpGedcom\Parser\Component +{ + public static function parse(\PhpGedcom\Parser $parser) + { + $record = $parser->getCurrentLineRecord(); + $depth = (int) $record[0]; - $even = new \PhpGedcom\Record\Fam\Even(); + $even = new \PhpGedcom\Record\Fam\Even(); - if (isset($record[1]) && strtoupper(trim($record[1])) != 'EVEN') { - $even->setType(trim($record[1])); - } + if (isset($record[1]) && strtoupper(trim($record[1])) != 'EVEN') { + $even->setType(trim($record[1])); + } - $parser->forward(); + $parser->forward(); - while (!$parser->eof()) { - $record = $parser->getCurrentLineRecord(); - $recordType = strtoupper(trim($record[1])); - $currentDepth = (int) $record[0]; + while (!$parser->eof()) { + $record = $parser->getCurrentLineRecord(); + $recordType = strtoupper(trim($record[1])); + $currentDepth = (int) $record[0]; - if ($currentDepth <= $depth) { - $parser->back(); - break; - } + if ($currentDepth <= $depth) { + $parser->back(); + break; + } - switch ($recordType) { - case 'TYPE': - $even->setType(trim($record[2])); - break; - case 'DATE': - $dat = \PhpGedcom\Parser\Date::parse($parser); - $even->setDate($dat); - //$even->setDate(trim($record[2])); - break; - case 'PLAC': - $plac = \PhpGedcom\Parser\Plac::parse($parser); - $even->setPlac($plac); - break; - case 'ADDR': - $addr = \PhpGedcom\Parser\Addr::parse($parser); - $even->setAddr($addr); - break; - case 'PHON': - $phone = \PhpGedcom\Parser\Phon::parse($parser); - $even->addPhone($phone); - break; - case 'CAUS': - $even->setCaus(trim($record[2])); - break; - case 'AGE': - $even->setAge(trim($record[2])); - break; - case 'AGNC': - $even->setAgnc(trim($record[2])); - break; - case 'HUSB': - $husb = \PhpGedcom\Parser\Fam\Even\Husb::parse($parser); - $even->setHusb($husb); - break; - case 'WIFE': - $wife = \PhpGedcom\Parser\Fam\Even\Wife::parse($parser); - $even->setWife($wife); - break; - case 'SOUR': - $sour = \PhpGedcom\Parser\SourRef::parse($parser); - $even->addSour($sour); - break; - case 'OBJE': - $obje = \PhpGedcom\Parser\ObjeRef::parse($parser); - $even->addObje($obje); - break; - case 'NOTE': - $note = \PhpGedcom\Parser\NoteRef::parse($parser); - if ($note) { - $even->addNote($note); - } - break; - default: - $parser->logUnhandledRecord(get_class() . ' @ ' . __LINE__); - } + switch ($recordType) { + case 'TYPE': + $even->setType(trim($record[2])); + break; + case 'DATE': + $dat = \PhpGedcom\Parser\Date::parse($parser); + $even->setDate($dat); + //$even->setDate(trim($record[2])); + break; + case 'PLAC': + $plac = \PhpGedcom\Parser\Plac::parse($parser); + $even->setPlac($plac); + break; + case 'ADDR': + $addr = \PhpGedcom\Parser\Addr::parse($parser); + $even->setAddr($addr); + break; + case 'PHON': + $phone = \PhpGedcom\Parser\Phon::parse($parser); + $even->addPhone($phone); + break; + case 'CAUS': + $even->setCaus(trim($record[2])); + break; + case 'AGE': + $even->setAge(trim($record[2])); + break; + case 'AGNC': + $even->setAgnc(trim($record[2])); + break; + case 'HUSB': + $husb = \PhpGedcom\Parser\Fam\Even\Husb::parse($parser); + $even->setHusb($husb); + break; + case 'WIFE': + $wife = \PhpGedcom\Parser\Fam\Even\Wife::parse($parser); + $even->setWife($wife); + break; + case 'SOUR': + $sour = \PhpGedcom\Parser\SourRef::parse($parser); + $even->addSour($sour); + break; + case 'OBJE': + $obje = \PhpGedcom\Parser\ObjeRef::parse($parser); + $even->addObje($obje); + break; + case 'NOTE': + $note = \PhpGedcom\Parser\NoteRef::parse($parser); + if ($note) { + $even->addNote($note); + } + break; + default: + $parser->logUnhandledRecord(get_class().' @ '.__LINE__); + } - $parser->forward(); - } + $parser->forward(); + } - return $even; - } + return $even; + } } diff --git a/library/PhpGedcom/Parser/Fam/Even/Husb.php b/library/PhpGedcom/Parser/Fam/Even/Husb.php index 5cfa0034..b0f8515e 100644 --- a/library/PhpGedcom/Parser/Fam/Even/Husb.php +++ b/library/PhpGedcom/Parser/Fam/Even/Husb.php @@ -1,60 +1,51 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Parser\Fam\Even; -/** - * - * - */ class Husb extends \PhpGedcom\Parser\Component { - - /** - * - * - */ public static function parse(\PhpGedcom\Parser $parser) { $record = $parser->getCurrentLineRecord(); - $depth = (int)$record[0]; - + $depth = (int) $record[0]; + $husband = new \PhpGedcom\Record\Fam\Even\Husb(); - + $parser->forward(); - + while (!$parser->eof()) { $record = $parser->getCurrentLineRecord(); $recordType = strtoupper(trim($record[1])); - $currentDepth = (int)$record[0]; - + $currentDepth = (int) $record[0]; + if ($currentDepth <= $depth) { $parser->back(); break; } - + switch ($recordType) { case 'AGE': $husband->setAge(trim($record[2])); break; default: - $parser->logUnhandledRecord(get_class() . ' @ ' . __LINE__); + $parser->logUnhandledRecord(get_class().' @ '.__LINE__); } - + $parser->forward(); } - + return $husband; } } diff --git a/library/PhpGedcom/Parser/Fam/Even/Wife.php b/library/PhpGedcom/Parser/Fam/Even/Wife.php index 99565167..c6845fd6 100644 --- a/library/PhpGedcom/Parser/Fam/Even/Wife.php +++ b/library/PhpGedcom/Parser/Fam/Even/Wife.php @@ -1,60 +1,51 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Parser\Fam\Even; -/** - * - * - */ class Wife extends \PhpGedcom\Parser\Component { - - /** - * - * - */ public static function parse(\PhpGedcom\Parser $parser) { $record = $parser->getCurrentLineRecord(); - $depth = (int)$record[0]; - + $depth = (int) $record[0]; + $wife = new \PhpGedcom\Record\Fam\Even\Wife(); - + $parser->forward(); - + while (!$parser->eof()) { $record = $parser->getCurrentLineRecord(); $recordType = strtoupper(trim($record[1])); - $currentDepth = (int)$record[0]; - + $currentDepth = (int) $record[0]; + if ($currentDepth <= $depth) { $parser->back(); break; } - + switch ($recordType) { case 'AGE': $wife->setAge(trim($record[2])); break; default: - $parser->logUnhandledRecord(get_class() . ' @ ' . __LINE__); + $parser->logUnhandledRecord(get_class().' @ '.__LINE__); } - + $parser->forward(); } - + return $wife; } } diff --git a/library/PhpGedcom/Parser/Fam/Marb.php b/library/PhpGedcom/Parser/Fam/Marb.php index 871b7195..78a70c75 100644 --- a/library/PhpGedcom/Parser/Fam/Marb.php +++ b/library/PhpGedcom/Parser/Fam/Marb.php @@ -1,23 +1,19 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Parser\Fam; -/** - * - * - */ class Marb extends \PhpGedcom\Parser\Fam\Even { } diff --git a/library/PhpGedcom/Parser/Fam/Marc.php b/library/PhpGedcom/Parser/Fam/Marc.php index 2d094385..34c93205 100644 --- a/library/PhpGedcom/Parser/Fam/Marc.php +++ b/library/PhpGedcom/Parser/Fam/Marc.php @@ -1,23 +1,19 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Parser\Fam; -/** - * - * - */ class Marc extends \PhpGedcom\Parser\Fam\Even { } diff --git a/library/PhpGedcom/Parser/Fam/Marl.php b/library/PhpGedcom/Parser/Fam/Marl.php index 29d27133..1031f5f3 100644 --- a/library/PhpGedcom/Parser/Fam/Marl.php +++ b/library/PhpGedcom/Parser/Fam/Marl.php @@ -1,23 +1,19 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Parser\Fam; -/** - * - * - */ class Marl extends \PhpGedcom\Parser\Fam\Even { } diff --git a/library/PhpGedcom/Parser/Fam/Marr.php b/library/PhpGedcom/Parser/Fam/Marr.php index 9ae0d67c..f52c576c 100644 --- a/library/PhpGedcom/Parser/Fam/Marr.php +++ b/library/PhpGedcom/Parser/Fam/Marr.php @@ -1,23 +1,19 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Parser\Fam; -/** - * - * - */ class Marr extends \PhpGedcom\Parser\Fam\Even { } diff --git a/library/PhpGedcom/Parser/Fam/Mars.php b/library/PhpGedcom/Parser/Fam/Mars.php index aa98d639..2ef26680 100644 --- a/library/PhpGedcom/Parser/Fam/Mars.php +++ b/library/PhpGedcom/Parser/Fam/Mars.php @@ -1,23 +1,19 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Parser\Fam; -/** - * - * - */ class Mars extends \PhpGedcom\Parser\Fam\Even { } diff --git a/library/PhpGedcom/Parser/Fam/Slgs.php b/library/PhpGedcom/Parser/Fam/Slgs.php index 38605c91..4cccaf25 100644 --- a/library/PhpGedcom/Parser/Fam/Slgs.php +++ b/library/PhpGedcom/Parser/Fam/Slgs.php @@ -1,34 +1,25 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Parser\Fam; -/** - * - * - */ class Slgs extends \PhpGedcom\Parser\Component { - - /** - * - * - */ public static function parse(\PhpGedcom\Parser $parser) { $record = $parser->getCurrentLineRecord(); - $depth = (int)$record[0]; + $depth = (int) $record[0]; $slgs = new \PhpGedcom\Record\Fam\Slgs(); @@ -37,7 +28,7 @@ public static function parse(\PhpGedcom\Parser $parser) while (!$parser->eof()) { $record = $parser->getCurrentLineRecord(); $recordType = strtoupper(trim($record[1])); - $currentDepth = (int)$record[0]; + $currentDepth = (int) $record[0]; if ($currentDepth <= $depth) { $parser->back(); @@ -69,7 +60,7 @@ public static function parse(\PhpGedcom\Parser $parser) } break; default: - $parser->logUnhandledRecord(get_class() . ' @ ' . __LINE__); + $parser->logUnhandledRecord(get_class().' @ '.__LINE__); } $parser->forward(); diff --git a/library/PhpGedcom/Parser/Fam/Slgs/Stat.php b/library/PhpGedcom/Parser/Fam/Slgs/Stat.php index ca9e0acc..523102c3 100644 --- a/library/PhpGedcom/Parser/Fam/Slgs/Stat.php +++ b/library/PhpGedcom/Parser/Fam/Slgs/Stat.php @@ -1,67 +1,59 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Parser\Fam\Slgs; -/** - * - * - */ class Stat extends \PhpGedcom\Parser\Component { - - /** - * - * - */ public static function parse(\PhpGedcom\Parser $parser) { $record = $parser->getCurrentLineRecord(); - $depth = (int) $record[0]; - if (isset($record[2])) { - $_stat = $record[2]; - } else { - $parser->skipToNextLevel($depth); - return null; - } + $depth = (int) $record[0]; + if (isset($record[2])) { + $_stat = $record[2]; + } else { + $parser->skipToNextLevel($depth); + + return null; + } $stat = new \PhpGedcom\Record\Fam\Slgs\Stat(); $stat->setStat($_stat); $parser->forward(); - + while (!$parser->eof()) { $record = $parser->getCurrentLineRecord(); $recordType = strtoupper(trim($record[1])); - $currentDepth = (int)$record[0]; - + $currentDepth = (int) $record[0]; + if ($currentDepth <= $depth) { $parser->back(); break; } - + switch ($recordType) { case 'DATE': $stat->setDate(trim($record[2])); break; default: - $parser->logUnhandledRecord(get_class() . ' @ ' . __LINE__); + $parser->logUnhandledRecord(get_class().' @ '.__LINE__); } - + $parser->forward(); } - + return $stat; } } diff --git a/library/PhpGedcom/Parser/Head.php b/library/PhpGedcom/Parser/Head.php index 542e0a29..ba860070 100644 --- a/library/PhpGedcom/Parser/Head.php +++ b/library/PhpGedcom/Parser/Head.php @@ -1,42 +1,36 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Parser; - -/** - * - * - */ class Head extends \PhpGedcom\Parser\Component { - /** - * * @param \PhpGedcom\Parser $parser + * * @return \PhpGedcom\Record\Head */ public static function parse(\PhpGedcom\Parser $parser) { $record = $parser->getCurrentLineRecord(); - $depth = (int)$record[0]; - if(isset($record[1])){ - $identifier = $parser->normalizeIdentifier($record[1]); - } - else{ - $parser->skipToNextLevel($depth); - return null; + $depth = (int) $record[0]; + if (isset($record[1])) { + $identifier = $parser->normalizeIdentifier($record[1]); + } else { + $parser->skipToNextLevel($depth); + + return null; } $head = new \PhpGedcom\Record\Head(); @@ -47,7 +41,7 @@ public static function parse(\PhpGedcom\Parser $parser) while (!$parser->eof()) { $record = $parser->getCurrentLineRecord(); - $currentDepth = (int)$record[0]; + $currentDepth = (int) $record[0]; $recordType = strtoupper(trim($record[1])); if ($currentDepth <= $depth) { @@ -101,7 +95,7 @@ public static function parse(\PhpGedcom\Parser $parser) $head->setNote($parser->parseMultiLineRecord()); break; default: - $parser->logUnhandledRecord(get_class() . ' @ ' . __LINE__); + $parser->logUnhandledRecord(get_class().' @ '.__LINE__); } $parser->forward(); diff --git a/library/PhpGedcom/Parser/Head/Char.php b/library/PhpGedcom/Parser/Head/Char.php index 2bb8fc52..3dda7621 100644 --- a/library/PhpGedcom/Parser/Head/Char.php +++ b/library/PhpGedcom/Parser/Head/Char.php @@ -1,50 +1,40 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Parser\Head; -/** - * - * - */ class Char extends \PhpGedcom\Parser\Component { - - /** - * - * - */ public static function parse(\PhpGedcom\Parser $parser) { $record = $parser->getCurrentLineRecord(); - $depth = (int)$record[0]; - if(isset($record[2])){ - $char = new \PhpGedcom\Record\Head\Char(); - $char->setChar(trim($record[2])); + $depth = (int) $record[0]; + if (isset($record[2])) { + $char = new \PhpGedcom\Record\Head\Char(); + $char->setChar(trim($record[2])); + } else { + $parser->skipToNextLevel($depth); + + return null; } - else{ - $parser->skipToNextLevel($depth); - return null; - } - $parser->forward(); while (!$parser->eof()) { $record = $parser->getCurrentLineRecord(); $recordType = strtoupper(trim($record[1])); - $currentDepth = (int)$record[0]; + $currentDepth = (int) $record[0]; if ($currentDepth <= $depth) { $parser->back(); @@ -56,7 +46,7 @@ public static function parse(\PhpGedcom\Parser $parser) $char->setVers(trim($record[2])); break; default: - $parser->logUnhandledRecord(get_class() . ' @ ' . __LINE__); + $parser->logUnhandledRecord(get_class().' @ '.__LINE__); } $parser->forward(); diff --git a/library/PhpGedcom/Parser/Head/Date.php b/library/PhpGedcom/Parser/Head/Date.php index 1bf2fd7c..7be159a0 100644 --- a/library/PhpGedcom/Parser/Head/Date.php +++ b/library/PhpGedcom/Parser/Head/Date.php @@ -1,41 +1,32 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Parser\Head; -/** - * - * - */ class Date extends \PhpGedcom\Parser\Component { - - /** - * - * - */ public static function parse(\PhpGedcom\Parser $parser) { $record = $parser->getCurrentLineRecord(); - $depth = (int)$record[0]; - if(isset($record[2])){ - $date = new \PhpGedcom\Record\Head\Date(); - $date->setDate(trim($record[2])); - } - else{ - $parser->skipToNextLevel($depth); - return null; + $depth = (int) $record[0]; + if (isset($record[2])) { + $date = new \PhpGedcom\Record\Head\Date(); + $date->setDate(trim($record[2])); + } else { + $parser->skipToNextLevel($depth); + + return null; } $parser->forward(); @@ -43,7 +34,7 @@ public static function parse(\PhpGedcom\Parser $parser) while (!$parser->eof()) { $record = $parser->getCurrentLineRecord(); $recordType = strtoupper(trim($record[1])); - $currentDepth = (int)$record[0]; + $currentDepth = (int) $record[0]; if ($currentDepth <= $depth) { $parser->back(); @@ -55,7 +46,7 @@ public static function parse(\PhpGedcom\Parser $parser) $date->setTime(trim($record[2])); break; default: - $parser->logUnhandledRecord(get_class() . ' @ ' . __LINE__); + $parser->logUnhandledRecord(get_class().' @ '.__LINE__); } $parser->forward(); diff --git a/library/PhpGedcom/Parser/Head/Gedc.php b/library/PhpGedcom/Parser/Head/Gedc.php index 7e2ed7fb..c5754c96 100644 --- a/library/PhpGedcom/Parser/Head/Gedc.php +++ b/library/PhpGedcom/Parser/Head/Gedc.php @@ -1,34 +1,25 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Parser\Head; -/** - * - * - */ class Gedc extends \PhpGedcom\Parser\Component { - - /** - * - * - */ public static function parse(\PhpGedcom\Parser $parser) { $record = $parser->getCurrentLineRecord(); - $depth = (int)$record[0]; + $depth = (int) $record[0]; $gedc = new \PhpGedcom\Record\Head\Gedc(); @@ -37,7 +28,7 @@ public static function parse(\PhpGedcom\Parser $parser) while (!$parser->eof()) { $record = $parser->getCurrentLineRecord(); $recordType = strtoupper(trim($record[1])); - $currentDepth = (int)$record[0]; + $currentDepth = (int) $record[0]; if ($currentDepth <= $depth) { $parser->back(); @@ -52,7 +43,7 @@ public static function parse(\PhpGedcom\Parser $parser) $gedc->setForm(trim($record[2])); break; default: - $parser->logUnhandledRecord(get_class() . ' @ ' . __LINE__); + $parser->logUnhandledRecord(get_class().' @ '.__LINE__); } $parser->forward(); diff --git a/library/PhpGedcom/Parser/Head/Plac.php b/library/PhpGedcom/Parser/Head/Plac.php index 14f5cf5c..2c7bb05d 100644 --- a/library/PhpGedcom/Parser/Head/Plac.php +++ b/library/PhpGedcom/Parser/Head/Plac.php @@ -1,34 +1,25 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Parser\Head; -/** - * - * - */ class Plac extends \PhpGedcom\Parser\Component { - - /** - * - * - */ public static function parse(\PhpGedcom\Parser $parser) { $record = $parser->getCurrentLineRecord(); - $depth = (int)$record[0]; + $depth = (int) $record[0]; $plac = new \PhpGedcom\Record\Head\Plac(); @@ -37,7 +28,7 @@ public static function parse(\PhpGedcom\Parser $parser) while (!$parser->eof()) { $record = $parser->getCurrentLineRecord(); $recordType = strtoupper(trim($record[1])); - $currentDepth = (int)$record[0]; + $currentDepth = (int) $record[0]; if ($currentDepth <= $depth) { $parser->back(); @@ -49,7 +40,7 @@ public static function parse(\PhpGedcom\Parser $parser) $plac->setForm(trim($record[2])); break; default: - $parser->logUnhandledRecord(get_class() . ' @ ' . __LINE__); + $parser->logUnhandledRecord(get_class().' @ '.__LINE__); } $parser->forward(); diff --git a/library/PhpGedcom/Parser/Head/Sour.php b/library/PhpGedcom/Parser/Head/Sour.php index 09c28601..d1669fd7 100644 --- a/library/PhpGedcom/Parser/Head/Sour.php +++ b/library/PhpGedcom/Parser/Head/Sour.php @@ -1,41 +1,32 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Parser\Head; -/** - * - * - */ class Sour extends \PhpGedcom\Parser\Component { - - /** - * - * - */ public static function parse(\PhpGedcom\Parser $parser) { $record = $parser->getCurrentLineRecord(); - $depth = (int)$record[0]; - if(isset($record[2])){ - $source = new \PhpGedcom\Record\Head\Sour(); - $source->setSour(trim($record[2])); - } - else{ - $parser->skipToNextLevel($depth); - return null; + $depth = (int) $record[0]; + if (isset($record[2])) { + $source = new \PhpGedcom\Record\Head\Sour(); + $source->setSour(trim($record[2])); + } else { + $parser->skipToNextLevel($depth); + + return null; } $parser->forward(); @@ -43,7 +34,7 @@ public static function parse(\PhpGedcom\Parser $parser) while (!$parser->eof()) { $record = $parser->getCurrentLineRecord(); $recordType = strtoupper(trim($record[1])); - $currentDepth = (int)$record[0]; + $currentDepth = (int) $record[0]; if ($currentDepth <= $depth) { $parser->back(); @@ -66,7 +57,7 @@ public static function parse(\PhpGedcom\Parser $parser) $source->setData($data); break; default: - $parser->logUnhandledRecord(get_class() . ' @ ' . __LINE__); + $parser->logUnhandledRecord(get_class().' @ '.__LINE__); } $parser->forward(); diff --git a/library/PhpGedcom/Parser/Head/Sour/Corp.php b/library/PhpGedcom/Parser/Head/Sour/Corp.php index c049eb35..8199c233 100644 --- a/library/PhpGedcom/Parser/Head/Sour/Corp.php +++ b/library/PhpGedcom/Parser/Head/Sour/Corp.php @@ -1,50 +1,40 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Parser\Head\Sour; -/** - * - * - */ class Corp extends \PhpGedcom\Parser\Component { - - /** - * - * - */ public static function parse(\PhpGedcom\Parser $parser) { $record = $parser->getCurrentLineRecord(); - $depth = (int)$record[0]; - if(isset($record[2])){ - $corp = new \PhpGedcom\Record\Head\Sour\Corp(); - $corp->setCorp(trim($record[2])); + $depth = (int) $record[0]; + if (isset($record[2])) { + $corp = new \PhpGedcom\Record\Head\Sour\Corp(); + $corp->setCorp(trim($record[2])); + } else { + $parser->skipToNextLevel($depth); + + return null; } - else{ - $parser->skipToNextLevel($depth); - return null; - } - $parser->forward(); while (!$parser->eof()) { $record = $parser->getCurrentLineRecord(); $recordType = strtoupper(trim($record[1])); - $currentDepth = (int)$record[0]; + $currentDepth = (int) $record[0]; if ($currentDepth <= $depth) { $parser->back(); @@ -59,7 +49,7 @@ public static function parse(\PhpGedcom\Parser $parser) $corp->addPhon(trim($record[2])); break; default: - $parser->logUnhandledRecord(get_class() . ' @ ' . __LINE__); + $parser->logUnhandledRecord(get_class().' @ '.__LINE__); } $parser->forward(); diff --git a/library/PhpGedcom/Parser/Head/Sour/Data.php b/library/PhpGedcom/Parser/Head/Sour/Data.php index c18f4e07..9b4930d0 100644 --- a/library/PhpGedcom/Parser/Head/Sour/Data.php +++ b/library/PhpGedcom/Parser/Head/Sour/Data.php @@ -1,41 +1,32 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Parser\Head\Sour; -/** - * - * - */ class Data extends \PhpGedcom\Parser\Component { - - /** - * - * - */ public static function parse(\PhpGedcom\Parser $parser) { $record = $parser->getCurrentLineRecord(); - $depth = (int)$record[0]; - if(isset($record[2])){ - $data = new \PhpGedcom\Record\Head\Sour\Data(); - $data->setData(trim($record[2])); - } - else{ - $parser->skipToNextLevel($depth); - return null; + $depth = (int) $record[0]; + if (isset($record[2])) { + $data = new \PhpGedcom\Record\Head\Sour\Data(); + $data->setData(trim($record[2])); + } else { + $parser->skipToNextLevel($depth); + + return null; } $parser->forward(); @@ -43,7 +34,7 @@ public static function parse(\PhpGedcom\Parser $parser) while (!$parser->eof()) { $record = $parser->getCurrentLineRecord(); $recordType = strtoupper(trim($record[1])); - $currentDepth = (int)$record[0]; + $currentDepth = (int) $record[0]; if ($currentDepth <= $depth) { $parser->back(); @@ -58,7 +49,7 @@ public static function parse(\PhpGedcom\Parser $parser) $data->setCopr(trim($record[2])); break; default: - $parser->logUnhandledRecord(get_class() . ' @ ' . __LINE__); + $parser->logUnhandledRecord(get_class().' @ '.__LINE__); } $parser->forward(); diff --git a/library/PhpGedcom/Parser/Indi.php b/library/PhpGedcom/Parser/Indi.php index fb280a28..377c44a5 100644 --- a/library/PhpGedcom/Parser/Indi.php +++ b/library/PhpGedcom/Parser/Indi.php @@ -1,193 +1,188 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Parser; -/** - * - * - */ -class Indi extends \PhpGedcom\Parser\Component { - /** - * - * - */ - public static function parse(\PhpGedcom\Parser $parser) { - $record = $parser->getCurrentLineRecord(); - $depth = (int) $record[0]; - if (isset($record[1])) { - $identifier = $parser->normalizeIdentifier($record[1]); - } else { - $parser->skipToNextLevel($depth); - return null; - } +class Indi extends \PhpGedcom\Parser\Component +{ + public static function parse(\PhpGedcom\Parser $parser) + { + $record = $parser->getCurrentLineRecord(); + $depth = (int) $record[0]; + if (isset($record[1])) { + $identifier = $parser->normalizeIdentifier($record[1]); + } else { + $parser->skipToNextLevel($depth); + + return null; + } - $indi = new \PhpGedcom\Record\Indi(); - $indi->setId($identifier); + $indi = new \PhpGedcom\Record\Indi(); + $indi->setId($identifier); - $parser->getGedcom()->addIndi($indi); + $parser->getGedcom()->addIndi($indi); - $parser->forward(); + $parser->forward(); - while (!$parser->eof()) { - $record = $parser->getCurrentLineRecord(); - $recordType = strtoupper(trim($record[1])); - $currentDepth = (int) $record[0]; + while (!$parser->eof()) { + $record = $parser->getCurrentLineRecord(); + $recordType = strtoupper(trim($record[1])); + $currentDepth = (int) $record[0]; - if ($currentDepth <= $depth) { - $parser->back(); - break; - } + if ($currentDepth <= $depth) { + $parser->back(); + break; + } - switch ($recordType) { - case '_UID': - $indi->setUid(trim($record[2])); - break; - case 'RESN': - $indi->setResn(trim($record[2])); - break; - case 'NAME': - $name = \PhpGedcom\Parser\Indi\Name::parse($parser); - $indi->addName($name); - break; - case 'SEX': - $indi->setSex(isset($record[2]) ? trim($record[2]) : ''); - break; - case 'ADOP': - case 'BIRT': - case 'BAPM': - case 'BARM': - case 'BASM': - case 'BLES': - case 'BURI': - case 'CENS': - case 'CHR': - case 'CHRA': - case 'CONF': - case 'CREM': - case 'DEAT': - case 'EMIG': - case 'FCOM': - case 'GRAD': - case 'IMMI': - case 'NATU': - case 'ORDN': - case 'RETI': - case 'PROB': - case 'WILL': - case 'EVEN': - $className = ucfirst(strtolower($recordType)); - $class = '\\PhpGedcom\\Parser\\Indi\\' . $className; + switch ($recordType) { + case '_UID': + $indi->setUid(trim($record[2])); + break; + case 'RESN': + $indi->setResn(trim($record[2])); + break; + case 'NAME': + $name = \PhpGedcom\Parser\Indi\Name::parse($parser); + $indi->addName($name); + break; + case 'SEX': + $indi->setSex(isset($record[2]) ? trim($record[2]) : ''); + break; + case 'ADOP': + case 'BIRT': + case 'BAPM': + case 'BARM': + case 'BASM': + case 'BLES': + case 'BURI': + case 'CENS': + case 'CHR': + case 'CHRA': + case 'CONF': + case 'CREM': + case 'DEAT': + case 'EMIG': + case 'FCOM': + case 'GRAD': + case 'IMMI': + case 'NATU': + case 'ORDN': + case 'RETI': + case 'PROB': + case 'WILL': + case 'EVEN': + $className = ucfirst(strtolower($recordType)); + $class = '\\PhpGedcom\\Parser\\Indi\\'.$className; - $event = $class::parse($parser); - $indi->addEven($event); - break; - case 'CAST': - case 'DSCR': - case 'EDUC': - case 'IDNO': - case 'NATI': - case 'NCHI': - case 'NMR': - case 'OCCU': - case 'PROP': - case 'RELI': - case 'RESI': - case 'SSN': - case 'TITL': - $className = ucfirst(strtolower($recordType)); - $class = '\\PhpGedcom\\Parser\\Indi\\' . $className; + $event = $class::parse($parser); + $indi->addEven($event); + break; + case 'CAST': + case 'DSCR': + case 'EDUC': + case 'IDNO': + case 'NATI': + case 'NCHI': + case 'NMR': + case 'OCCU': + case 'PROP': + case 'RELI': + case 'RESI': + case 'SSN': + case 'TITL': + $className = ucfirst(strtolower($recordType)); + $class = '\\PhpGedcom\\Parser\\Indi\\'.$className; - $att = $class::parse($parser); - $indi->addAttr($att); - break; - case 'BAPL': - case 'CONL': - case 'ENDL': - case 'SLGC': - $className = ucfirst(strtolower($recordType)); - $class = '\\PhpGedcom\\Parser\\Indi\\' . $className; + $att = $class::parse($parser); + $indi->addAttr($att); + break; + case 'BAPL': + case 'CONL': + case 'ENDL': + case 'SLGC': + $className = ucfirst(strtolower($recordType)); + $class = '\\PhpGedcom\\Parser\\Indi\\'.$className; - $lds = $class::parse($parser); - $indi->{'add' . $recordType}[] = $lds; - break; - case 'FAMC': - $famc = \PhpGedcom\Parser\Indi\Famc::parse($parser); - if ($famc) { - $indi->addFamc($famc); - } - break; - case 'FAMS': - $fams = \PhpGedcom\Parser\Indi\Fams::parse($parser); - if ($fams) { - $indi->addFams($fams); - } - break; - case 'SUBM': - $indi->addSubm($parser->normalizeIdentifier($record[2])); - break; - case 'ASSO': - $asso = \PhpGedcom\Parser\Indi\Asso::parse($parser); - $indi->addAsso($asso); - break; - case 'ALIA': - $indi->addAlia($parser->normalizeIdentifier($record[2])); - break; - case 'ANCI': - $indi->addAnci($parser->normalizeIdentifier($record[2])); - break; - case 'DESI': - $indi->addDesi($parser->normalizeIdentifier($record[2])); - break; - case 'RFN': - $indi->setRfn(trim($record[2])); - break; - case 'AFN': - $indi->setAfn(trim($record[2])); - break; - case 'REFN': - $ref = \PhpGedcom\Parser\Refn::parse($parser); - $indi->addRefn($ref); - break; - case 'RIN': - $indi->setRin(trim($record[2])); - break; - case 'CHAN': - $chan = \PhpGedcom\Parser\Chan::parse($parser); - $indi->setChan($chan); - break; - case 'NOTE': - $note = \PhpGedcom\Parser\NoteRef::parse($parser); - if ($note) { - $indi->addNote($note); - } - break; - case 'SOUR': - $sour = \PhpGedcom\Parser\SourRef::parse($parser); - $indi->addSour($sour); - break; - case 'OBJE': - $obje = \PhpGedcom\Parser\ObjeRef::parse($parser); - $indi->addObje($obje); - break; - default: - $parser->logUnhandledRecord(get_class() . ' @ ' . __LINE__); - } + $lds = $class::parse($parser); + $indi->{'add'.$recordType}[] = $lds; + break; + case 'FAMC': + $famc = \PhpGedcom\Parser\Indi\Famc::parse($parser); + if ($famc) { + $indi->addFamc($famc); + } + break; + case 'FAMS': + $fams = \PhpGedcom\Parser\Indi\Fams::parse($parser); + if ($fams) { + $indi->addFams($fams); + } + break; + case 'SUBM': + $indi->addSubm($parser->normalizeIdentifier($record[2])); + break; + case 'ASSO': + $asso = \PhpGedcom\Parser\Indi\Asso::parse($parser); + $indi->addAsso($asso); + break; + case 'ALIA': + $indi->addAlia($parser->normalizeIdentifier($record[2])); + break; + case 'ANCI': + $indi->addAnci($parser->normalizeIdentifier($record[2])); + break; + case 'DESI': + $indi->addDesi($parser->normalizeIdentifier($record[2])); + break; + case 'RFN': + $indi->setRfn(trim($record[2])); + break; + case 'AFN': + $indi->setAfn(trim($record[2])); + break; + case 'REFN': + $ref = \PhpGedcom\Parser\Refn::parse($parser); + $indi->addRefn($ref); + break; + case 'RIN': + $indi->setRin(trim($record[2])); + break; + case 'CHAN': + $chan = \PhpGedcom\Parser\Chan::parse($parser); + $indi->setChan($chan); + break; + case 'NOTE': + $note = \PhpGedcom\Parser\NoteRef::parse($parser); + if ($note) { + $indi->addNote($note); + } + break; + case 'SOUR': + $sour = \PhpGedcom\Parser\SourRef::parse($parser); + $indi->addSour($sour); + break; + case 'OBJE': + $obje = \PhpGedcom\Parser\ObjeRef::parse($parser); + $indi->addObje($obje); + break; + default: + $parser->logUnhandledRecord(get_class().' @ '.__LINE__); + } - $parser->forward(); - } + $parser->forward(); + } - return $indi; - } + return $indi; + } } diff --git a/library/PhpGedcom/Parser/Indi/Adop.php b/library/PhpGedcom/Parser/Indi/Adop.php index ebe3125d..4fbaca06 100644 --- a/library/PhpGedcom/Parser/Indi/Adop.php +++ b/library/PhpGedcom/Parser/Indi/Adop.php @@ -1,36 +1,34 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Parser\Indi; -/** - * - * - */ class Adop extends \PhpGedcom\Parser\Indi\Even { public static function parseAdop($parser, $even) { $record = $parser->getCurrentLineRecord(); - if(isset($record[1])) - $even->setAdop(trim($record[2])); + if (isset($record[1])) { + $even->setAdop(trim($record[2])); + } } public static function parseFamc($parser, $even) { $record = $parser->getCurrentLineRecord(); - if(isset($record[1])) - $even->setFamc(trim($record[2])); + if (isset($record[1])) { + $even->setFamc(trim($record[2])); + } } } diff --git a/library/PhpGedcom/Parser/Indi/Asso.php b/library/PhpGedcom/Parser/Indi/Asso.php index 9b2b96d0..ca4b4edc 100644 --- a/library/PhpGedcom/Parser/Indi/Asso.php +++ b/library/PhpGedcom/Parser/Indi/Asso.php @@ -1,50 +1,40 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Parser\Indi; -/** - * - * - */ class Asso extends \PhpGedcom\Parser\Component { - - /** - * - * - */ public static function parse(\PhpGedcom\Parser $parser) { $record = $parser->getCurrentLineRecord(); - $depth = (int)$record[0]; - if(isset($record[2])){ - $asso = new \PhpGedcom\Record\Indi\Asso(); - $asso->setIndi($parser->normalizeIdentifier($record[2])); - } - else{ - $parser->skipToNextLevel($depth); - return null; - } + $depth = (int) $record[0]; + if (isset($record[2])) { + $asso = new \PhpGedcom\Record\Indi\Asso(); + $asso->setIndi($parser->normalizeIdentifier($record[2])); + } else { + $parser->skipToNextLevel($depth); + return null; + } $parser->forward(); while (!$parser->eof()) { $record = $parser->getCurrentLineRecord(); $recordType = strtoupper(trim($record[1])); - $currentDepth = (int)$record[0]; + $currentDepth = (int) $record[0]; if ($currentDepth <= $depth) { $parser->back(); @@ -66,7 +56,7 @@ public static function parse(\PhpGedcom\Parser $parser) } break; default: - $parser->logUnhandledRecord(get_class() . ' @ ' . __LINE__); + $parser->logUnhandledRecord(get_class().' @ '.__LINE__); } $parser->forward(); diff --git a/library/PhpGedcom/Parser/Indi/Attr.php b/library/PhpGedcom/Parser/Indi/Attr.php index 0f49dc36..17f18e5d 100644 --- a/library/PhpGedcom/Parser/Indi/Attr.php +++ b/library/PhpGedcom/Parser/Indi/Attr.php @@ -1,43 +1,34 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Parser\Indi; -/** - * - * - */ abstract class Attr extends \PhpGedcom\Parser\Component { - - /** - * - * - */ public static function parse(\PhpGedcom\Parser $parser) { $record = $parser->getCurrentLineRecord(); - $depth = (int)$record[0]; - if(isset($record[1])){ - $className = '\\PhpGedcom\\Record\\Indi\\' . ucfirst(strtolower(trim($record[1]))); - $attr = new $className(); + $depth = (int) $record[0]; + if (isset($record[1])) { + $className = '\\PhpGedcom\\Record\\Indi\\'.ucfirst(strtolower(trim($record[1]))); + $attr = new $className(); - $attr->setType(trim($record[1])); - } - else{ - $parser->skipToNextLevel($depth); - return null; + $attr->setType(trim($record[1])); + } else { + $parser->skipToNextLevel($depth); + + return null; } if (isset($record[2])) { @@ -49,7 +40,7 @@ public static function parse(\PhpGedcom\Parser $parser) while (!$parser->eof()) { $record = $parser->getCurrentLineRecord(); $recordType = strtoupper(trim($record[1])); - $currentDepth = (int)$record[0]; + $currentDepth = (int) $record[0]; if ($currentDepth <= $depth) { $parser->back(); @@ -98,7 +89,7 @@ public static function parse(\PhpGedcom\Parser $parser) } break; default: - $parser->logUnhandledRecord(get_class() . ' @ ' . __LINE__); + $parser->logUnhandledRecord(get_class().' @ '.__LINE__); } $parser->forward(); diff --git a/library/PhpGedcom/Parser/Indi/Bapl.php b/library/PhpGedcom/Parser/Indi/Bapl.php index 51f7b5ff..7ddc8c96 100644 --- a/library/PhpGedcom/Parser/Indi/Bapl.php +++ b/library/PhpGedcom/Parser/Indi/Bapl.php @@ -1,22 +1,19 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Parser\Indi; -/** - * - */ class Bapl extends Lds { } diff --git a/library/PhpGedcom/Parser/Indi/Bapm.php b/library/PhpGedcom/Parser/Indi/Bapm.php index 89473790..6cb91df2 100644 --- a/library/PhpGedcom/Parser/Indi/Bapm.php +++ b/library/PhpGedcom/Parser/Indi/Bapm.php @@ -1,23 +1,19 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Parser\Indi; -/** - * - * - */ class Bapm extends \PhpGedcom\Parser\Indi\Even { } diff --git a/library/PhpGedcom/Parser/Indi/Barm.php b/library/PhpGedcom/Parser/Indi/Barm.php index 7528ebf5..5e759ed5 100644 --- a/library/PhpGedcom/Parser/Indi/Barm.php +++ b/library/PhpGedcom/Parser/Indi/Barm.php @@ -1,23 +1,19 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Parser\Indi; -/** - * - * - */ class Barm extends \PhpGedcom\Parser\Indi\Even { } diff --git a/library/PhpGedcom/Parser/Indi/Basm.php b/library/PhpGedcom/Parser/Indi/Basm.php index c2b69827..7c2425a6 100644 --- a/library/PhpGedcom/Parser/Indi/Basm.php +++ b/library/PhpGedcom/Parser/Indi/Basm.php @@ -1,23 +1,19 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Parser\Indi; -/** - * - * - */ class Basm extends \PhpGedcom\Parser\Indi\Even { } diff --git a/library/PhpGedcom/Parser/Indi/Birt.php b/library/PhpGedcom/Parser/Indi/Birt.php index 24a9c5cb..1097fede 100644 --- a/library/PhpGedcom/Parser/Indi/Birt.php +++ b/library/PhpGedcom/Parser/Indi/Birt.php @@ -1,29 +1,26 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Parser\Indi; -/** - * - * - */ class Birt extends \PhpGedcom\Parser\Indi\Even { public static function parseFamc($parser, $even) { $record = $parser->getCurrentLineRecord(); - if(isset($record[2])) - $even->setFamc(trim($record[2])); + if (isset($record[2])) { + $even->setFamc(trim($record[2])); + } } } diff --git a/library/PhpGedcom/Parser/Indi/Bles.php b/library/PhpGedcom/Parser/Indi/Bles.php index 8e980649..e0c1cd00 100644 --- a/library/PhpGedcom/Parser/Indi/Bles.php +++ b/library/PhpGedcom/Parser/Indi/Bles.php @@ -1,23 +1,19 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Parser\Indi; -/** - * - * - */ class Bles extends \PhpGedcom\Parser\Indi\Even { } diff --git a/library/PhpGedcom/Parser/Indi/Buri.php b/library/PhpGedcom/Parser/Indi/Buri.php index d7a7f44f..ad06eec7 100644 --- a/library/PhpGedcom/Parser/Indi/Buri.php +++ b/library/PhpGedcom/Parser/Indi/Buri.php @@ -1,23 +1,19 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Parser\Indi; -/** - * - * - */ class Buri extends \PhpGedcom\Parser\Indi\Even { } diff --git a/library/PhpGedcom/Parser/Indi/Cast.php b/library/PhpGedcom/Parser/Indi/Cast.php index 444537c5..99789056 100644 --- a/library/PhpGedcom/Parser/Indi/Cast.php +++ b/library/PhpGedcom/Parser/Indi/Cast.php @@ -1,23 +1,19 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Parser\Indi; -/** - * - * - */ class Cast extends \PhpGedcom\Parser\Indi\Attr { } diff --git a/library/PhpGedcom/Parser/Indi/Cens.php b/library/PhpGedcom/Parser/Indi/Cens.php index f49bd006..86899215 100644 --- a/library/PhpGedcom/Parser/Indi/Cens.php +++ b/library/PhpGedcom/Parser/Indi/Cens.php @@ -1,23 +1,19 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Parser\Indi; -/** - * - * - */ class Cens extends \PhpGedcom\Parser\Indi\Even { } diff --git a/library/PhpGedcom/Parser/Indi/Chr.php b/library/PhpGedcom/Parser/Indi/Chr.php index 0a15db78..5654c707 100644 --- a/library/PhpGedcom/Parser/Indi/Chr.php +++ b/library/PhpGedcom/Parser/Indi/Chr.php @@ -1,30 +1,26 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Parser\Indi; -/** - * - * - */ class Chr extends \PhpGedcom\Parser\Indi\Even { public static function parseFamc($parser, $even) { $record = $parser->getCurrentLineRecord(); - if(isset($record[2])){ - $even->setFamc(trim($record[2])); + if (isset($record[2])) { + $even->setFamc(trim($record[2])); } } } diff --git a/library/PhpGedcom/Parser/Indi/Chra.php b/library/PhpGedcom/Parser/Indi/Chra.php index 5d147a93..0540e945 100644 --- a/library/PhpGedcom/Parser/Indi/Chra.php +++ b/library/PhpGedcom/Parser/Indi/Chra.php @@ -1,23 +1,19 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Parser\Indi; -/** - * - * - */ class Chra extends \PhpGedcom\Parser\Indi\Even { } diff --git a/library/PhpGedcom/Parser/Indi/Conf.php b/library/PhpGedcom/Parser/Indi/Conf.php index e9e77c48..7b4e5872 100644 --- a/library/PhpGedcom/Parser/Indi/Conf.php +++ b/library/PhpGedcom/Parser/Indi/Conf.php @@ -1,23 +1,19 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Parser\Indi; -/** - * - * - */ class Conf extends \PhpGedcom\Parser\Indi\Even { } diff --git a/library/PhpGedcom/Parser/Indi/Conl.php b/library/PhpGedcom/Parser/Indi/Conl.php index abb234ab..fffd5ed7 100644 --- a/library/PhpGedcom/Parser/Indi/Conl.php +++ b/library/PhpGedcom/Parser/Indi/Conl.php @@ -1,23 +1,19 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Parser\Indi; -/** - * - * - */ class Conl extends Lds { } diff --git a/library/PhpGedcom/Parser/Indi/Crem.php b/library/PhpGedcom/Parser/Indi/Crem.php index 6ec8d82a..e2efa06b 100644 --- a/library/PhpGedcom/Parser/Indi/Crem.php +++ b/library/PhpGedcom/Parser/Indi/Crem.php @@ -1,23 +1,19 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Parser\Indi; -/** - * - * - */ class Crem extends \PhpGedcom\Parser\Indi\Even { } diff --git a/library/PhpGedcom/Parser/Indi/Deat.php b/library/PhpGedcom/Parser/Indi/Deat.php index 0c991a2c..8bfb3523 100644 --- a/library/PhpGedcom/Parser/Indi/Deat.php +++ b/library/PhpGedcom/Parser/Indi/Deat.php @@ -1,23 +1,19 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Parser\Indi; -/** - * - * - */ class Deat extends \PhpGedcom\Parser\Indi\Even { } diff --git a/library/PhpGedcom/Parser/Indi/Dscr.php b/library/PhpGedcom/Parser/Indi/Dscr.php index 49eca70a..3e0240e5 100644 --- a/library/PhpGedcom/Parser/Indi/Dscr.php +++ b/library/PhpGedcom/Parser/Indi/Dscr.php @@ -1,23 +1,19 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Parser\Indi; -/** - * - * - */ class Dscr extends \PhpGedcom\Parser\Indi\Attr { } diff --git a/library/PhpGedcom/Parser/Indi/Educ.php b/library/PhpGedcom/Parser/Indi/Educ.php index 98590e49..30e9b6f0 100644 --- a/library/PhpGedcom/Parser/Indi/Educ.php +++ b/library/PhpGedcom/Parser/Indi/Educ.php @@ -1,23 +1,19 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Parser\Indi; -/** - * - * - */ class Educ extends \PhpGedcom\Parser\Indi\Attr { } diff --git a/library/PhpGedcom/Parser/Indi/Emig.php b/library/PhpGedcom/Parser/Indi/Emig.php index 81295d59..18e7e536 100644 --- a/library/PhpGedcom/Parser/Indi/Emig.php +++ b/library/PhpGedcom/Parser/Indi/Emig.php @@ -1,23 +1,19 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Parser\Indi; -/** - * - * - */ class Emig extends \PhpGedcom\Parser\Indi\Even { } diff --git a/library/PhpGedcom/Parser/Indi/Endl.php b/library/PhpGedcom/Parser/Indi/Endl.php index e44bb2a9..6021c2d9 100644 --- a/library/PhpGedcom/Parser/Indi/Endl.php +++ b/library/PhpGedcom/Parser/Indi/Endl.php @@ -1,23 +1,19 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Parser\Indi; -/** - * - * - */ class Endl extends Lds { } diff --git a/library/PhpGedcom/Parser/Indi/Even.php b/library/PhpGedcom/Parser/Indi/Even.php index 8b63057d..9da06ccd 100644 --- a/library/PhpGedcom/Parser/Indi/Even.php +++ b/library/PhpGedcom/Parser/Indi/Even.php @@ -1,14 +1,14 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ @@ -16,36 +16,30 @@ use PhpGedcom\Parser\Chan; -/** - * - * - */ -class Even extends \PhpGedcom\Parser\Component { +class Even extends \PhpGedcom\Parser\Component +{ + public static function parse(\PhpGedcom\Parser $parser) + { + $record = $parser->getCurrentLineRecord(); + $depth = (int) $record[0]; + if (empty($record[1])) { + $parser->skipToNextLevel($depth); - /** - * - * - */ - public static function parse(\PhpGedcom\Parser $parser) { - $record = $parser->getCurrentLineRecord(); - $depth = (int) $record[0]; - if (empty($record[1])) { - $parser->skipToNextLevel($depth); - return null; - } + return null; + } - $even = null; + $even = null; - if (strtoupper(trim($record[1])) != 'EVEN') { - $className = '\\PhpGedcom\\Record\\Indi\\' . ucfirst(strtolower(trim($record[1]))); - $even = new $className(); - } else { - $even = new \PhpGedcom\Record\Indi\Even(); - } + if (strtoupper(trim($record[1])) != 'EVEN') { + $className = '\\PhpGedcom\\Record\\Indi\\'.ucfirst(strtolower(trim($record[1]))); + $even = new $className(); + } else { + $even = new \PhpGedcom\Record\Indi\Even(); + } - if (isset($record[1]) && strtoupper(trim($record[1])) != 'EVEN') { - $even->setType(trim($record[1])); - } + if (isset($record[1]) && strtoupper(trim($record[1])) != 'EVEN') { + $even->setType(trim($record[1])); + } // ensures we capture any data following the EVEN type if (isset($record[2]) && !empty($record[2])) { @@ -54,78 +48,78 @@ public static function parse(\PhpGedcom\Parser $parser) { $parser->forward(); - while (!$parser->eof()) { - $record = $parser->getCurrentLineRecord(); - $recordType = strtoupper(trim($record[1])); - $currentDepth = (int) $record[0]; + while (!$parser->eof()) { + $record = $parser->getCurrentLineRecord(); + $recordType = strtoupper(trim($record[1])); + $currentDepth = (int) $record[0]; - if ($currentDepth <= $depth) { - $parser->back(); - break; - } + if ($currentDepth <= $depth) { + $parser->back(); + break; + } - switch ($recordType) { - case 'TYPE': - $even->setType(trim($record[2])); - break; - case 'DATE': - $dat = \PhpGedcom\Parser\Date::parse($parser); - $even->setDate($dat); - //$even->setDate(trim($record[2])) - break; - case 'PLAC': - $plac = \PhpGedcom\Parser\Plac::parse($parser); - $even->setPlac($plac); - break; - case 'ADDR': - $even->setAddr(\PhpGedcom\Parser\Addr::parse($parser)); - break; - case 'PHON': - $phone = \PhpGedcom\Parser\Phon::parse($parser); - $even->addPhone($phone); - break; - case 'CAUS': - $even->setCaus(trim($record[2])); - break; - case 'AGE': - $even->setAge(trim($record[2])); - break; - case 'AGNC': - $even->setAgnc(trim($record[2])); - break; - case 'SOUR': - $sour = \PhpGedcom\Parser\SourRef::parse($parser); - $even->addSour($sour); - break; - case 'OBJE': - $obje = \PhpGedcom\Parser\ObjeRef::parse($parser); - $even->addObje($obje); - break; - case 'NOTE': - $note = \PhpGedcom\Parser\NoteRef::parse($parser); - if ($note) { - $even->addNote($note); - } - break; - case 'CHAN': - $change = Chan::parse($parser); - $even->setChan($change); - break; - default: - $self = get_called_class(); - $method = 'parse' . $recordType; + switch ($recordType) { + case 'TYPE': + $even->setType(trim($record[2])); + break; + case 'DATE': + $dat = \PhpGedcom\Parser\Date::parse($parser); + $even->setDate($dat); + //$even->setDate(trim($record[2])) + break; + case 'PLAC': + $plac = \PhpGedcom\Parser\Plac::parse($parser); + $even->setPlac($plac); + break; + case 'ADDR': + $even->setAddr(\PhpGedcom\Parser\Addr::parse($parser)); + break; + case 'PHON': + $phone = \PhpGedcom\Parser\Phon::parse($parser); + $even->addPhone($phone); + break; + case 'CAUS': + $even->setCaus(trim($record[2])); + break; + case 'AGE': + $even->setAge(trim($record[2])); + break; + case 'AGNC': + $even->setAgnc(trim($record[2])); + break; + case 'SOUR': + $sour = \PhpGedcom\Parser\SourRef::parse($parser); + $even->addSour($sour); + break; + case 'OBJE': + $obje = \PhpGedcom\Parser\ObjeRef::parse($parser); + $even->addObje($obje); + break; + case 'NOTE': + $note = \PhpGedcom\Parser\NoteRef::parse($parser); + if ($note) { + $even->addNote($note); + } + break; + case 'CHAN': + $change = Chan::parse($parser); + $even->setChan($change); + break; + default: + $self = get_called_class(); + $method = 'parse'.$recordType; - if (method_exists($self, $method)) { - $self::$method($parser, $even); - } else { - $parser->logUnhandledRecord($self . ' @ ' . __LINE__); - $parser->skipToNextLevel($currentDepth); - } - } + if (method_exists($self, $method)) { + $self::$method($parser, $even); + } else { + $parser->logUnhandledRecord($self.' @ '.__LINE__); + $parser->skipToNextLevel($currentDepth); + } + } - $parser->forward(); - } + $parser->forward(); + } - return $even; - } + return $even; + } } diff --git a/library/PhpGedcom/Parser/Indi/Even/Plac.php b/library/PhpGedcom/Parser/Indi/Even/Plac.php index ea4de0d3..20db6830 100644 --- a/library/PhpGedcom/Parser/Indi/Even/Plac.php +++ b/library/PhpGedcom/Parser/Indi/Even/Plac.php @@ -1,34 +1,25 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Parser\Indi\Even; -/** - * - * - */ class Plac extends \PhpGedcom\Parser\Component { - - /** - * - * - */ public static function parse(\PhpGedcom\Parser $parser) { $record = $parser->getCurrentLineRecord(); - $depth = (int)$record[0]; + $depth = (int) $record[0]; $plac = new \PhpGedcom\Record\Indi\Even\Plac(); @@ -41,7 +32,7 @@ public static function parse(\PhpGedcom\Parser $parser) while (!$parser->eof()) { $record = $parser->getCurrentLineRecord(); $recordType = strtoupper(trim($record[1])); - $currentDepth = (int)$record[0]; + $currentDepth = (int) $record[0]; if ($currentDepth <= $depth) { $parser->back(); @@ -63,7 +54,7 @@ public static function parse(\PhpGedcom\Parser $parser) $plac->addSour($sour); break; default: - $parser->logUnhandledRecord(get_class() . ' @ ' . __LINE__); + $parser->logUnhandledRecord(get_class().' @ '.__LINE__); } $parser->forward(); diff --git a/library/PhpGedcom/Parser/Indi/Famc.php b/library/PhpGedcom/Parser/Indi/Famc.php index 44fba3ac..d930589b 100644 --- a/library/PhpGedcom/Parser/Indi/Famc.php +++ b/library/PhpGedcom/Parser/Indi/Famc.php @@ -1,38 +1,30 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Parser\Indi; -/** - * - * - */ class Famc extends \PhpGedcom\Parser\Component { - - /** - * - * - */ public static function parse(\PhpGedcom\Parser $parser) { $record = $parser->getCurrentLineRecord(); - $depth = (int)$record[0]; + $depth = (int) $record[0]; if (count($record) < 3) { - $parser->logSkippedRecord('Missing family information; ' . get_class(), ' @ ' . __LINE__); + $parser->logSkippedRecord('Missing family information; '.get_class(), ' @ '.__LINE__); $parser->skipToNextLevel($depth); + return null; } @@ -46,7 +38,7 @@ public static function parse(\PhpGedcom\Parser $parser) while (!$parser->eof()) { $record = $parser->getCurrentLineRecord(); $recordType = strtoupper(trim($record[1])); - $currentDepth = (int)$record[0]; + $currentDepth = (int) $record[0]; if ($currentDepth <= $depth) { $parser->back(); @@ -64,7 +56,7 @@ public static function parse(\PhpGedcom\Parser $parser) } break; default: - $parser->logUnhandledRecord(get_class() . ' @ ' . __LINE__); + $parser->logUnhandledRecord(get_class().' @ '.__LINE__); } $parser->forward(); diff --git a/library/PhpGedcom/Parser/Indi/Fams.php b/library/PhpGedcom/Parser/Indi/Fams.php index 65cb6a5a..a4e8b5ee 100644 --- a/library/PhpGedcom/Parser/Indi/Fams.php +++ b/library/PhpGedcom/Parser/Indi/Fams.php @@ -1,38 +1,30 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Parser\Indi; -/** - * - * - */ class Fams extends \PhpGedcom\Parser\Component { - - /** - * - * - */ public static function parse(\PhpGedcom\Parser $parser) { $record = $parser->getCurrentLineRecord(); - $depth = (int)$record[0]; + $depth = (int) $record[0]; if (count($record) < 3) { - $parser->logSkippedRecord('Missing family information; ' . get_class(), ' @ ' . __LINE__); + $parser->logSkippedRecord('Missing family information; '.get_class(), ' @ '.__LINE__); $parser->skipToNextLevel($depth); + return null; } @@ -46,7 +38,7 @@ public static function parse(\PhpGedcom\Parser $parser) while (!$parser->eof()) { $record = $parser->getCurrentLineRecord(); $recordType = strtoupper(trim($record[1])); - $currentDepth = (int)$record[0]; + $currentDepth = (int) $record[0]; if ($currentDepth <= $depth) { $parser->back(); @@ -61,7 +53,7 @@ public static function parse(\PhpGedcom\Parser $parser) } break; default: - $parser->logUnhandledRecord(get_class() . ' @ ' . __LINE__); + $parser->logUnhandledRecord(get_class().' @ '.__LINE__); } $parser->forward(); diff --git a/library/PhpGedcom/Parser/Indi/Fcom.php b/library/PhpGedcom/Parser/Indi/Fcom.php index bbeca618..6cf0f0c7 100644 --- a/library/PhpGedcom/Parser/Indi/Fcom.php +++ b/library/PhpGedcom/Parser/Indi/Fcom.php @@ -1,23 +1,19 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Parser\Indi; -/** - * - * - */ class Fcom extends \PhpGedcom\Parser\Indi\Even { } diff --git a/library/PhpGedcom/Parser/Indi/Grad.php b/library/PhpGedcom/Parser/Indi/Grad.php index 1630b874..e23024f2 100644 --- a/library/PhpGedcom/Parser/Indi/Grad.php +++ b/library/PhpGedcom/Parser/Indi/Grad.php @@ -1,23 +1,19 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Parser\Indi; -/** - * - * - */ class Grad extends \PhpGedcom\Parser\Indi\Even { } diff --git a/library/PhpGedcom/Parser/Indi/Idno.php b/library/PhpGedcom/Parser/Indi/Idno.php index aebb93b8..772b1a21 100644 --- a/library/PhpGedcom/Parser/Indi/Idno.php +++ b/library/PhpGedcom/Parser/Indi/Idno.php @@ -1,23 +1,19 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Parser\Indi; -/** - * - * - */ class Idno extends \PhpGedcom\Parser\Indi\Attr { } diff --git a/library/PhpGedcom/Parser/Indi/Immi.php b/library/PhpGedcom/Parser/Indi/Immi.php index 5299215b..191eac06 100644 --- a/library/PhpGedcom/Parser/Indi/Immi.php +++ b/library/PhpGedcom/Parser/Indi/Immi.php @@ -1,23 +1,19 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Parser\Indi; -/** - * - * - */ class Immi extends \PhpGedcom\Parser\Indi\Even { } diff --git a/library/PhpGedcom/Parser/Indi/Lds.php b/library/PhpGedcom/Parser/Indi/Lds.php index 03de6614..c2c68342 100644 --- a/library/PhpGedcom/Parser/Indi/Lds.php +++ b/library/PhpGedcom/Parser/Indi/Lds.php @@ -1,50 +1,40 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Parser\Indi; -/** - * - * - */ abstract class Lds extends \PhpGedcom\Parser\Component { - - /** - * - * - */ public static function parse(\PhpGedcom\Parser $parser) { $record = $parser->getCurrentLineRecord(); - $depth = (int)$record[0]; - if(isset($record[1])){ - $className = '\\PhpGedcom\\Record\\Indi\\' . ucfirst(strtolower(trim($record[1]))); - $lds = new $className(); - } - else{ - $parser->skipToNextLevel($depth); - return null; - } + $depth = (int) $record[0]; + if (isset($record[1])) { + $className = '\\PhpGedcom\\Record\\Indi\\'.ucfirst(strtolower(trim($record[1]))); + $lds = new $className(); + } else { + $parser->skipToNextLevel($depth); + return null; + } $parser->forward(); while (!$parser->eof()) { $record = $parser->getCurrentLineRecord(); $recordType = strtoupper(trim($record[1])); - $currentDepth = (int)$record[0]; + $currentDepth = (int) $record[0]; if ($currentDepth <= $depth) { $parser->back(); @@ -76,12 +66,12 @@ public static function parse(\PhpGedcom\Parser $parser) break; default: $self = get_called_class(); - $method = 'parse' . $recordType; + $method = 'parse'.$recordType; if (method_exists($self, $method)) { $self::$method($parser, $lds); } else { - $parser->logUnhandledRecord($self . ' @ ' . __LINE__); + $parser->logUnhandledRecord($self.' @ '.__LINE__); } } diff --git a/library/PhpGedcom/Parser/Indi/Name.php b/library/PhpGedcom/Parser/Indi/Name.php index 971ff1ce..af5e0a55 100644 --- a/library/PhpGedcom/Parser/Indi/Name.php +++ b/library/PhpGedcom/Parser/Indi/Name.php @@ -1,50 +1,40 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Parser\Indi; -/** - * - * - */ class Name extends \PhpGedcom\Parser\Component { - - /** - * - * - */ public static function parse(\PhpGedcom\Parser $parser) { $record = $parser->getCurrentLineRecord(); - $depth = (int)$record[0]; - if(isset($record[2])){ - $name = new \PhpGedcom\Record\Indi\Name(); - $name->setName(trim($record[2])); - } - else{ - $parser->skipToNextLevel($depth); - return null; - } + $depth = (int) $record[0]; + if (isset($record[2])) { + $name = new \PhpGedcom\Record\Indi\Name(); + $name->setName(trim($record[2])); + } else { + $parser->skipToNextLevel($depth); + return null; + } $parser->forward(); while (!$parser->eof()) { $record = $parser->getCurrentLineRecord(); $recordType = strtoupper(trim($record[1])); - $currentDepth = (int)$record[0]; + $currentDepth = (int) $record[0]; if ($currentDepth <= $depth) { $parser->back(); @@ -94,7 +84,7 @@ public static function parse(\PhpGedcom\Parser $parser) $name->setRomn(\PhpGedcom\Parser\Indi\Name\Romn::parse($parser)); break; default: - $parser->logUnhandledRecord(get_class() . ' @ ' . __LINE__); + $parser->logUnhandledRecord(get_class().' @ '.__LINE__); } $parser->forward(); diff --git a/library/PhpGedcom/Parser/Indi/Name/Fone.php b/library/PhpGedcom/Parser/Indi/Name/Fone.php index 1e303fdf..60b0ca2e 100644 --- a/library/PhpGedcom/Parser/Indi/Name/Fone.php +++ b/library/PhpGedcom/Parser/Indi/Name/Fone.php @@ -1,49 +1,38 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Parser\Indi\Name; -/** - * - * - */ class Fone extends \PhpGedcom\Parser\Component { - - /** - * - * - */ public static function parse(\PhpGedcom\Parser $parser) { $record = $parser->getCurrentLineRecord(); - $depth = (int)$record[0]; - if(isset($record[2])){ - $fone = new \PhpGedcom\Record\Indi\Name\Fone(); - $fone->setFone(trim($record[2])); - } - else{ - return null; + $depth = (int) $record[0]; + if (isset($record[2])) { + $fone = new \PhpGedcom\Record\Indi\Name\Fone(); + $fone->setFone(trim($record[2])); + } else { + return null; } - $parser->forward(); while (!$parser->eof()) { $record = $parser->getCurrentLineRecord(); $recordType = strtoupper(trim($record[1])); - $currentDepth = (int)$record[0]; + $currentDepth = (int) $record[0]; if ($currentDepth <= $depth) { $parser->back(); @@ -57,7 +46,7 @@ public static function parse(\PhpGedcom\Parser $parser) switch ($recordType) { case 'TYPE': $fone->setType(trim($record[2])); - break; + break; case 'NPFX': $fone->setNpfx(trim($record[2])); break; @@ -77,7 +66,7 @@ public static function parse(\PhpGedcom\Parser $parser) $fone->setNsfx(trim($record[2])); break; default: - $parser->logUnhandledRecord(get_class() . ' @ ' . __LINE__); + $parser->logUnhandledRecord(get_class().' @ '.__LINE__); } $parser->forward(); diff --git a/library/PhpGedcom/Parser/Indi/Name/Romn.php b/library/PhpGedcom/Parser/Indi/Name/Romn.php index 06563091..52208c59 100644 --- a/library/PhpGedcom/Parser/Indi/Name/Romn.php +++ b/library/PhpGedcom/Parser/Indi/Name/Romn.php @@ -1,50 +1,40 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Parser\Indi\Name; -/** - * - * - */ class Romn extends \PhpGedcom\Parser\Component { - - /** - * - * - */ public static function parse(\PhpGedcom\Parser $parser) { $record = $parser->getCurrentLineRecord(); - $depth = (int)$record[0]; - if(isset($record[2])){ - $romn = new \PhpGedcom\Record\Indi\Name\Romn(); - $romn->setRomn(trim($record[2])); - } - else{ - $parser->skipToNextLevel($depth); - return null; - } + $depth = (int) $record[0]; + if (isset($record[2])) { + $romn = new \PhpGedcom\Record\Indi\Name\Romn(); + $romn->setRomn(trim($record[2])); + } else { + $parser->skipToNextLevel($depth); + return null; + } $parser->forward(); while (!$parser->eof()) { $record = $parser->getCurrentLineRecord(); $recordType = strtoupper(trim($record[1])); - $currentDepth = (int)$record[0]; + $currentDepth = (int) $record[0]; if ($currentDepth <= $depth) { $parser->back(); @@ -78,7 +68,7 @@ public static function parse(\PhpGedcom\Parser $parser) $romn->setNsfx(trim($record[2])); break; default: - $parser->logUnhandledRecord(get_class() . ' @ ' . __LINE__); + $parser->logUnhandledRecord(get_class().' @ '.__LINE__); } $parser->forward(); diff --git a/library/PhpGedcom/Parser/Indi/Nati.php b/library/PhpGedcom/Parser/Indi/Nati.php index f440d060..fb7d980a 100644 --- a/library/PhpGedcom/Parser/Indi/Nati.php +++ b/library/PhpGedcom/Parser/Indi/Nati.php @@ -1,23 +1,19 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Parser\Indi; -/** - * - * - */ class Nati extends \PhpGedcom\Parser\Indi\Attr { } diff --git a/library/PhpGedcom/Parser/Indi/Natu.php b/library/PhpGedcom/Parser/Indi/Natu.php index e319059e..0cc9b6dd 100644 --- a/library/PhpGedcom/Parser/Indi/Natu.php +++ b/library/PhpGedcom/Parser/Indi/Natu.php @@ -1,23 +1,19 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Parser\Indi; -/** - * - * - */ class Natu extends \PhpGedcom\Parser\Indi\Even { } diff --git a/library/PhpGedcom/Parser/Indi/Nchi.php b/library/PhpGedcom/Parser/Indi/Nchi.php index c59887d5..9b072ac9 100644 --- a/library/PhpGedcom/Parser/Indi/Nchi.php +++ b/library/PhpGedcom/Parser/Indi/Nchi.php @@ -1,23 +1,19 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Parser\Indi; -/** - * - * - */ class Nchi extends \PhpGedcom\Parser\Indi\Attr { } diff --git a/library/PhpGedcom/Parser/Indi/Nmr.php b/library/PhpGedcom/Parser/Indi/Nmr.php index 27ec3420..370f6010 100644 --- a/library/PhpGedcom/Parser/Indi/Nmr.php +++ b/library/PhpGedcom/Parser/Indi/Nmr.php @@ -1,23 +1,19 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Parser\Indi; -/** - * - * - */ class Nmr extends \PhpGedcom\Parser\Indi\Attr { } diff --git a/library/PhpGedcom/Parser/Indi/Occu.php b/library/PhpGedcom/Parser/Indi/Occu.php index 51b3a9d5..dfe0b538 100644 --- a/library/PhpGedcom/Parser/Indi/Occu.php +++ b/library/PhpGedcom/Parser/Indi/Occu.php @@ -1,23 +1,19 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Parser\Indi; -/** - * - * - */ class Occu extends \PhpGedcom\Parser\Indi\Attr { } diff --git a/library/PhpGedcom/Parser/Indi/Ordn.php b/library/PhpGedcom/Parser/Indi/Ordn.php index d67e748e..3e941250 100644 --- a/library/PhpGedcom/Parser/Indi/Ordn.php +++ b/library/PhpGedcom/Parser/Indi/Ordn.php @@ -1,23 +1,19 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Parser\Indi; -/** - * - * - */ class Ordn extends \PhpGedcom\Parser\Indi\Even { } diff --git a/library/PhpGedcom/Parser/Indi/Prob.php b/library/PhpGedcom/Parser/Indi/Prob.php index 1f650637..961f19e2 100644 --- a/library/PhpGedcom/Parser/Indi/Prob.php +++ b/library/PhpGedcom/Parser/Indi/Prob.php @@ -1,23 +1,19 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Parser\Indi; -/** - * - * - */ class Prob extends \PhpGedcom\Parser\Indi\Even { } diff --git a/library/PhpGedcom/Parser/Indi/Prop.php b/library/PhpGedcom/Parser/Indi/Prop.php index 31ac6205..cd5edbaa 100644 --- a/library/PhpGedcom/Parser/Indi/Prop.php +++ b/library/PhpGedcom/Parser/Indi/Prop.php @@ -1,22 +1,19 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ + namespace PhpGedcom\Parser\Indi; -/** - * - * - */ class Prop extends \PhpGedcom\Parser\Indi\Attr { } diff --git a/library/PhpGedcom/Parser/Indi/Reli.php b/library/PhpGedcom/Parser/Indi/Reli.php index 03ef3b0b..0d1cbffb 100644 --- a/library/PhpGedcom/Parser/Indi/Reli.php +++ b/library/PhpGedcom/Parser/Indi/Reli.php @@ -1,23 +1,19 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Parser\Indi; -/** - * - * - */ class Reli extends \PhpGedcom\Parser\Indi\Attr { } diff --git a/library/PhpGedcom/Parser/Indi/Resi.php b/library/PhpGedcom/Parser/Indi/Resi.php index 2a4c83f8..6e20ef11 100644 --- a/library/PhpGedcom/Parser/Indi/Resi.php +++ b/library/PhpGedcom/Parser/Indi/Resi.php @@ -1,23 +1,19 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Parser\Indi; -/** - * - * - */ class Resi extends \PhpGedcom\Parser\Indi\Attr { } diff --git a/library/PhpGedcom/Parser/Indi/Reti.php b/library/PhpGedcom/Parser/Indi/Reti.php index 8f164be4..737aa802 100644 --- a/library/PhpGedcom/Parser/Indi/Reti.php +++ b/library/PhpGedcom/Parser/Indi/Reti.php @@ -1,23 +1,19 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Parser\Indi; -/** - * - * - */ class Reti extends \PhpGedcom\Parser\Indi\Even { } diff --git a/library/PhpGedcom/Parser/Indi/Slgc.php b/library/PhpGedcom/Parser/Indi/Slgc.php index 437fb360..030fc5be 100644 --- a/library/PhpGedcom/Parser/Indi/Slgc.php +++ b/library/PhpGedcom/Parser/Indi/Slgc.php @@ -1,28 +1,21 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Parser\Indi; -/** - * - * - */ class Slgc extends Lds { - /** - * - */ public static function parseFamc($parser, $slgc) { $record = $parser->getCurrentLineRecord(); diff --git a/library/PhpGedcom/Parser/Indi/Ssn.php b/library/PhpGedcom/Parser/Indi/Ssn.php index 07bc27bc..1c5e38e4 100644 --- a/library/PhpGedcom/Parser/Indi/Ssn.php +++ b/library/PhpGedcom/Parser/Indi/Ssn.php @@ -1,23 +1,19 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Parser\Indi; -/** - * - * - */ class Ssn extends \PhpGedcom\Parser\Indi\Attr { } diff --git a/library/PhpGedcom/Parser/Indi/Titl.php b/library/PhpGedcom/Parser/Indi/Titl.php index b44912ba..8830ef25 100644 --- a/library/PhpGedcom/Parser/Indi/Titl.php +++ b/library/PhpGedcom/Parser/Indi/Titl.php @@ -1,23 +1,19 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Parser\Indi; -/** - * - * - */ class Titl extends \PhpGedcom\Parser\Indi\Attr { } diff --git a/library/PhpGedcom/Parser/Indi/Will.php b/library/PhpGedcom/Parser/Indi/Will.php index c7812111..6c3b5ba5 100644 --- a/library/PhpGedcom/Parser/Indi/Will.php +++ b/library/PhpGedcom/Parser/Indi/Will.php @@ -1,23 +1,19 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Parser\Indi; -/** - * - * - */ class Will extends \PhpGedcom\Parser\Indi\Even { } diff --git a/library/PhpGedcom/Parser/Note.php b/library/PhpGedcom/Parser/Note.php index 23719493..c081a70f 100644 --- a/library/PhpGedcom/Parser/Note.php +++ b/library/PhpGedcom/Parser/Note.php @@ -1,40 +1,31 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Parser; -/** - * - * - */ class Note extends \PhpGedcom\Parser\Component { - - /** - * - * - */ public static function parse(\PhpGedcom\Parser $parser) { $record = $parser->getCurrentLineRecord(4); - $depth = (int)$record[0]; - if(isset($record[1])){ - $identifier = $parser->normalizeIdentifier($record[1]); - } - else{ - $parser->skipToNextLevel($depth); - return null; + $depth = (int) $record[0]; + if (isset($record[1])) { + $identifier = $parser->normalizeIdentifier($record[1]); + } else { + $parser->skipToNextLevel($depth); + + return null; } $note = new \PhpGedcom\Record\Note(); @@ -48,7 +39,7 @@ public static function parse(\PhpGedcom\Parser $parser) while (!$parser->eof()) { $record = $parser->getCurrentLineRecord(); - $currentDepth = (int)$record[0]; + $currentDepth = (int) $record[0]; $recordType = strtoupper(trim($record[1])); if ($currentDepth <= $depth) { @@ -58,14 +49,14 @@ public static function parse(\PhpGedcom\Parser $parser) switch ($recordType) { case 'CONT': - $note->setNote($note->getNote() . "\n"); + $note->setNote($note->getNote()."\n"); if (isset($record[2])) { - $note->setNote($note->getNote() . $record[2]); + $note->setNote($note->getNote().$record[2]); } break; case 'CONC': if (isset($record[2])) { - $note->setNote($note->getNote() . $record[2]); + $note->setNote($note->getNote().$record[2]); } break; case 'REFN': @@ -84,7 +75,7 @@ public static function parse(\PhpGedcom\Parser $parser) $note->setChan($chan); break; default: - $parser->logUnhandledRecord(get_class() . ' @ ' . __LINE__); + $parser->logUnhandledRecord(get_class().' @ '.__LINE__); } $parser->forward(); diff --git a/library/PhpGedcom/Parser/NoteRef.php b/library/PhpGedcom/Parser/NoteRef.php index 8e0a13c0..f0e481ad 100644 --- a/library/PhpGedcom/Parser/NoteRef.php +++ b/library/PhpGedcom/Parser/NoteRef.php @@ -1,37 +1,32 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Parser; -/** - * - */ class NoteRef extends \PhpGedcom\Parser\Component { - /** - * - */ public static function parse(\PhpGedcom\Parser $parser) { $record = $parser->getCurrentLineRecord(); - $depth = (int)$record[0]; + $depth = (int) $record[0]; $note = new \PhpGedcom\Record\NoteRef(); if (count($record) < 3) { - $parser->logSkippedRecord('Missing note information; ' . get_class(), ' @ ' . __LINE__); + $parser->logSkippedRecord('Missing note information; '.get_class(), ' @ '.__LINE__); $parser->skipToNextLevel($depth); + return null; } @@ -49,7 +44,7 @@ public static function parse(\PhpGedcom\Parser $parser) while (!$parser->eof()) { $record = $parser->getCurrentLineRecord(); $recordType = strtoupper(trim($record[1])); - $currentDepth = (int)$record[0]; + $currentDepth = (int) $record[0]; if ($currentDepth <= $depth) { $parser->back(); @@ -62,7 +57,7 @@ public static function parse(\PhpGedcom\Parser $parser) $note->addSour($sour); break; default: - $parser->logUnhandledRecord(get_class() . ' @ ' . __LINE__); + $parser->logUnhandledRecord(get_class().' @ '.__LINE__); } $parser->forward(); diff --git a/library/PhpGedcom/Parser/Obje.php b/library/PhpGedcom/Parser/Obje.php index 1c052230..ff1f1267 100644 --- a/library/PhpGedcom/Parser/Obje.php +++ b/library/PhpGedcom/Parser/Obje.php @@ -1,40 +1,31 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Parser; -/** - * - * - */ class Obje extends \PhpGedcom\Parser\Component { - - /** - * - * - */ public static function parse(\PhpGedcom\Parser $parser) { $record = $parser->getCurrentLineRecord(); $depth = (int) $record[0]; - if(isset($record[1])){ - $identifier = $parser->normalizeIdentifier($record[1]); - } - else{ - $parser->skipToNextLevel($depth); - return null; + if (isset($record[1])) { + $identifier = $parser->normalizeIdentifier($record[1]); + } else { + $parser->skipToNextLevel($depth); + + return null; } $obje = new \PhpGedcom\Record\Obje(); @@ -76,14 +67,14 @@ public static function parse(\PhpGedcom\Parser $parser) $chan = \PhpGedcom\Parser\Chan::parse($parser); $obje->setChan($chan); break; - + case 'CHAN': $chan = \PhpGedcom\Parser\Chan::parse($parser); $obje->setChan($chan); break; default: - $parser->logUnhandledRecord(get_class() . ' @ ' . __LINE__); + $parser->logUnhandledRecord(get_class().' @ '.__LINE__); } $parser->forward(); diff --git a/library/PhpGedcom/Parser/ObjeRef.php b/library/PhpGedcom/Parser/ObjeRef.php index 07fe2421..0bd94f9b 100644 --- a/library/PhpGedcom/Parser/ObjeRef.php +++ b/library/PhpGedcom/Parser/ObjeRef.php @@ -1,54 +1,47 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Parser; -/** - * - * - */ class ObjeRef extends \PhpGedcom\Parser\Component { - /** - * - */ public static function parse(\PhpGedcom\Parser $parser) { $record = $parser->getCurrentLineRecord(); - $depth = (int)$record[0]; - + $depth = (int) $record[0]; + $obje = new \PhpGedcom\Record\ObjeRef(); - + if (isset($record[2])) { $obje->setIsReference(true); $obje->setObje($parser->normalizeIdentifier($record[2])); } else { $obje->setIsReference(false); } - + $parser->forward(); - + while (!$parser->eof()) { $record = $parser->getCurrentLineRecord(); $recordType = strtoupper(trim($record[1])); - $currentDepth = (int)$record[0]; - + $currentDepth = (int) $record[0]; + if ($currentDepth <= $depth) { $parser->back(); break; } - + switch ($recordType) { case 'TITL': $obje->setTitl(trim($record[2])); @@ -57,12 +50,12 @@ public static function parse(\PhpGedcom\Parser $parser) $obje->setFile(\PhpGedcom\Parser\ObjeRef\File::parse($parser)); break; default: - $parser->logUnhandledRecord(get_class() . ' @ ' . __LINE__); + $parser->logUnhandledRecord(get_class().' @ '.__LINE__); } - + $parser->forward(); } - + return $obje; } } diff --git a/library/PhpGedcom/Parser/ObjeRef/File.php b/library/PhpGedcom/Parser/ObjeRef/File.php index 28c67440..e1bc4f18 100644 --- a/library/PhpGedcom/Parser/ObjeRef/File.php +++ b/library/PhpGedcom/Parser/ObjeRef/File.php @@ -1,52 +1,43 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Parser\ObjeRef; -/** - * - * - */ class File extends \PhpGedcom\Parser\Component { - - /** - * - * - */ public static function parse(\PhpGedcom\Parser $parser) { $file = new \PhpGedcom\Record\ObjeRef\File(); $record = $parser->getCurrentLineRecord(); - $depth = (int) $record[0]; - if(isset($record[2])) { + $depth = (int) $record[0]; + if (isset($record[2])) { $file->setFile($record[2]); - }else { + } else { return null; } $parser->forward(); - + while (!$parser->eof()) { $record = $parser->getCurrentLineRecord(); $recordType = strtoupper(trim($record[1])); - $currentDepth = (int)$record[0]; - + $currentDepth = (int) $record[0]; + if ($currentDepth <= $depth) { $parser->back(); break; } - + switch ($recordType) { case 'FORM': $file->setDate(\PhpGedcom\Parser\ObjeRef\File\Form::parse($parser)); @@ -54,12 +45,12 @@ public static function parse(\PhpGedcom\Parser $parser) case 'TITL': $file->setTitl(trim($record[2])); default: - $parser->logUnhandledRecord(get_class() . ' @ ' . __LINE__); + $parser->logUnhandledRecord(get_class().' @ '.__LINE__); } - + $parser->forward(); } - + return $file; } } diff --git a/library/PhpGedcom/Parser/ObjeRef/File/Form.php b/library/PhpGedcom/Parser/ObjeRef/File/Form.php index c3ce10a4..f7787aa6 100644 --- a/library/PhpGedcom/Parser/ObjeRef/File/Form.php +++ b/library/PhpGedcom/Parser/ObjeRef/File/Form.php @@ -1,53 +1,45 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Parser\ObjeRef\File; -/** - * - * - */ class Form extends \PhpGedcom\Parser\Component { - - /** - * - * - */ public static function parse(\PhpGedcom\Parser $parser) { $form = new \PhpGedcom\Record\ObjeRef\File\Form(); $record = $parser->getCurrentLineRecord(); - $depth = (int) $record[0]; - if(isset($record[2])) { + $depth = (int) $record[0]; + if (isset($record[2])) { $form->setForm($record[2]); } else { $parser->skipToNextLevel($depth); + return null; } $parser->forward(); - + while (!$parser->eof()) { $record = $parser->getCurrentLineRecord(); $recordType = strtoupper(trim($record[1])); - $currentDepth = (int)$record[0]; - + $currentDepth = (int) $record[0]; + if ($currentDepth <= $depth) { $parser->back(); break; } - + switch ($recordType) { case 'MEDI': $form->setMedi(trim($record[2])); @@ -56,12 +48,12 @@ public static function parse(\PhpGedcom\Parser $parser) $form->setType(trim($record[2])); break; default: - $parser->logUnhandledRecord(get_class() . ' @ ' . __LINE__); + $parser->logUnhandledRecord(get_class().' @ '.__LINE__); } - + $parser->forward(); } - + return $form; } } diff --git a/library/PhpGedcom/Parser/Phon.php b/library/PhpGedcom/Parser/Phon.php index 5b175781..7b6717a6 100644 --- a/library/PhpGedcom/Parser/Phon.php +++ b/library/PhpGedcom/Parser/Phon.php @@ -1,50 +1,40 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Parser; -/** - * - * - */ class Phon extends \PhpGedcom\Parser\Component { - - /** - * - * - */ public static function parse(\PhpGedcom\Parser $parser) { $record = $parser->getCurrentLineRecord(); - $depth = (int)$record[0]; - if(isset($record[2])){ - $phone = new \PhpGedcom\Record\Phon(); - $phone->setPhon(trim($record[2])); + $depth = (int) $record[0]; + if (isset($record[2])) { + $phone = new \PhpGedcom\Record\Phon(); + $phone->setPhon(trim($record[2])); + } else { + $parser->skipToNextLevel($depth); + + return null; } - else{ - $parser->skipToNextLevel($depth); - return null; - } - $parser->forward(); while (!$parser->eof()) { $record = $parser->getCurrentLineRecord(); $recordType = strtoupper(trim($record[1])); - $currentDepth = (int)$record[0]; + $currentDepth = (int) $record[0]; if ($currentDepth <= $depth) { $parser->back(); @@ -53,7 +43,7 @@ public static function parse(\PhpGedcom\Parser $parser) switch ($recordType) { default: - $parser->logUnhandledRecord(get_class() . ' @ ' . __LINE__); + $parser->logUnhandledRecord(get_class().' @ '.__LINE__); } $parser->forward(); diff --git a/library/PhpGedcom/Parser/Plac.php b/library/PhpGedcom/Parser/Plac.php index 89051db4..5e5319ee 100644 --- a/library/PhpGedcom/Parser/Plac.php +++ b/library/PhpGedcom/Parser/Plac.php @@ -1,40 +1,31 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Parser; -/** - * - * - */ class Plac extends \PhpGedcom\Parser\Component { - - /** - * - * - */ public static function parse(\PhpGedcom\Parser $parser) { $record = $parser->getCurrentLineRecord(); - $depth = (int)$record[0]; - if(isset($record[2])){ - $_plac = trim($record[2]); - } - else{ - $parser->skipToNextLevel($depth); - return null; + $depth = (int) $record[0]; + if (isset($record[2])) { + $_plac = trim($record[2]); + } else { + $parser->skipToNextLevel($depth); + + return null; } $plac = new \PhpGedcom\Record\Plac(); @@ -44,7 +35,7 @@ public static function parse(\PhpGedcom\Parser $parser) while (!$parser->eof()) { $record = $parser->getCurrentLineRecord(); - $currentDepth = (int)$record[0]; + $currentDepth = (int) $record[0]; $recordType = strtoupper(trim($record[1])); if ($currentDepth <= $depth) { @@ -74,7 +65,7 @@ public static function parse(\PhpGedcom\Parser $parser) $plac->setMap($map); break; default: - $parser->logUnhandledRecord(get_class() . ' @ ' . __LINE__); + $parser->logUnhandledRecord(get_class().' @ '.__LINE__); } $parser->forward(); diff --git a/library/PhpGedcom/Parser/Plac/Fone.php b/library/PhpGedcom/Parser/Plac/Fone.php index 3e037132..9152b75d 100644 --- a/library/PhpGedcom/Parser/Plac/Fone.php +++ b/library/PhpGedcom/Parser/Plac/Fone.php @@ -1,40 +1,31 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Parser\Plac; -/** - * - * - */ class Fone extends \PhpGedcom\Parser\Component { - - /** - * - * - */ public static function parse(\PhpGedcom\Parser $parser) { $record = $parser->getCurrentLineRecord(); - $depth = (int)$record[0]; - if(isset($record[2])){ - $_fone = trim($record[2]); - } - else{ - $parser->skipToNextLevel($depth); - return null; + $depth = (int) $record[0]; + if (isset($record[2])) { + $_fone = trim($record[2]); + } else { + $parser->skipToNextLevel($depth); + + return null; } $fone = new \PhpGedcom\Record\Plac\Fone(); @@ -44,7 +35,7 @@ public static function parse(\PhpGedcom\Parser $parser) while (!$parser->eof()) { $record = $parser->getCurrentLineRecord(); - $currentDepth = (int)$record[0]; + $currentDepth = (int) $record[0]; $recordType = strtoupper(trim($record[1])); if ($currentDepth <= $depth) { @@ -57,7 +48,7 @@ public static function parse(\PhpGedcom\Parser $parser) $fone->setType(trim($record[2])); break; default: - $parser->logUnhandledRecord(get_class() . ' @ ' . __LINE__); + $parser->logUnhandledRecord(get_class().' @ '.__LINE__); } $parser->forward(); diff --git a/library/PhpGedcom/Parser/Plac/Map.php b/library/PhpGedcom/Parser/Plac/Map.php index fcaada9f..ce1d0fc1 100644 --- a/library/PhpGedcom/Parser/Plac/Map.php +++ b/library/PhpGedcom/Parser/Plac/Map.php @@ -1,35 +1,25 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Parser\Plac; -/** - * - * - */ class Map extends \PhpGedcom\Parser\Component { - - /** - * - * - */ public static function parse(\PhpGedcom\Parser $parser) { $record = $parser->getCurrentLineRecord(); - $depth = (int)$record[0]; - + $depth = (int) $record[0]; $map = new \PhpGedcom\Record\Plac\Map(); @@ -37,7 +27,7 @@ public static function parse(\PhpGedcom\Parser $parser) while (!$parser->eof()) { $record = $parser->getCurrentLineRecord(); - $currentDepth = (int)$record[0]; + $currentDepth = (int) $record[0]; $recordType = strtoupper(trim($record[1])); if ($currentDepth <= $depth) { @@ -53,7 +43,7 @@ public static function parse(\PhpGedcom\Parser $parser) $map->setLong(trim($record[2])); break; default: - $parser->logUnhandledRecord(get_class() . ' @ ' . __LINE__); + $parser->logUnhandledRecord(get_class().' @ '.__LINE__); } $parser->forward(); diff --git a/library/PhpGedcom/Parser/Plac/Romn.php b/library/PhpGedcom/Parser/Plac/Romn.php index 22741182..ba42cf23 100644 --- a/library/PhpGedcom/Parser/Plac/Romn.php +++ b/library/PhpGedcom/Parser/Plac/Romn.php @@ -1,40 +1,31 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Parser\Plac; -/** - * - * - */ class Romn extends \PhpGedcom\Parser\Component { - - /** - * - * - */ public static function parse(\PhpGedcom\Parser $parser) { $record = $parser->getCurrentLineRecord(); - $depth = (int)$record[0]; - if(isset($record[2])){ - $_romn = trim($record[2]); - } - else{ - $parser->skipToNextLevel($depth); - return null; + $depth = (int) $record[0]; + if (isset($record[2])) { + $_romn = trim($record[2]); + } else { + $parser->skipToNextLevel($depth); + + return null; } $romn = new \PhpGedcom\Record\Plac\Romn(); @@ -44,7 +35,7 @@ public static function parse(\PhpGedcom\Parser $parser) while (!$parser->eof()) { $record = $parser->getCurrentLineRecord(); - $currentDepth = (int)$record[0]; + $currentDepth = (int) $record[0]; $recordType = strtoupper(trim($record[1])); if ($currentDepth <= $depth) { @@ -57,7 +48,7 @@ public static function parse(\PhpGedcom\Parser $parser) $romn->setType(trim($record[2])); break; default: - $parser->logUnhandledRecord(get_class() . ' @ ' . __LINE__); + $parser->logUnhandledRecord(get_class().' @ '.__LINE__); } $parser->forward(); diff --git a/library/PhpGedcom/Parser/Refn.php b/library/PhpGedcom/Parser/Refn.php index 43798cf0..978f06fe 100644 --- a/library/PhpGedcom/Parser/Refn.php +++ b/library/PhpGedcom/Parser/Refn.php @@ -1,50 +1,40 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Parser; -/** - * - * - */ class Refn extends \PhpGedcom\Parser\Component { - - /** - * - * - */ public static function parse(\PhpGedcom\Parser $parser) { $record = $parser->getCurrentLineRecord(); - $depth = (int)$record[0]; - if(isset($record[2])){ - $refn = new \PhpGedcom\Record\Refn(); - $refn->setRefn(trim($record[2])); + $depth = (int) $record[0]; + if (isset($record[2])) { + $refn = new \PhpGedcom\Record\Refn(); + $refn->setRefn(trim($record[2])); + } else { + $parser->skipToNextLevel($depth); + + return null; } - else{ - $parser->skipToNextLevel($depth); - return null; - } - $parser->forward(); while (!$parser->eof()) { $record = $parser->getCurrentLineRecord(); $recordType = strtoupper(trim($record[1])); - $currentDepth = (int)$record[0]; + $currentDepth = (int) $record[0]; if ($currentDepth <= $depth) { $parser->back(); @@ -56,7 +46,7 @@ public static function parse(\PhpGedcom\Parser $parser) $refn->setType(trim($record[2])); break; default: - $parser->logUnhandledRecord(get_class() . ' @ ' . __LINE__); + $parser->logUnhandledRecord(get_class().' @ '.__LINE__); } $parser->forward(); diff --git a/library/PhpGedcom/Parser/Repo.php b/library/PhpGedcom/Parser/Repo.php index 5389f6a3..076e9371 100644 --- a/library/PhpGedcom/Parser/Repo.php +++ b/library/PhpGedcom/Parser/Repo.php @@ -1,40 +1,31 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Parser; -/** - * - * - */ class Repo extends \PhpGedcom\Parser\Component { - - /** - * - * - */ public static function parse(\PhpGedcom\Parser $parser) { $record = $parser->getCurrentLineRecord(); - $depth = (int)$record[0]; - if(isset($record[1])){ - $identifier = $parser->normalizeIdentifier($record[1]); - } - else{ - $parser->skipToNextLevel($depth); - return null; + $depth = (int) $record[0]; + if (isset($record[1])) { + $identifier = $parser->normalizeIdentifier($record[1]); + } else { + $parser->skipToNextLevel($depth); + + return null; } $repo = new \PhpGedcom\Record\Repo(); @@ -46,7 +37,7 @@ public static function parse(\PhpGedcom\Parser $parser) while (!$parser->eof()) { $record = $parser->getCurrentLineRecord(); - $currentDepth = (int)$record[0]; + $currentDepth = (int) $record[0]; $recordType = strtoupper(trim($record[1])); if ($currentDepth <= $depth) { @@ -91,7 +82,7 @@ public static function parse(\PhpGedcom\Parser $parser) $repo->setChan($chan); break; default: - $parser->logUnhandledRecord(get_class() . ' @ ' . __LINE__); + $parser->logUnhandledRecord(get_class().' @ '.__LINE__); } $parser->forward(); diff --git a/library/PhpGedcom/Parser/RepoRef.php b/library/PhpGedcom/Parser/RepoRef.php index f560b0a5..964b0053 100644 --- a/library/PhpGedcom/Parser/RepoRef.php +++ b/library/PhpGedcom/Parser/RepoRef.php @@ -1,40 +1,31 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Parser; -/** - * - * - */ class RepoRef extends \PhpGedcom\Parser\Component { - - /** - * - * - */ public static function parse(\PhpGedcom\Parser $parser) { $record = $parser->getCurrentLineRecord(); - $depth = (int)$record[0]; - if(isset($record[2])){ - $identifier = $parser->normalizeIdentifier($record[2]); - } - else{ - $parser->skipToNextLevel($depth); - return null; + $depth = (int) $record[0]; + if (isset($record[2])) { + $identifier = $parser->normalizeIdentifier($record[2]); + } else { + $parser->skipToNextLevel($depth); + + return null; } $repo = new \PhpGedcom\Record\RepoRef(); @@ -44,7 +35,7 @@ public static function parse(\PhpGedcom\Parser $parser) while (!$parser->eof()) { $record = $parser->getCurrentLineRecord(); - $currentDepth = (int)$record[0]; + $currentDepth = (int) $record[0]; $recordType = strtoupper(trim($record[1])); if ($currentDepth <= $depth) { @@ -63,7 +54,7 @@ public static function parse(\PhpGedcom\Parser $parser) } break; default: - $parser->logUnhandledRecord(get_class() . ' @ ' . __LINE__); + $parser->logUnhandledRecord(get_class().' @ '.__LINE__); } $parser->forward(); diff --git a/library/PhpGedcom/Parser/Sour.php b/library/PhpGedcom/Parser/Sour.php index d5966012..1d42aac4 100644 --- a/library/PhpGedcom/Parser/Sour.php +++ b/library/PhpGedcom/Parser/Sour.php @@ -1,40 +1,31 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Parser; -/** - * - * - */ class Sour extends \PhpGedcom\Parser\Component { - - /** - * - * - */ public static function parse(\PhpGedcom\Parser $parser) { $record = $parser->getCurrentLineRecord(); - $depth = (int)$record[0]; - if(isset($record[1])){ - $identifier = $parser->normalizeIdentifier($record[1]); - } - else{ - $parser->skipToNextLevel($depth); - return null; + $depth = (int) $record[0]; + if (isset($record[1])) { + $identifier = $parser->normalizeIdentifier($record[1]); + } else { + $parser->skipToNextLevel($depth); + + return null; } $sour = new \PhpGedcom\Record\Sour(); @@ -46,7 +37,7 @@ public static function parse(\PhpGedcom\Parser $parser) while (!$parser->eof()) { $record = $parser->getCurrentLineRecord(); - $currentDepth = (int)$record[0]; + $currentDepth = (int) $record[0]; $recordType = strtoupper(trim($record[1])); if ($currentDepth <= $depth) { @@ -57,7 +48,7 @@ public static function parse(\PhpGedcom\Parser $parser) switch ($recordType) { case 'DATA': $sour->setData(\PhpGedcom\Parser\Sour\Data::parse($parser)); - break; + break; case 'AUTH': $sour->setAuth($parser->parseMultilineRecord()); break; @@ -98,7 +89,7 @@ public static function parse(\PhpGedcom\Parser $parser) $sour->addObje($obje); break; default: - $parser->logUnhandledRecord(get_class() . ' @ ' . __LINE__); + $parser->logUnhandledRecord(get_class().' @ '.__LINE__); } $parser->forward(); diff --git a/library/PhpGedcom/Parser/Sour/Data.php b/library/PhpGedcom/Parser/Sour/Data.php index 09620a2a..e30794b8 100644 --- a/library/PhpGedcom/Parser/Sour/Data.php +++ b/library/PhpGedcom/Parser/Sour/Data.php @@ -1,34 +1,25 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Parser\Sour; -/** - * - * - */ class Data extends \PhpGedcom\Parser\Component { - - /** - * - * - */ public static function parse(\PhpGedcom\Parser $parser) { $record = $parser->getCurrentLineRecord(); - $depth = (int)$record[0]; + $depth = (int) $record[0]; $data = new \PhpGedcom\Record\Sour\Data(); @@ -37,7 +28,7 @@ public static function parse(\PhpGedcom\Parser $parser) while (!$parser->eof()) { $record = $parser->getCurrentLineRecord(); $recordType = strtoupper(trim($record[1])); - $currentDepth = (int)$record[0]; + $currentDepth = (int) $record[0]; if ($currentDepth <= $depth) { $parser->back(); @@ -64,7 +55,7 @@ public static function parse(\PhpGedcom\Parser $parser) $data->setText($parser->parseMultiLineRecord()); break; default: - $parser->logUnhandledRecord(get_class() . ' @ ' . __LINE__); + $parser->logUnhandledRecord(get_class().' @ '.__LINE__); } $parser->forward(); diff --git a/library/PhpGedcom/Parser/Sour/Data/Even.php b/library/PhpGedcom/Parser/Sour/Data/Even.php index 87bb5345..bbac5753 100644 --- a/library/PhpGedcom/Parser/Sour/Data/Even.php +++ b/library/PhpGedcom/Parser/Sour/Data/Even.php @@ -1,34 +1,25 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Parser\Sour\Data; -/** - * - * - */ class Even extends \PhpGedcom\Parser\Component { - - /** - * - * - */ public static function parse(\PhpGedcom\Parser $parser) { $record = $parser->getCurrentLineRecord(); - $depth = (int)$record[0]; + $depth = (int) $record[0]; $even = new \PhpGedcom\Record\Sour\Data\Even(); @@ -37,7 +28,7 @@ public static function parse(\PhpGedcom\Parser $parser) while (!$parser->eof()) { $record = $parser->getCurrentLineRecord(); $recordType = strtoupper(trim($record[1])); - $currentDepth = (int)$record[0]; + $currentDepth = (int) $record[0]; if ($currentDepth <= $depth) { $parser->back(); @@ -52,7 +43,7 @@ public static function parse(\PhpGedcom\Parser $parser) $even->setPlac(trim($record[2])); break; default: - $parser->logUnhandledRecord(get_class() . ' @ ' . __LINE__); + $parser->logUnhandledRecord(get_class().' @ '.__LINE__); } $parser->forward(); diff --git a/library/PhpGedcom/Parser/Sour/Repo.php b/library/PhpGedcom/Parser/Sour/Repo.php index 5e4ef705..ff5d808e 100644 --- a/library/PhpGedcom/Parser/Sour/Repo.php +++ b/library/PhpGedcom/Parser/Sour/Repo.php @@ -1,46 +1,37 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Parser\Sour; -/** - * - * - */ class Repo extends \PhpGedcom\Parser\Component { - - /** - * - * - */ public static function parse(\PhpGedcom\Parser $parser) { $repo = new \PhpGedcom\Record\Sour\Repo(); $record = $parser->getCurrentLineRecord(); - $depth = (int)$record[0]; + $depth = (int) $record[0]; if (isset($record[2])) { $_repo = $parser->normalizeIdentifier($record[2]); $repo->setRepo($_repo); - } + } $parser->forward(); while (!$parser->eof()) { $record = $parser->getCurrentLineRecord(); $recordType = strtoupper(trim($record[1])); - $currentDepth = (int)$record[0]; + $currentDepth = (int) $record[0]; if ($currentDepth <= $depth) { $parser->back(); @@ -55,7 +46,7 @@ public static function parse(\PhpGedcom\Parser $parser) $repo->addCaln(\PhpGedcom\Parser\Sour\Repo\Caln::parse($parser)); break; default: - $parser->logUnhandledRecord(get_class() . ' @ ' . __LINE__); + $parser->logUnhandledRecord(get_class().' @ '.__LINE__); } $parser->forward(); diff --git a/library/PhpGedcom/Parser/Sour/Repo/Caln.php b/library/PhpGedcom/Parser/Sour/Repo/Caln.php index d5e4e43e..6bf0e6e4 100644 --- a/library/PhpGedcom/Parser/Sour/Repo/Caln.php +++ b/library/PhpGedcom/Parser/Sour/Repo/Caln.php @@ -1,65 +1,56 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Parser\Sour\Repo; -/** - * - * - */ class Caln extends \PhpGedcom\Parser\Component { - - /** - * - * - */ public static function parse(\PhpGedcom\Parser $parser) { $caln = new \PhpGedcom\Record\Sour\Repo\Caln(); $record = $parser->getCurrentLineRecord(); - $depth = (int) $record[0]; - if (isset($record[2])) { + $depth = (int) $record[0]; + if (isset($record[2])) { $_caln = $record[2]; $caln->setCaln($_caln); - }else{ + } else { return null; } $parser->forward(); - + while (!$parser->eof()) { $record = $parser->getCurrentLineRecord(); $recordType = strtoupper(trim($record[1])); - $currentDepth = (int)$record[0]; - + $currentDepth = (int) $record[0]; + if ($currentDepth <= $depth) { $parser->back(); break; } - + switch ($recordType) { case 'MEDI': $caln->setMedi(trim($record[2])); break; default: - $parser->logUnhandledRecord(get_class() . ' @ ' . __LINE__); + $parser->logUnhandledRecord(get_class().' @ '.__LINE__); } - + $parser->forward(); } - + return $caln; } } diff --git a/library/PhpGedcom/Parser/SourRef.php b/library/PhpGedcom/Parser/SourRef.php index 30535e70..49d34842 100644 --- a/library/PhpGedcom/Parser/SourRef.php +++ b/library/PhpGedcom/Parser/SourRef.php @@ -1,49 +1,40 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Parser; -/** - * - * - */ class SourRef extends \PhpGedcom\Parser\Component { - - /** - * - * - */ public static function parse(\PhpGedcom\Parser $parser) { $record = $parser->getCurrentLineRecord(); - $depth = (int)$record[0]; - if(isset($record[2])){ - $sour = new \PhpGedcom\Record\SourRef(); - $sour->setSour($parser->normalizeIdentifier($record[2])); + $depth = (int) $record[0]; + if (isset($record[2])) { + $sour = new \PhpGedcom\Record\SourRef(); + $sour->setSour($parser->normalizeIdentifier($record[2])); + } else { + $parser->skipToNextLevel($depth); + + return null; } - else{ - $parser->skipToNextLevel($depth); - return null; - } $parser->forward(); while (!$parser->eof()) { $record = $parser->getCurrentLineRecord(); $recordType = strtoupper(trim($record[1])); - $currentDepth = (int)$record[0]; + $currentDepth = (int) $record[0]; if ($currentDepth <= $depth) { $parser->back(); @@ -80,7 +71,7 @@ public static function parse(\PhpGedcom\Parser $parser) $sour->setQuay(trim($record[2])); break; default: - $parser->logUnhandledRecord(get_class() . ' @ ' . __LINE__); + $parser->logUnhandledRecord(get_class().' @ '.__LINE__); } $parser->forward(); diff --git a/library/PhpGedcom/Parser/SourRef/Data.php b/library/PhpGedcom/Parser/SourRef/Data.php index eb773f55..a77f4b45 100644 --- a/library/PhpGedcom/Parser/SourRef/Data.php +++ b/library/PhpGedcom/Parser/SourRef/Data.php @@ -1,48 +1,39 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Parser\SourRef; -/** - * - * - */ class Data extends \PhpGedcom\Parser\Component { - - /** - * - * - */ public static function parse(\PhpGedcom\Parser $parser) { $data = new \PhpGedcom\Record\SourRef\Data(); $record = $parser->getCurrentLineRecord(); - $depth = (int) $record[0]; + $depth = (int) $record[0]; $parser->forward(); - + while (!$parser->eof()) { $record = $parser->getCurrentLineRecord(); $recordType = strtoupper(trim($record[1])); - $currentDepth = (int)$record[0]; - + $currentDepth = (int) $record[0]; + if ($currentDepth <= $depth) { $parser->back(); break; } - + switch ($recordType) { case 'DATE': $data->setDate(trim($record[2])); @@ -51,12 +42,12 @@ public static function parse(\PhpGedcom\Parser $parser) $data->setText($parser->parseMultiLineRecord()); break; default: - $parser->logUnhandledRecord(get_class() . ' @ ' . __LINE__); + $parser->logUnhandledRecord(get_class().' @ '.__LINE__); } - + $parser->forward(); } - + return $data; } } diff --git a/library/PhpGedcom/Parser/SourRef/Even.php b/library/PhpGedcom/Parser/SourRef/Even.php index a4abf16c..6b0bd183 100644 --- a/library/PhpGedcom/Parser/SourRef/Even.php +++ b/library/PhpGedcom/Parser/SourRef/Even.php @@ -1,41 +1,32 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Parser\SourRef; -/** - * - * - */ class Even extends \PhpGedcom\Parser\Component { - - /** - * - * - */ public static function parse(\PhpGedcom\Parser $parser) { $record = $parser->getCurrentLineRecord(); - $depth = (int)$record[0]; - if(isset($record[2])){ - $even = new \PhpGedcom\Record\SourRef\Even(); - $even->setEven(trim($record[2])); - } - else{ - $parser->skipToNextLevel($depth); - return null; + $depth = (int) $record[0]; + if (isset($record[2])) { + $even = new \PhpGedcom\Record\SourRef\Even(); + $even->setEven(trim($record[2])); + } else { + $parser->skipToNextLevel($depth); + + return null; } $parser->forward(); @@ -43,7 +34,7 @@ public static function parse(\PhpGedcom\Parser $parser) while (!$parser->eof()) { $record = $parser->getCurrentLineRecord(); $recordType = strtoupper(trim($record[1])); - $currentDepth = (int)$record[0]; + $currentDepth = (int) $record[0]; if ($currentDepth <= $depth) { $parser->back(); @@ -55,7 +46,7 @@ public static function parse(\PhpGedcom\Parser $parser) $even->setRole(trim($record[2])); break; default: - $parser->logUnhandledRecord(get_class() . ' @ ' . __LINE__); + $parser->logUnhandledRecord(get_class().' @ '.__LINE__); } $parser->forward(); diff --git a/library/PhpGedcom/Parser/Subm.php b/library/PhpGedcom/Parser/Subm.php index c19eba04..f9fed35d 100644 --- a/library/PhpGedcom/Parser/Subm.php +++ b/library/PhpGedcom/Parser/Subm.php @@ -1,40 +1,31 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Parser; -/** - * - * - */ class Subm extends \PhpGedcom\Parser\Component { - - /** - * - * - */ public static function parse(\PhpGedcom\Parser $parser) { $record = $parser->getCurrentLineRecord(); - $depth = (int)$record[0]; - if(isset($record[1])){ - $identifier = $parser->normalizeIdentifier($record[1]); - } - else{ - $parser->skipToNextLevel($depth); - return null; + $depth = (int) $record[0]; + if (isset($record[1])) { + $identifier = $parser->normalizeIdentifier($record[1]); + } else { + $parser->skipToNextLevel($depth); + + return null; } $subm = new \PhpGedcom\Record\Subm(); @@ -46,7 +37,7 @@ public static function parse(\PhpGedcom\Parser $parser) while (!$parser->eof()) { $record = $parser->getCurrentLineRecord(); - $currentDepth = (int)$record[0]; + $currentDepth = (int) $record[0]; $recordType = strtoupper(trim($record[1])); if ($currentDepth <= $depth) { @@ -63,19 +54,19 @@ public static function parse(\PhpGedcom\Parser $parser) $subm->setAddr($addr); break; case 'PHON': - $phone = isset($record[2]) ? trim($record[2]): ''; + $phone = isset($record[2]) ? trim($record[2]) : ''; $subm->addPhon($phone); break; case 'EMAIL': - $email = isset($record[2]) ? trim($record[2]): ''; + $email = isset($record[2]) ? trim($record[2]) : ''; $subm->addEmail($email); break; case 'FAX': - $fax = isset($record[2]) ? trim($record[2]): ''; + $fax = isset($record[2]) ? trim($record[2]) : ''; $subm->addFax($fax); break; case 'WWW': - $www = isset($record[2]) ? trim($record[2]): ''; + $www = isset($record[2]) ? trim($record[2]) : ''; $subm->addWww($www); break; case 'NOTE': @@ -102,7 +93,7 @@ public static function parse(\PhpGedcom\Parser $parser) $subm->addLang(isset($record[2]) ? trim($record[2]) : ''); break; default: - $parser->logUnhandledRecord(get_class() . ' @ ' . __LINE__); + $parser->logUnhandledRecord(get_class().' @ '.__LINE__); } $parser->forward(); diff --git a/library/PhpGedcom/Parser/Subn.php b/library/PhpGedcom/Parser/Subn.php index 2b90e9cd..b1234827 100644 --- a/library/PhpGedcom/Parser/Subn.php +++ b/library/PhpGedcom/Parser/Subn.php @@ -1,40 +1,31 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Parser; -/** - * - * - */ class Subn extends \PhpGedcom\Parser\Component { - - /** - * - * - */ public static function parse(\PhpGedcom\Parser $parser) { $record = $parser->getCurrentLineRecord(); - $depth = (int)$record[0]; - if(isset($record[1])){ - $identifier = $parser->normalizeIdentifier($record[1]); - } - else{ - $parser->skipToNextLevel($depth); - return null; + $depth = (int) $record[0]; + if (isset($record[1])) { + $identifier = $parser->normalizeIdentifier($record[1]); + } else { + $parser->skipToNextLevel($depth); + + return null; } $subn = new \PhpGedcom\Record\Subn(); @@ -46,7 +37,7 @@ public static function parse(\PhpGedcom\Parser $parser) while (!$parser->eof()) { $record = $parser->getCurrentLineRecord(); - $currentDepth = (int)$record[0]; + $currentDepth = (int) $record[0]; $recordType = strtoupper(trim($record[1])); if ($currentDepth <= $depth) { @@ -76,7 +67,7 @@ public static function parse(\PhpGedcom\Parser $parser) case 'RIN': $subn->setRin(trim($record[2])); break; - case 'NOTE': + case 'NOTE': $note = \PhpGedcom\Parser\NoteRef::parse($parser); if ($note) { $subn->addNote($note); @@ -87,7 +78,7 @@ public static function parse(\PhpGedcom\Parser $parser) $subn->setChan($chan); break; default: - $parser->logUnhandledRecord(get_class() . ' @ ' . __LINE__); + $parser->logUnhandledRecord(get_class().' @ '.__LINE__); } $parser->forward(); diff --git a/library/PhpGedcom/Record.php b/library/PhpGedcom/Record.php index 139c2830..1a28d803 100644 --- a/library/PhpGedcom/Record.php +++ b/library/PhpGedcom/Record.php @@ -1,38 +1,32 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom; -/** - * - */ abstract class Record { - /** - * - */ public function __call($method, $args) { if (substr($method, 0, 3) == 'add') { $arr = strtolower(substr($method, 3)); - if (!property_exists($this, '_' . $arr) || !is_array($this->{'_' . $arr})) { - throw new \Exception('Unknown ' . get_class($this) . '::' . $arr); + if (!property_exists($this, '_'.$arr) || !is_array($this->{'_'.$arr})) { + throw new \Exception('Unknown '.get_class($this).'::'.$arr); } if (!is_array($args)) { - throw new \Exception('Incorrect arguments to ' . $method); + throw new \Exception('Incorrect arguments to '.$method); } if (!isset($args[0])) { @@ -44,18 +38,18 @@ public function __call($method, $args) // Type safety? } - $this->{'_' . $arr}[] = $args[0]; + $this->{'_'.$arr}[] = $args[0]; return $this; } elseif (substr($method, 0, 3) == 'set') { $arr = strtolower(substr($method, 3)); - if (!property_exists($this, '_' . $arr)) { - throw new \Exception('Unknown ' . get_class($this) . '::' . $arr); + if (!property_exists($this, '_'.$arr)) { + throw new \Exception('Unknown '.get_class($this).'::'.$arr); } if (!is_array($args)) { - throw new \Exception('Incorrect arguments to ' . $method); + throw new \Exception('Incorrect arguments to '.$method); } if (!isset($args[0])) { @@ -67,7 +61,7 @@ public function __call($method, $args) // Type safety? } - $this->{'_' . $arr} = $args[0]; + $this->{'_'.$arr} = $args[0]; return $this; } elseif (substr($method, 0, 3) == 'get') { @@ -76,39 +70,38 @@ public function __call($method, $args) // hotfix getData if ('data' == $arr) { if (!property_exists($this, '_text')) { - throw new \Exception('Unknown ' . get_class($this) . '::' . $arr); + throw new \Exception('Unknown '.get_class($this).'::'.$arr); } + return $this->{'_text'}; } - - if (!property_exists($this, '_' . $arr)) { - throw new \Exception('Unknown ' . get_class($this) . '::' . $arr); + + if (!property_exists($this, '_'.$arr)) { + throw new \Exception('Unknown '.get_class($this).'::'.$arr); } - return $this->{'_' . $arr}; + return $this->{'_'.$arr}; } else { - throw new \Exception('Unknown method called: ' . $method); + throw new \Exception('Unknown method called: '.$method); } } - /** - * - */ public function __set($var, $val) { // this class does not have any public vars - throw new \Exception('Undefined property ' . get_class() . '::' . $var); + throw new \Exception('Undefined property '.get_class().'::'.$var); } /** * Checks if this GEDCOM object has the provided attribute (ie, if the provided * attribute exists below the current object in its tree). * - * @param string $var The name of the attribute - * @return bool True if this object has the provided attribute + * @param string $var The name of the attribute + * + * @return bool True if this object has the provided attribute */ public function hasAttribute($var) { - return property_exists($this, '_' . $var) || property_Exists($this, $var); + return property_exists($this, '_'.$var) || property_exists($this, $var); } } diff --git a/library/PhpGedcom/Record/Addr.php b/library/PhpGedcom/Record/Addr.php index 891168eb..c4ffab3e 100644 --- a/library/PhpGedcom/Record/Addr.php +++ b/library/PhpGedcom/Record/Addr.php @@ -1,14 +1,14 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ @@ -17,8 +17,7 @@ use PhpGedcom\Record; /** - * Class Addr - * @package PhpGedcom\Record + * Class Addr. */ class Addr extends Record { @@ -59,11 +58,13 @@ class Addr extends Record /** * @param string $addr + * * @return Addr */ public function setAddr($addr = '') { $this->addr = $addr; + return $this; } @@ -77,11 +78,13 @@ public function getAddr() /** * @param string $adr1 + * * @return Addr */ public function setAdr1($adr1 = '') { $this->adr1 = $adr1; + return $this; } @@ -95,11 +98,13 @@ public function getAdr1() /** * @param string $adr2 + * * @return Addr */ public function setAdr2($adr2 = '') { $this->adr2 = $adr2; + return $this; } @@ -113,11 +118,13 @@ public function getAdr2() /** * @param string $city + * * @return Addr */ public function setCity($city = '') { $this->city = $city; + return $this; } @@ -131,11 +138,13 @@ public function getCity() /** * @param string $stae + * * @return Addr */ public function setStae($stae = '') { $this->stae = $stae; + return $this; } @@ -149,11 +158,13 @@ public function getStae() /** * @param string $post + * * @return Addr */ public function setPost($post = '') { $this->post = $post; + return $this; } @@ -167,11 +178,13 @@ public function getPost() /** * @param string $ctry + * * @return Addr */ public function setCtry($ctry = '') { $this->ctry = $ctry; + return $this; } diff --git a/library/PhpGedcom/Record/Caln.php b/library/PhpGedcom/Record/Caln.php index d8669e99..5f60f008 100644 --- a/library/PhpGedcom/Record/Caln.php +++ b/library/PhpGedcom/Record/Caln.php @@ -1,14 +1,14 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ @@ -17,8 +17,7 @@ use PhpGedcom\Record; /** - * Class Caln - * @package PhpGedcom\Record + * Class Caln. */ class Caln extends Record { @@ -34,11 +33,13 @@ class Caln extends Record /** * @param string $caln + * * @return Caln */ public function setCaln($caln = '') { $this->caln = $caln; + return $this; } @@ -52,11 +53,13 @@ public function getCaln() /** * @param string $medi + * * @return Caln */ public function setMedi($medi = '') { $this->medi = $medi; + return $this; } diff --git a/library/PhpGedcom/Record/Chan.php b/library/PhpGedcom/Record/Chan.php index 705d2bfc..88f0be0d 100644 --- a/library/PhpGedcom/Record/Chan.php +++ b/library/PhpGedcom/Record/Chan.php @@ -1,14 +1,14 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ @@ -17,8 +17,7 @@ use PhpGedcom\Record; /** - * Class Chan - * @package PhpGedcom\Record + * Class Chan. */ class Chan extends Record { @@ -35,15 +34,17 @@ class Chan extends Record /** * @var array */ - protected $note = array(); + protected $note = []; /** * @param string $date + * * @return Chan */ public function setDate($date = '') { $this->date = $date; + return $this; } @@ -57,11 +58,13 @@ public function getDate() /** * @param Record\NoteRef $note + * * @return Chan */ public function addNote($note = []) { $this->note[] = $note; + return $this; } @@ -75,11 +78,13 @@ public function getNote() /** * @param string $time + * * @return Chan */ public function setTime($time = '') { $this->time = $time; + return $this; } diff --git a/library/PhpGedcom/Record/Data.php b/library/PhpGedcom/Record/Data.php index 9959df1b..92f67b36 100644 --- a/library/PhpGedcom/Record/Data.php +++ b/library/PhpGedcom/Record/Data.php @@ -1,14 +1,14 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ @@ -17,8 +17,7 @@ use PhpGedcom\Record; /** - * Class Data - * @package PhpGedcom\Record + * Class Data. */ class Data extends Record { @@ -34,11 +33,13 @@ class Data extends Record /** * @param string $text + * * @return Data */ public function setText($text = '') { $this->text = $text; + return $this; } @@ -52,11 +53,13 @@ public function getText() /** * @param string $date + * * @return Data */ public function setDate($date = '') { $this->date = $date; + return $this; } diff --git a/library/PhpGedcom/Record/Date.php b/library/PhpGedcom/Record/Date.php index f54c07c7..7ee5da98 100644 --- a/library/PhpGedcom/Record/Date.php +++ b/library/PhpGedcom/Record/Date.php @@ -1,14 +1,14 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ @@ -17,109 +17,117 @@ use PhpGedcom\Record; /** - * Class Date - * @package PhpGedcom\Record + * Class Date. */ -class Date extends Record { - /** - * @var string - */ - protected $date = null; +class Date extends Record +{ + /** + * @var string + */ + protected $date = null; - /** - * @var array - */ - private $months = [ - 'JAN' => 1, 'FEB' => 2, 'MAR' => 3, 'APR' => 4, 'MAY' => 5, 'JUN' => 6, - 'JUL' => 7, 'AUG' => 8, 'SEP' => 9, 'OCT' => 10, 'NOV' => 11, 'DEC' => 12, - ]; + /** + * @var array + */ + private $months = [ + 'JAN' => 1, 'FEB' => 2, 'MAR' => 3, 'APR' => 4, 'MAY' => 5, 'JUN' => 6, + 'JUL' => 7, 'AUG' => 8, 'SEP' => 9, 'OCT' => 10, 'NOV' => 11, 'DEC' => 12, + ]; - /** - * @param string $date Date array - * @return Date - */ - public function setDate($date) { - $this->date = $date; + /** + * @param string $date Date array + * + * @return Date + */ + public function setDate($date) + { + $this->date = $date; - return $this; - } + return $this; + } - /** - * @return null|string - */ - public function getDate() { - return $this->date; - } + /** + * @return null|string + */ + public function getDate() + { + return $this->date; + } - /** - * Return month part of date - * - * @return int|null - */ - public function getMonth() { - $record = explode(' ', $this->date); - if (count($record) > 0) { - if ($this->isPrefix($record[0])) { - unset($record[0]); - } - foreach ($record as $part) { - if (isset($this->months[trim($part)])) { - return $this->months[trim($part)]; - } - } - } + /** + * Return month part of date. + * + * @return int|null + */ + public function getMonth() + { + $record = explode(' ', $this->date); + if (count($record) > 0) { + if ($this->isPrefix($record[0])) { + unset($record[0]); + } + foreach ($record as $part) { + if (isset($this->months[trim($part)])) { + return $this->months[trim($part)]; + } + } + } - return null; - } + return null; + } - /** - * Return year part of date - * - * @return int|null - */ - public function getYear() { - $record = explode(' ', $this->date); - if (count($record) > 0) { - if ($this->isPrefix($record[0])) { - unset($record[0]); - } - if (count($record) > 0) { - return (int) end($record); - } - } + /** + * Return year part of date. + * + * @return int|null + */ + public function getYear() + { + $record = explode(' ', $this->date); + if (count($record) > 0) { + if ($this->isPrefix($record[0])) { + unset($record[0]); + } + if (count($record) > 0) { + return (int) end($record); + } + } - return null; - } + return null; + } - /** - * Return day part of date - * - * @return int|null - */ - public function getDay() { - $record = explode(' ', $this->date); - if (!empty($record[0])) { - if ($this->isPrefix($record[0])) { - unset($record[0]); - } - if (count($record) > 0) { - $day = (int) reset($record); - if ($day >= 1 && $day <= 31) { - return $day; - } - } - } + /** + * Return day part of date. + * + * @return int|null + */ + public function getDay() + { + $record = explode(' ', $this->date); + if (!empty($record[0])) { + if ($this->isPrefix($record[0])) { + unset($record[0]); + } + if (count($record) > 0) { + $day = (int) reset($record); + if ($day >= 1 && $day <= 31) { + return $day; + } + } + } - return null; - } + return null; + } - /** - * Check if the first part is a prefix (eg 'BEF', 'ABT',). - * - * @param string $datePart Date part to be checked - * @return bool - */ - private function isPrefix($datePart) { - return in_array($datePart, ['FROM', 'TO', 'BEF', 'AFT', 'BET', 'AND', 'ABT', 'EST', 'CAL', 'INT']); - } -} \ No newline at end of file + /** + * Check if the first part is a prefix (eg 'BEF', 'ABT',). + * + * @param string $datePart Date part to be checked + * + * @return bool + */ + private function isPrefix($datePart) + { + return in_array($datePart, ['FROM', 'TO', 'BEF', 'AFT', 'BET', 'AND', 'ABT', 'EST', 'CAL', 'INT']); + } +} diff --git a/library/PhpGedcom/Record/Fam.php b/library/PhpGedcom/Record/Fam.php index 5676b723..df6d07cd 100644 --- a/library/PhpGedcom/Record/Fam.php +++ b/library/PhpGedcom/Record/Fam.php @@ -1,152 +1,96 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Record; -/** - * - * - */ -class Fam extends \PhpGedcom\Record implements Noteable, Sourceable, Objectable { - /** - * - */ - protected $_id = null; - - /** - * - */ - protected $_resn = null; - - /** - * - */ - protected $_even = array(); - - - /** - * - */ - protected $_husb = null; - - /** - * - */ - protected $_wife = null; - - /** - * - */ - protected $_chil = array(); - /** - * - */ - protected $_nchi = null; - /** - * - */ - protected $_subm = array(); - - /** - * - */ - protected $_slgs = array(); - - /** - * - */ - protected $_refn = array(); - - /** - * - */ - protected $_rin = null; - /** - * - */ - protected $_chan = null; - - /** - * - */ - protected $_note = array(); - - /** - * - */ - protected $_sour = array(); - - /** - * - */ - protected $_obje = array(); - - /** - * - */ - public function addEven($even) { - $this->_even[$even->getType()] = $even; - } - - /** - * @return array - */ - public function getAllEven() { - return $this->_even; - } - /** - * @return void|\PhpGedcom\Record\Fam\Even - */ - public function getEven($key = '') { - if (isset($this->_even[strtoupper($key)])) { - return $this->_even[strtoupper($key)]; - } - - } - /** - * - */ - public function addSlgs($slgs = []) { - $this->_slgs[] = $slgs; - } - - /** - * - * - */ - public function addRefn($refn = []) { - $this->_refn[] = $refn; - } - - /** - * - */ - public function addNote($note = []) { - $this->_note[] = $note; - } - - /** - * - */ - public function addSour($sour = []) { - $this->_sour[] = $sour; - } - - /** - * - */ - public function addObje($obje = []) { - $this->_obje[] = $obje; - } +class Fam extends \PhpGedcom\Record implements Noteable, Sourceable, Objectable +{ + protected $_id = null; + + protected $_resn = null; + + protected $_even = []; + + protected $_husb = null; + + protected $_wife = null; + + protected $_chil = []; + + protected $_nchi = null; + + protected $_subm = []; + + protected $_slgs = []; + + protected $_refn = []; + + protected $_rin = null; + + protected $_chan = null; + + protected $_note = []; + + protected $_sour = []; + + protected $_obje = []; + + public function addEven($even) + { + $this->_even[$even->getType()] = $even; + } + + /** + * @return array + */ + public function getAllEven() + { + return $this->_even; + } + + /** + * @return void|\PhpGedcom\Record\Fam\Even + */ + public function getEven($key = '') + { + if (isset($this->_even[strtoupper($key)])) { + return $this->_even[strtoupper($key)]; + } + } + + public function addSlgs($slgs = []) + { + $this->_slgs[] = $slgs; + } + + public function addRefn($refn = []) + { + $this->_refn[] = $refn; + } + + public function addNote($note = []) + { + $this->_note[] = $note; + } + + public function addSour($sour = []) + { + $this->_sour[] = $sour; + } + + public function addObje($obje = []) + { + $this->_obje[] = $obje; + } } diff --git a/library/PhpGedcom/Record/Fam/Anul.php b/library/PhpGedcom/Record/Fam/Anul.php index 63fc24ca..323930d0 100644 --- a/library/PhpGedcom/Record/Fam/Anul.php +++ b/library/PhpGedcom/Record/Fam/Anul.php @@ -1,22 +1,19 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Record\Fam; -/** - * - */ class Anul extends \PhpGedcom\Record\Fam\Even { } diff --git a/library/PhpGedcom/Record/Fam/Cens.php b/library/PhpGedcom/Record/Fam/Cens.php index 16968d84..b1a2be54 100644 --- a/library/PhpGedcom/Record/Fam/Cens.php +++ b/library/PhpGedcom/Record/Fam/Cens.php @@ -1,22 +1,19 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Record\Fam; -/** - * - */ class Cens extends \PhpGedcom\Record\Fam\Even { } diff --git a/library/PhpGedcom/Record/Fam/Div.php b/library/PhpGedcom/Record/Fam/Div.php index 33dfb41e..1b9050d1 100644 --- a/library/PhpGedcom/Record/Fam/Div.php +++ b/library/PhpGedcom/Record/Fam/Div.php @@ -1,22 +1,19 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Record\Fam; -/** - * - */ class Div extends \PhpGedcom\Record\Fam\Even { } diff --git a/library/PhpGedcom/Record/Fam/Enga.php b/library/PhpGedcom/Record/Fam/Enga.php index a3e444cf..e8659e8e 100644 --- a/library/PhpGedcom/Record/Fam/Enga.php +++ b/library/PhpGedcom/Record/Fam/Enga.php @@ -1,22 +1,19 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Record\Fam; -/** - * - */ class Enga extends \PhpGedcom\Record\Fam\Even { } diff --git a/library/PhpGedcom/Record/Fam/Even.php b/library/PhpGedcom/Record/Fam/Even.php index 233568ee..9e9d3c5f 100644 --- a/library/PhpGedcom/Record/Fam/Even.php +++ b/library/PhpGedcom/Record/Fam/Even.php @@ -1,87 +1,70 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Record\Fam; -use \PhpGedcom\Record\Noteable; -use \PhpGedcom\Record\Objectable; -use \PhpGedcom\Record\Sourceable; +use PhpGedcom\Record\Noteable; +use PhpGedcom\Record\Objectable; +use PhpGedcom\Record\Sourceable; /** - * * Event record. * - * @method mixed getType() + * @method mixed getType() * @method \PhpGedcom\Record\Date getDate() - * @method string getPlac() + * @method string getPlac() */ -class Even extends \PhpGedcom\Record implements Objectable, Sourceable, Noteable { - protected $_type = null; - protected $_date = null; - protected $_plac = null; - protected $_caus = null; - protected $_age = null; +class Even extends \PhpGedcom\Record implements Objectable, Sourceable, Noteable +{ + protected $_type = null; + protected $_date = null; + protected $_plac = null; + protected $_caus = null; + protected $_age = null; - protected $_addr = null; + protected $_addr = null; - protected $_phon = array(); + protected $_phon = []; - protected $_agnc = null; + protected $_agnc = null; - protected $_husb = null; - protected $_wife = null; + protected $_husb = null; + protected $_wife = null; - /** - * - */ - protected $_obje = array(); + protected $_obje = []; - /** - * - */ - protected $_sour = array(); + protected $_sour = []; - /** - * - */ - protected $_note = array(); + protected $_note = []; - /** - * - */ - public function addPhon($phon = []) { - $this->_phon[] = $phon; - } + public function addPhon($phon = []) + { + $this->_phon[] = $phon; + } - /** - * - */ - public function addObje($obje = []) { - $this->_obje[] = $obje; - } + public function addObje($obje = []) + { + $this->_obje[] = $obje; + } - /** - * - */ - public function addSour($sour = []) { - $this->_sour[] = $sour; - } + public function addSour($sour = []) + { + $this->_sour[] = $sour; + } - /** - * - */ - public function addNote($note = []) { - $this->_note[] = $note; - } + public function addNote($note = []) + { + $this->_note[] = $note; + } } diff --git a/library/PhpGedcom/Record/Fam/Even/Husb.php b/library/PhpGedcom/Record/Fam/Even/Husb.php index 52b55724..53ed7afa 100644 --- a/library/PhpGedcom/Record/Fam/Even/Husb.php +++ b/library/PhpGedcom/Record/Fam/Even/Husb.php @@ -1,22 +1,19 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Record\Fam\Even; -/** - * - */ class Husb extends \PhpGedcom\Record { protected $_age = null; diff --git a/library/PhpGedcom/Record/Fam/Even/Wife.php b/library/PhpGedcom/Record/Fam/Even/Wife.php index cabbf872..d0c97d3d 100644 --- a/library/PhpGedcom/Record/Fam/Even/Wife.php +++ b/library/PhpGedcom/Record/Fam/Even/Wife.php @@ -1,22 +1,19 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Record\Fam\Even; -/** - * - */ class Wife extends \PhpGedcom\Record { protected $_age = null; diff --git a/library/PhpGedcom/Record/Fam/Marb.php b/library/PhpGedcom/Record/Fam/Marb.php index 55efca28..cf31a8ca 100644 --- a/library/PhpGedcom/Record/Fam/Marb.php +++ b/library/PhpGedcom/Record/Fam/Marb.php @@ -1,22 +1,19 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Record\Fam; -/** - * - */ class Marb extends \PhpGedcom\Record\Fam\Even { } diff --git a/library/PhpGedcom/Record/Fam/Marc.php b/library/PhpGedcom/Record/Fam/Marc.php index 77019908..ba6f178a 100644 --- a/library/PhpGedcom/Record/Fam/Marc.php +++ b/library/PhpGedcom/Record/Fam/Marc.php @@ -1,22 +1,19 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Record\Fam; -/** - * - */ class Marc extends \PhpGedcom\Record\Fam\Even { } diff --git a/library/PhpGedcom/Record/Fam/Marl.php b/library/PhpGedcom/Record/Fam/Marl.php index 7fcd714e..6e2bc342 100644 --- a/library/PhpGedcom/Record/Fam/Marl.php +++ b/library/PhpGedcom/Record/Fam/Marl.php @@ -1,22 +1,19 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Record\Fam; -/** - * - */ class Marl extends \PhpGedcom\Record\Fam\Even { } diff --git a/library/PhpGedcom/Record/Fam/Marr.php b/library/PhpGedcom/Record/Fam/Marr.php index fd6e3584..0bfaa559 100644 --- a/library/PhpGedcom/Record/Fam/Marr.php +++ b/library/PhpGedcom/Record/Fam/Marr.php @@ -1,22 +1,19 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Record\Fam; -/** - * - */ class Marr extends \PhpGedcom\Record\Fam\Even { } diff --git a/library/PhpGedcom/Record/Fam/Mars.php b/library/PhpGedcom/Record/Fam/Mars.php index 7bc12f04..7a8359d9 100644 --- a/library/PhpGedcom/Record/Fam/Mars.php +++ b/library/PhpGedcom/Record/Fam/Mars.php @@ -1,22 +1,19 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Record\Fam; -/** - * - */ class Mars extends \PhpGedcom\Record\Fam\Even { } diff --git a/library/PhpGedcom/Record/Fam/Slgs.php b/library/PhpGedcom/Record/Fam/Slgs.php index 4584fdda..89da9353 100644 --- a/library/PhpGedcom/Record/Fam/Slgs.php +++ b/library/PhpGedcom/Record/Fam/Slgs.php @@ -1,25 +1,22 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Record\Fam; -use \PhpGedcom\Record\Sourceable; -use \PhpGedcom\Record\Noteable; +use PhpGedcom\Record\Noteable; +use PhpGedcom\Record\Sourceable; -/** - * - */ class Slgs extends \PhpGedcom\Record implements Sourceable, Noteable { protected $_stat; @@ -27,27 +24,15 @@ class Slgs extends \PhpGedcom\Record implements Sourceable, Noteable protected $_plac; protected $_temp; - /** - * - */ - protected $_sour = array(); + protected $_sour = []; - /** - * - */ - protected $_note = array(); + protected $_note = []; - /** - * - */ public function addSour($sour = []) { $this->_sour[] = $sour; } - /** - * - */ public function addNote($note = []) { $this->_note[] = $note; diff --git a/library/PhpGedcom/Record/Fam/Slgs/Stat.php b/library/PhpGedcom/Record/Fam/Slgs/Stat.php index ca2f59b6..0db8baa4 100644 --- a/library/PhpGedcom/Record/Fam/Slgs/Stat.php +++ b/library/PhpGedcom/Record/Fam/Slgs/Stat.php @@ -1,32 +1,29 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ @@ -83,11 +83,13 @@ class Head extends Record /** * @param \PhpGedcom\Record\Head\Sour $sour + * * @return Head */ public function setSour($sour = []) { $this->sour = $sour; + return $this; } @@ -101,11 +103,13 @@ public function getSour() /** * @param \PhpGedcom\Record\Head\Date $date + * * @return Head */ public function setDate($date = []) { $this->date = $date; + return $this; } @@ -119,11 +123,13 @@ public function getDate() /** * @param \PhpGedcom\Record\Head\Gedc $gedc + * * @return Head */ public function setGedc($gedc = []) { $this->gedc = $gedc; + return $this; } @@ -137,11 +143,13 @@ public function getGedc() /** * @param \PhpGedcom\Record\Head\Char $char + * * @return Head */ public function setChar($char = []) { $this->char = $char; + return $this; } @@ -155,11 +163,13 @@ public function getChar() /** * @param \PhpGedcom\Record\Head\Plac $plac + * * @return Head */ public function setPlac($plac = []) { $this->plac = $plac; + return $this; } @@ -173,11 +183,13 @@ public function getPlac() /** * @param string $subm + * * @return Head */ public function setSubm($subm = '') { $this->subm = $subm; + return $this; } @@ -191,11 +203,13 @@ public function getSubm() /** * @param string $subn + * * @return Head */ public function setSubn($subn = '') { $this->subn = $subn; + return $this; } @@ -209,11 +223,13 @@ public function getSubn() /** * @param string $lang + * * @return Head */ public function setLang($lang = '') { $this->lang = $lang; + return $this; } @@ -227,11 +243,13 @@ public function getLang() /** * @param string $file + * * @return Head */ public function setFile($file = '') { $this->file = $file; + return $this; } @@ -245,11 +263,13 @@ public function getFile() /** * @param string $dest + * * @return Head */ public function setDest($dest = '') { $this->dest = $dest; + return $this; } @@ -263,11 +283,13 @@ public function getDest() /** * @param string $copr + * * @return Head */ public function setCopr($copr = '') { $this->copr = $copr; + return $this; } @@ -281,11 +303,13 @@ public function getCopr() /** * @param string $note + * * @return Head */ public function setNote($note = '') { $this->note = $note; + return $this; } diff --git a/library/PhpGedcom/Record/Head/Char.php b/library/PhpGedcom/Record/Head/Char.php index ab28ce0e..4e7e44cc 100644 --- a/library/PhpGedcom/Record/Head/Char.php +++ b/library/PhpGedcom/Record/Head/Char.php @@ -1,21 +1,19 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ + namespace PhpGedcom\Record\Head; -/** - * - */ class Char extends \PhpGedcom\Record { protected $_char = null; diff --git a/library/PhpGedcom/Record/Head/Date.php b/library/PhpGedcom/Record/Head/Date.php index 7e364887..ca4570e4 100644 --- a/library/PhpGedcom/Record/Head/Date.php +++ b/library/PhpGedcom/Record/Head/Date.php @@ -1,22 +1,19 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Record\Head; -/** - * - */ class Date extends \PhpGedcom\Record { protected $_date = null; diff --git a/library/PhpGedcom/Record/Head/Gedc.php b/library/PhpGedcom/Record/Head/Gedc.php index 4924437c..a696326c 100644 --- a/library/PhpGedcom/Record/Head/Gedc.php +++ b/library/PhpGedcom/Record/Head/Gedc.php @@ -1,62 +1,54 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Record\Head; -/** - * - */ -class Gedc extends \PhpGedcom\Record { - /** - * - */ - protected $_vers = null; +class Gedc extends \PhpGedcom\Record +{ + protected $_vers = null; - /** - * - */ - protected $_form = null; + protected $_form = null; - /** - * - * @return Gedc/version - */ - public function getVersion() { - return $this->_vers; - } + /** + * @return Gedc/version + */ + public function getVersion() + { + return $this->_vers; + } - /** - * - * @param Gedc/version - */ - public function setVersion($vers = []) { - $this->_vers = $vers; - } + /** + * @param Gedc/version + */ + public function setVersion($vers = []) + { + $this->_vers = $vers; + } - /** - * - * @return Gedc/form - */ - public function getForm() { - return $this->_form; - } + /** + * @return Gedc/form + */ + public function getForm() + { + return $this->_form; + } - /** - * - * @param Gedc/version - */ - public function setForm($form = []) { - $this->_form = $form; - } + /** + * @param Gedc/version + */ + public function setForm($form = []) + { + $this->_form = $form; + } } diff --git a/library/PhpGedcom/Record/Head/Plac.php b/library/PhpGedcom/Record/Head/Plac.php index 706fe24c..e2b28f92 100644 --- a/library/PhpGedcom/Record/Head/Plac.php +++ b/library/PhpGedcom/Record/Head/Plac.php @@ -1,26 +1,20 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Record\Head; -/** - * - */ class Plac extends \PhpGedcom\Record { - /** - * - */ protected $_form = null; } diff --git a/library/PhpGedcom/Record/Head/Sour.php b/library/PhpGedcom/Record/Head/Sour.php index 09949a46..8c0dc638 100644 --- a/library/PhpGedcom/Record/Head/Sour.php +++ b/library/PhpGedcom/Record/Head/Sour.php @@ -1,110 +1,92 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Record\Head; -/** - * - */ -class Sour extends \PhpGedcom\Record { - /** - * - */ - protected $_sour = null; - - /** - * - */ - protected $_vers = null; +class Sour extends \PhpGedcom\Record +{ + protected $_sour = null; - /** - * - */ - protected $_name = null; + protected $_vers = null; - /** - * - */ - protected $_corp = null; + protected $_name = null; - /** - * - */ - protected $_data = null; + protected $_corp = null; - /** - * - * @param Sour\Corp $corp - */ - public function setCorp($corp = []) { - $this->_corp = $corp; - } + protected $_data = null; - /** - * - * @return Sour\Corp - */ - public function getCorp() { - return $this->_corp; - } + /** + * @param Sour\Corp $corp + */ + public function setCorp($corp = []) + { + $this->_corp = $corp; + } - /** - * - * @param \PhpGedcom\Record\Head\Sour\Data $data - */ - public function setData($data = []) { - $this->_data = $data; - } + /** + * @return Sour\Corp + */ + public function getCorp() + { + return $this->_corp; + } - /** - * - * @return \PhpGedcom\Record\Head\Sour\Data - */ - public function getData() { - return $this->_data; - } + /** + * @param \PhpGedcom\Record\Head\Sour\Data $data + */ + public function setData($data = []) + { + $this->_data = $data; + } - /** - * - * @return Sour\Name - */ - public function getName() { - return $this->_name; - } + /** + * @return \PhpGedcom\Record\Head\Sour\Data + */ + public function getData() + { + return $this->_data; + } - /** - * - * @param Sour\Name - */ - public function setName($name = []) { - $this->_name = $name; - } + /** + * @return Sour\Name + */ + public function getName() + { + return $this->_name; + } - /** - * - * @return Sour\Version - */ - public function getVersion() { - return $this->_vers; - } + /** + * @param Sour\Name + */ + public function setName($name = []) + { + $this->_name = $name; + } - /** - * - * @param Sour\Version - */ - public function setVersion($version = []) { - $this->_vers = $version; - } + /** + * @return Sour\Version + */ + public function getVersion() + { + return $this->_vers; + } + /** + * @param Sour\Version + */ + public function setVersion($version = []) + { + $this->_vers = $version; + } } diff --git a/library/PhpGedcom/Record/Head/Sour/Corp.php b/library/PhpGedcom/Record/Head/Sour/Corp.php index 40ed2205..3011112b 100644 --- a/library/PhpGedcom/Record/Head/Sour/Corp.php +++ b/library/PhpGedcom/Record/Head/Sour/Corp.php @@ -1,33 +1,26 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Record\Head\Sour; -/** - * - */ class Corp extends \PhpGedcom\Record { protected $_corp = null; protected $_addr = null; - protected $_phon = array(); + protected $_phon = []; - /** - * - * - */ public function addPhon($phon = []) { $this->_phon[] = $phon; diff --git a/library/PhpGedcom/Record/Head/Sour/Data.php b/library/PhpGedcom/Record/Head/Sour/Data.php index e31fb0dd..7ab7e0ea 100644 --- a/library/PhpGedcom/Record/Head/Sour/Data.php +++ b/library/PhpGedcom/Record/Head/Sour/Data.php @@ -1,21 +1,19 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ + namespace PhpGedcom\Record\Head\Sour; -/** - * - */ class Data extends \PhpGedcom\Record { protected $_data = null; diff --git a/library/PhpGedcom/Record/Indi.php b/library/PhpGedcom/Record/Indi.php index fe7b9d15..23d6e41b 100644 --- a/library/PhpGedcom/Record/Indi.php +++ b/library/PhpGedcom/Record/Indi.php @@ -1,626 +1,741 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Record; use PhpGedcom\Record; -use PhpGedcom\Record\NoteRef; -use PhpGedcom\Record\ObjeRef; -use PhpGedcom\Record\Refn; -use PhpGedcom\Record\SourRef; + /** - * Class Indi - * @package PhpGedcom\Record + * Class Indi. */ -class Indi extends Record implements Noteable, Objectable, Sourceable { - /** - * @var string - */ - protected $id; - - /** - * @var string - */ - protected $uid; - - /** - * @var string - */ - protected $resn; - /** - * @var Indi\Name[] - */ - protected $name = array(); - /** - * @var string - */ - protected $sex; - - /** - * @var Indi\Even[] - */ - protected $even = array(); - /** - * @var Indi\Attr[] - */ - protected $attr = array(); - /** - * @var Indi\Bapl - */ - protected $bapl = array(); - - /** - * @var Indi\Conl - */ - protected $conl = array(); - - /** - * @var Indi\Endl - */ - protected $endl = array(); - - /** - * @var Indi\Slgc - */ - protected $slgc = array(); - - /** - * @var Indi\Famc[] - */ - protected $famc = array(); - /** - * @var Indi\Fams[] - */ - protected $fams = array(); - /** - * @var string[] - */ - protected $subm = array(); - /** - * @var string[] - */ - protected $alia = array(); - /** - * @var string[] - */ - protected $anci = array(); - /** - * @var string[] - */ - protected $desi = array(); - /** - * @var string - */ - protected $rfn; - /** - * @var string - */ - protected $afn; - /** - * @var Refn[] - */ - protected $refn = array(); - /** - * @var string - */ - protected $rin; - - /** - * @var string - */ - protected $chan; - - - /** - * @var Indi\Note[] - */ - protected $note = array(); - - /** - * @var Obje[] - */ - protected $obje = array(); - - /** - * @var Sour[] - */ - protected $sour = array(); - - - /** - * @var Indi\Asso[] - */ - protected $asso = array(); - - - - /** - * @param string $id - * @return Indi - */ - public function setId($id = '') { - $this->id = $id; - return $this; - } - - /** - * @return string - */ - public function getId() { - return $this->id; - } - - /** - * @param string $uid - * @return Indi - */ - public function setUid($uid = '') { - $this->uid = $uid; - return $this; - } - - /** - * @return string - */ - public function getUid() { - return $this->uid; - } - - /** - * @param Indi\Name $name - * @return Indi - */ - public function addName($name = []) { - $this->name[] = $name; - return $this; - } - - /** - * @return Indi\Name[] - */ - public function getName() { - return $this->name; - } - - /** - * @param Indi\Attr $attr - * @return Indi - */ - public function addAttr($attr = []) { - $attrName = $attr->getType(); - - if (!array_key_exists($attrName, $this->attr)) { - $this->attr[$attrName] = []; - } - - $this->attr[$attrName][] = $attr; - return $this; - } - - /** - * @return Indi\Attr[] - */ - public function getAllAttr() { - return $this->attr; - } - /** - * @return Indi\Attr[] - */ - public function getAttr($key = '') { - if (isset($this->attr[strtoupper($key)])) { - return $this->attr[strtoupper($key)]; - } - - } - /** - * @param Indi\Even $even - * @return Indi - */ - public function addEven($even = []) { - $evenName = $even->getType(); - - if (!array_key_exists($evenName, $this->even)) { - $this->even[$evenName] = []; - } - - $this->even[$evenName][] = $even; - return $this; - } - - /** - * @return array - */ - public function getAllEven() { - return $this->even; - } - - /** - * @return array - */ - public function getEven($key = '') { - if (isset($this->even[strtoupper($key)])) { - return $this->even[strtoupper($key)]; - } - - } - - /** - * @param Indi\Asso $asso - * @return Indi - */ - public function addAsso($asso = []) { - $this->asso[] = $asso; - return $this; - } - - /** - * @return array - */ - public function getAsso() { - return $this->asso; - } - - /** - * @param Refn $ref - * @return Indi - */ - public function addRefn($ref = []) { - $this->refn[] = $ref; - return $this; - } - - /** - * @return Refn[] - */ - public function getRefn() { - return $this->refn; - } - - /** - * @param \PhpGedcom\Record\NoteRef $note - * @return Indi - */ - public function addNote($note = []) { - $this->note[] = $note; - return $this; - } - - /** - * @return array - */ - public function getNote() { - return $this->note; - } - - /** - * @param ObjeRef $obje - * @return Indi - */ - public function addObje($obje = []) { - $this->obje[] = $obje; - return $this; - } - - /** - * @return array - */ - public function getObje() { - return $this->obje; - } - - /** - * @param SourRef $sour - * @return Indi - */ - public function addSour($sour = []) { - $this->sour[] = $sour; - return $this; - } - - /** - * @return array - */ - public function getSour() { - return $this->sour; - } - - /** - * @param string $indi - * @return Indi - */ - public function addAlia($indi = '') { - $this->alia[] = $indi; - return $this; - } - - /** - * @return array - */ - public function getAlia() { - return $this->alia; - } - - /** - * @param Indi\Famc $famc - * @return Indi - */ - public function addFamc($famc = []) { - $this->famc[] = $famc; - return $this; - } - - /** - * @return array - */ - public function getFamc() { - return $this->famc; - } - - /** - * @param Indi\Fams $fams - * @return Indi - */ - public function addFams($fams = []) { - $this->fams[] = $fams; - return $this; - } - - /** - * @return array - */ - public function getFams() { - return $this->fams; - } - - /** - * @param string $subm - * @return Indi - */ - public function addAnci($subm = '') { - $this->anci[] = $subm; - return $this; - } - - /** - * @return string[] - */ - public function getAnci() { - return $this->anci; - } - - /** - * @param string $subm - * @return Indi - */ - public function addDesi($subm = '') { - $this->desi[] = $subm; - return $this; - } - - /** - * @return string[] - */ - public function getDesi() { - return $this->desi; - } - - /** - * @param string $subm - * @return Indi - */ - public function addSubm($subm = '') { - $this->subm[] = $subm; - return $this; - } - - /** - * @return string[] - */ - public function getSubm() { - return $this->subm; - } - - /** - * @param string $resn - * @return Indi - */ - public function setResn($resn = '') { - $this->resn = $resn; - return $this; - } - - /** - * @return string - */ - public function getResn() { - return $this->resn; - } - - /** - * @param string $sex - * @return Indi - */ - public function setSex($sex = '') { - $this->sex = $sex; - return $this; - } - - /** - * @return string - */ - public function getSex() { - return $this->sex; - } - - /** - * @param string $rfn - * @return Indi - */ - public function setRfn($rfn = '') { - $this->rfn = $rfn; - return $this; - } - - /** - * @return string - */ - public function getRfn() { - return $this->rfn; - } - - /** - * @param string $afn - * @return Indi - */ - public function setAfn($afn = '') { - $this->afn = $afn; - return $this; - } - - /** - * @return string - */ - public function getAfn() { - return $this->afn; - } - - /** - * @param string $chan - * @return Indi - */ - public function setChan($chan = null) { - $this->chan = $chan; - return $this; - } - - /** - * @return string - */ - public function getChan() { - return $this->chan; - } - - /** - * @param string $rin - * @return Indi - */ - public function setRin($rin = '') { - $this->rin = $rin; - return $this; - } - - /** - * @return string - */ - public function getRin() { - return $this->rin; - } - - /** - * @param Indi\Bapl $bapl - * @return Indi - */ - public function setBapl($bapl = []) { - $this->bapl = $bapl; - return $this; - } - /** - * @param Indi\Bapl $bapl - * @return Indi - */ - public function addBapl($bapl = null) { - $this->bapl[] = $bapl; - return $this; - } - /** - * @return Indi\Bapl - */ - public function getBapl() { - return $this->bapl; - } - - /** - * @param Indi\Conl $conl - * @return Indi - */ - public function setConl($conl = []) { - $this->conl = $conl; - return $this; - } - /** - * @param Indi\Conl $conl - * @return Indi - */ - public function addConl($conl) { - $this->conl[] = $conl; - return $this; - } - - /** - * @return Indi\Conl - */ - public function getConl() { - return $this->conl; - } - - /** - * @param Indi\Endl $endl - * @return Indi - */ - public function setEndl($endl = []) { - $this->endl = $endl; - return $this; - } - /** - * @param Indi\Endl $endl - * @return Indi - */ - public function addEndl($endl) { - $this->endl[] = $endl; - return $this; - } - - /** - * @return Indi\Endl - */ - public function getEndl() { - return $this->endl; - } - - /** - * @param Indi\Slgc $slgc - * @return Indi - */ - public function setSlgc($slgc = []) { - $this->slgc = $slgc; - return $this; - } - - /** - * @param Indi\Slgc $slgc - * @return Indi - */ - public function addSlgc($slgc) { - $this->slgc[] = $slgc; - return $this; - } - - /** - * @return Indi\Slgc - */ - public function getSlgc() { - return $this->slgc; - } +class Indi extends Record implements Noteable, Objectable, Sourceable +{ + /** + * @var string + */ + protected $id; + + /** + * @var string + */ + protected $uid; + + /** + * @var string + */ + protected $resn; + /** + * @var Indi\Name[] + */ + protected $name = []; + /** + * @var string + */ + protected $sex; + + /** + * @var Indi\Even[] + */ + protected $even = []; + /** + * @var Indi\Attr[] + */ + protected $attr = []; + /** + * @var Indi\Bapl + */ + protected $bapl = []; + + /** + * @var Indi\Conl + */ + protected $conl = []; + + /** + * @var Indi\Endl + */ + protected $endl = []; + + /** + * @var Indi\Slgc + */ + protected $slgc = []; + + /** + * @var Indi\Famc[] + */ + protected $famc = []; + /** + * @var Indi\Fams[] + */ + protected $fams = []; + /** + * @var string[] + */ + protected $subm = []; + /** + * @var string[] + */ + protected $alia = []; + /** + * @var string[] + */ + protected $anci = []; + /** + * @var string[] + */ + protected $desi = []; + /** + * @var string + */ + protected $rfn; + /** + * @var string + */ + protected $afn; + /** + * @var Refn[] + */ + protected $refn = []; + /** + * @var string + */ + protected $rin; + + /** + * @var string + */ + protected $chan; + + /** + * @var Indi\Note[] + */ + protected $note = []; + + /** + * @var Obje[] + */ + protected $obje = []; + + /** + * @var Sour[] + */ + protected $sour = []; + + /** + * @var Indi\Asso[] + */ + protected $asso = []; + + /** + * @param string $id + * + * @return Indi + */ + public function setId($id = '') + { + $this->id = $id; + + return $this; + } + + /** + * @return string + */ + public function getId() + { + return $this->id; + } + + /** + * @param string $uid + * + * @return Indi + */ + public function setUid($uid = '') + { + $this->uid = $uid; + + return $this; + } + + /** + * @return string + */ + public function getUid() + { + return $this->uid; + } + + /** + * @param Indi\Name $name + * + * @return Indi + */ + public function addName($name = []) + { + $this->name[] = $name; + + return $this; + } + + /** + * @return Indi\Name[] + */ + public function getName() + { + return $this->name; + } + + /** + * @param Indi\Attr $attr + * + * @return Indi + */ + public function addAttr($attr = []) + { + $attrName = $attr->getType(); + + if (!array_key_exists($attrName, $this->attr)) { + $this->attr[$attrName] = []; + } + + $this->attr[$attrName][] = $attr; + + return $this; + } + + /** + * @return Indi\Attr[] + */ + public function getAllAttr() + { + return $this->attr; + } + + /** + * @return Indi\Attr[] + */ + public function getAttr($key = '') + { + if (isset($this->attr[strtoupper($key)])) { + return $this->attr[strtoupper($key)]; + } + } + + /** + * @param Indi\Even $even + * + * @return Indi + */ + public function addEven($even = []) + { + $evenName = $even->getType(); + + if (!array_key_exists($evenName, $this->even)) { + $this->even[$evenName] = []; + } + + $this->even[$evenName][] = $even; + + return $this; + } + + /** + * @return array + */ + public function getAllEven() + { + return $this->even; + } + + /** + * @return array + */ + public function getEven($key = '') + { + if (isset($this->even[strtoupper($key)])) { + return $this->even[strtoupper($key)]; + } + } + + /** + * @param Indi\Asso $asso + * + * @return Indi + */ + public function addAsso($asso = []) + { + $this->asso[] = $asso; + + return $this; + } + + /** + * @return array + */ + public function getAsso() + { + return $this->asso; + } + + /** + * @param Refn $ref + * + * @return Indi + */ + public function addRefn($ref = []) + { + $this->refn[] = $ref; + + return $this; + } + + /** + * @return Refn[] + */ + public function getRefn() + { + return $this->refn; + } + + /** + * @param \PhpGedcom\Record\NoteRef $note + * + * @return Indi + */ + public function addNote($note = []) + { + $this->note[] = $note; + + return $this; + } + + /** + * @return array + */ + public function getNote() + { + return $this->note; + } + + /** + * @param ObjeRef $obje + * + * @return Indi + */ + public function addObje($obje = []) + { + $this->obje[] = $obje; + + return $this; + } + + /** + * @return array + */ + public function getObje() + { + return $this->obje; + } + + /** + * @param SourRef $sour + * + * @return Indi + */ + public function addSour($sour = []) + { + $this->sour[] = $sour; + + return $this; + } + + /** + * @return array + */ + public function getSour() + { + return $this->sour; + } + + /** + * @param string $indi + * + * @return Indi + */ + public function addAlia($indi = '') + { + $this->alia[] = $indi; + + return $this; + } + + /** + * @return array + */ + public function getAlia() + { + return $this->alia; + } + + /** + * @param Indi\Famc $famc + * + * @return Indi + */ + public function addFamc($famc = []) + { + $this->famc[] = $famc; + + return $this; + } + + /** + * @return array + */ + public function getFamc() + { + return $this->famc; + } + + /** + * @param Indi\Fams $fams + * + * @return Indi + */ + public function addFams($fams = []) + { + $this->fams[] = $fams; + + return $this; + } + + /** + * @return array + */ + public function getFams() + { + return $this->fams; + } + + /** + * @param string $subm + * + * @return Indi + */ + public function addAnci($subm = '') + { + $this->anci[] = $subm; + + return $this; + } + + /** + * @return string[] + */ + public function getAnci() + { + return $this->anci; + } + + /** + * @param string $subm + * + * @return Indi + */ + public function addDesi($subm = '') + { + $this->desi[] = $subm; + + return $this; + } + + /** + * @return string[] + */ + public function getDesi() + { + return $this->desi; + } + + /** + * @param string $subm + * + * @return Indi + */ + public function addSubm($subm = '') + { + $this->subm[] = $subm; + + return $this; + } + + /** + * @return string[] + */ + public function getSubm() + { + return $this->subm; + } + + /** + * @param string $resn + * + * @return Indi + */ + public function setResn($resn = '') + { + $this->resn = $resn; + + return $this; + } + + /** + * @return string + */ + public function getResn() + { + return $this->resn; + } + + /** + * @param string $sex + * + * @return Indi + */ + public function setSex($sex = '') + { + $this->sex = $sex; + + return $this; + } + + /** + * @return string + */ + public function getSex() + { + return $this->sex; + } + + /** + * @param string $rfn + * + * @return Indi + */ + public function setRfn($rfn = '') + { + $this->rfn = $rfn; + + return $this; + } + + /** + * @return string + */ + public function getRfn() + { + return $this->rfn; + } + + /** + * @param string $afn + * + * @return Indi + */ + public function setAfn($afn = '') + { + $this->afn = $afn; + + return $this; + } + + /** + * @return string + */ + public function getAfn() + { + return $this->afn; + } + + /** + * @param string $chan + * + * @return Indi + */ + public function setChan($chan = null) + { + $this->chan = $chan; + + return $this; + } + + /** + * @return string + */ + public function getChan() + { + return $this->chan; + } + + /** + * @param string $rin + * + * @return Indi + */ + public function setRin($rin = '') + { + $this->rin = $rin; + + return $this; + } + + /** + * @return string + */ + public function getRin() + { + return $this->rin; + } + + /** + * @param Indi\Bapl $bapl + * + * @return Indi + */ + public function setBapl($bapl = []) + { + $this->bapl = $bapl; + + return $this; + } + + /** + * @param Indi\Bapl $bapl + * + * @return Indi + */ + public function addBapl($bapl = null) + { + $this->bapl[] = $bapl; + + return $this; + } + + /** + * @return Indi\Bapl + */ + public function getBapl() + { + return $this->bapl; + } + + /** + * @param Indi\Conl $conl + * + * @return Indi + */ + public function setConl($conl = []) + { + $this->conl = $conl; + + return $this; + } + + /** + * @param Indi\Conl $conl + * + * @return Indi + */ + public function addConl($conl) + { + $this->conl[] = $conl; + + return $this; + } + + /** + * @return Indi\Conl + */ + public function getConl() + { + return $this->conl; + } + + /** + * @param Indi\Endl $endl + * + * @return Indi + */ + public function setEndl($endl = []) + { + $this->endl = $endl; + + return $this; + } + + /** + * @param Indi\Endl $endl + * + * @return Indi + */ + public function addEndl($endl) + { + $this->endl[] = $endl; + + return $this; + } + + /** + * @return Indi\Endl + */ + public function getEndl() + { + return $this->endl; + } + + /** + * @param Indi\Slgc $slgc + * + * @return Indi + */ + public function setSlgc($slgc = []) + { + $this->slgc = $slgc; + + return $this; + } + + /** + * @param Indi\Slgc $slgc + * + * @return Indi + */ + public function addSlgc($slgc) + { + $this->slgc[] = $slgc; + + return $this; + } + + /** + * @return Indi\Slgc + */ + public function getSlgc() + { + return $this->slgc; + } } diff --git a/library/PhpGedcom/Record/Indi/Adop.php b/library/PhpGedcom/Record/Indi/Adop.php index 2fa3f7f1..7fa2d5d6 100644 --- a/library/PhpGedcom/Record/Indi/Adop.php +++ b/library/PhpGedcom/Record/Indi/Adop.php @@ -1,22 +1,19 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Record\Indi; -/** - * - */ class Adop extends \PhpGedcom\Record\Indi\Even { protected $_adop = null; diff --git a/library/PhpGedcom/Record/Indi/Asso.php b/library/PhpGedcom/Record/Indi/Asso.php index ea73c427..4e341ee8 100644 --- a/library/PhpGedcom/Record/Indi/Asso.php +++ b/library/PhpGedcom/Record/Indi/Asso.php @@ -1,51 +1,36 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Record\Indi; -use \PhpGedcom\Record\Sourceable; -use \PhpGedcom\Record\Noteable; +use PhpGedcom\Record\Noteable; +use PhpGedcom\Record\Sourceable; -/** - * - */ class Asso extends \PhpGedcom\Record implements Sourceable, Noteable { protected $_indi = null; protected $_rela = null; - /** - * - */ - protected $_note = array(); + protected $_note = []; - /** - * - */ - protected $_sour = array(); + protected $_sour = []; - /** - * - */ public function addNote($note = []) { $this->_note[] = $note; } - /** - * - */ public function addSour($sour = []) { $this->_sour[] = $sour; diff --git a/library/PhpGedcom/Record/Indi/Attr.php b/library/PhpGedcom/Record/Indi/Attr.php index fa6d2454..f7d18c7c 100644 --- a/library/PhpGedcom/Record/Indi/Attr.php +++ b/library/PhpGedcom/Record/Indi/Attr.php @@ -1,65 +1,44 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Record\Indi; -use \PhpGedcom\Record\Sourceable; -use \PhpGedcom\Record\Noteable; -use \PhpGedcom\Record\Objectable; +use PhpGedcom\Record\Noteable; +use PhpGedcom\Record\Objectable; +use PhpGedcom\Record\Sourceable; -/** - * - */ class Attr extends \PhpGedcom\Record\Indi\Even implements Sourceable, Noteable, Objectable { protected $type = null; protected $_attr = null; - /** - * - */ - protected $sour = array(); + protected $sour = []; - /** - * - */ - protected $note = array(); + protected $note = []; - /** - * - */ - protected $obje = array(); + protected $obje = []; - /** - * - */ public function addSour($sour = []) { $this->sour[] = $sour; } - /** - * - */ public function addNote($note = []) { $this->note[] = $note; } - /** - * - */ public function addObje($obje = []) { $this->obje[] = $obje; diff --git a/library/PhpGedcom/Record/Indi/Bapl.php b/library/PhpGedcom/Record/Indi/Bapl.php index 73e8cb8e..cb0421de 100644 --- a/library/PhpGedcom/Record/Indi/Bapl.php +++ b/library/PhpGedcom/Record/Indi/Bapl.php @@ -1,22 +1,19 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Record\Indi; -/** - * - */ class Bapl extends Lds { } diff --git a/library/PhpGedcom/Record/Indi/Bapm.php b/library/PhpGedcom/Record/Indi/Bapm.php index 2c5c9b55..3c9bc0e9 100644 --- a/library/PhpGedcom/Record/Indi/Bapm.php +++ b/library/PhpGedcom/Record/Indi/Bapm.php @@ -1,22 +1,19 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Record\Indi; -/** - * - */ class Bapm extends \PhpGedcom\Record\Indi\Even { } diff --git a/library/PhpGedcom/Record/Indi/Barm.php b/library/PhpGedcom/Record/Indi/Barm.php index 8230308b..ba0ff3d7 100644 --- a/library/PhpGedcom/Record/Indi/Barm.php +++ b/library/PhpGedcom/Record/Indi/Barm.php @@ -1,22 +1,19 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Record\Indi; -/** - * - */ class Barm extends \PhpGedcom\Record\Indi\Even { } diff --git a/library/PhpGedcom/Record/Indi/Basm.php b/library/PhpGedcom/Record/Indi/Basm.php index ae5013aa..0d89e7ac 100644 --- a/library/PhpGedcom/Record/Indi/Basm.php +++ b/library/PhpGedcom/Record/Indi/Basm.php @@ -1,22 +1,19 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Record\Indi; -/** - * - */ class Basm extends \PhpGedcom\Record\Indi\Even { } diff --git a/library/PhpGedcom/Record/Indi/Birt.php b/library/PhpGedcom/Record/Indi/Birt.php index f5d39066..287f7f50 100644 --- a/library/PhpGedcom/Record/Indi/Birt.php +++ b/library/PhpGedcom/Record/Indi/Birt.php @@ -1,24 +1,21 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Record\Indi; -use PhpGedcom\Record\Indi\Even; - /** - * Class Birt - * @package PhpGedcom\Record\Indi + * Class Birt. */ class Birt extends Even { @@ -29,11 +26,13 @@ class Birt extends Even /** * @param string $famc + * * @return Birt */ public function setFamc($famc = '') { $this->famc = $famc; + return $this; } diff --git a/library/PhpGedcom/Record/Indi/Bles.php b/library/PhpGedcom/Record/Indi/Bles.php index 8c5f0d8d..8ff5c10c 100644 --- a/library/PhpGedcom/Record/Indi/Bles.php +++ b/library/PhpGedcom/Record/Indi/Bles.php @@ -1,22 +1,19 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Record\Indi; -/** - * - */ class Bles extends \PhpGedcom\Record\Indi\Even { } diff --git a/library/PhpGedcom/Record/Indi/Buri.php b/library/PhpGedcom/Record/Indi/Buri.php index 2e5cd27a..ace72a8e 100644 --- a/library/PhpGedcom/Record/Indi/Buri.php +++ b/library/PhpGedcom/Record/Indi/Buri.php @@ -1,22 +1,19 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Record\Indi; -/** - * - */ class Buri extends \PhpGedcom\Record\Indi\Even { } diff --git a/library/PhpGedcom/Record/Indi/Cast.php b/library/PhpGedcom/Record/Indi/Cast.php index acba5e6d..6231be9b 100644 --- a/library/PhpGedcom/Record/Indi/Cast.php +++ b/library/PhpGedcom/Record/Indi/Cast.php @@ -1,22 +1,19 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Record\Indi; -/** - * - */ class Cast extends \PhpGedcom\Record\Indi\Attr { } diff --git a/library/PhpGedcom/Record/Indi/Cens.php b/library/PhpGedcom/Record/Indi/Cens.php index a06cf277..de8c8d27 100644 --- a/library/PhpGedcom/Record/Indi/Cens.php +++ b/library/PhpGedcom/Record/Indi/Cens.php @@ -1,22 +1,19 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Record\Indi; -/** - * - */ class Cens extends \PhpGedcom\Record\Indi\Even { } diff --git a/library/PhpGedcom/Record/Indi/Chr.php b/library/PhpGedcom/Record/Indi/Chr.php index e5479f16..f272eb0d 100644 --- a/library/PhpGedcom/Record/Indi/Chr.php +++ b/library/PhpGedcom/Record/Indi/Chr.php @@ -1,22 +1,19 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Record\Indi; -/** - * - */ class Chr extends \PhpGedcom\Record\Indi\Even { protected $_famc = null; diff --git a/library/PhpGedcom/Record/Indi/Chra.php b/library/PhpGedcom/Record/Indi/Chra.php index 6a788358..1e0f0258 100644 --- a/library/PhpGedcom/Record/Indi/Chra.php +++ b/library/PhpGedcom/Record/Indi/Chra.php @@ -1,22 +1,19 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Record\Indi; -/** - * - */ class Chra extends \PhpGedcom\Record\Indi\Even { } diff --git a/library/PhpGedcom/Record/Indi/Conf.php b/library/PhpGedcom/Record/Indi/Conf.php index c31f125c..e351e043 100644 --- a/library/PhpGedcom/Record/Indi/Conf.php +++ b/library/PhpGedcom/Record/Indi/Conf.php @@ -1,22 +1,19 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Record\Indi; -/** - * - */ class Conf extends \PhpGedcom\Record\Indi\Even { } diff --git a/library/PhpGedcom/Record/Indi/Conl.php b/library/PhpGedcom/Record/Indi/Conl.php index 6810fac4..82b28119 100644 --- a/library/PhpGedcom/Record/Indi/Conl.php +++ b/library/PhpGedcom/Record/Indi/Conl.php @@ -1,22 +1,19 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Record\Indi; -/** - * - */ class Conl extends Lds { } diff --git a/library/PhpGedcom/Record/Indi/Crem.php b/library/PhpGedcom/Record/Indi/Crem.php index ab39dc11..34260e01 100644 --- a/library/PhpGedcom/Record/Indi/Crem.php +++ b/library/PhpGedcom/Record/Indi/Crem.php @@ -1,22 +1,19 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Record\Indi; -/** - * - */ class Crem extends \PhpGedcom\Record\Indi\Even { } diff --git a/library/PhpGedcom/Record/Indi/Deat.php b/library/PhpGedcom/Record/Indi/Deat.php index f7c5de4e..64e5b713 100644 --- a/library/PhpGedcom/Record/Indi/Deat.php +++ b/library/PhpGedcom/Record/Indi/Deat.php @@ -1,22 +1,19 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Record\Indi; -/** - * - */ class Deat extends \PhpGedcom\Record\Indi\Even { } diff --git a/library/PhpGedcom/Record/Indi/Dscr.php b/library/PhpGedcom/Record/Indi/Dscr.php index 7d9bf2d7..5cdad437 100644 --- a/library/PhpGedcom/Record/Indi/Dscr.php +++ b/library/PhpGedcom/Record/Indi/Dscr.php @@ -1,22 +1,19 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Record\Indi; -/** - * - */ class Dscr extends \PhpGedcom\Record\Indi\Attr { } diff --git a/library/PhpGedcom/Record/Indi/Educ.php b/library/PhpGedcom/Record/Indi/Educ.php index b28dc5be..15a943d9 100644 --- a/library/PhpGedcom/Record/Indi/Educ.php +++ b/library/PhpGedcom/Record/Indi/Educ.php @@ -1,22 +1,19 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Record\Indi; -/** - * - */ class Educ extends \PhpGedcom\Record\Indi\Attr { } diff --git a/library/PhpGedcom/Record/Indi/Emig.php b/library/PhpGedcom/Record/Indi/Emig.php index c1ebca48..0472bfc0 100644 --- a/library/PhpGedcom/Record/Indi/Emig.php +++ b/library/PhpGedcom/Record/Indi/Emig.php @@ -1,21 +1,19 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ + namespace PhpGedcom\Record\Indi; -/** - * - */ class Emig extends \PhpGedcom\Record\Indi\Even { } diff --git a/library/PhpGedcom/Record/Indi/Endl.php b/library/PhpGedcom/Record/Indi/Endl.php index 5c3c27b5..6a329f9a 100644 --- a/library/PhpGedcom/Record/Indi/Endl.php +++ b/library/PhpGedcom/Record/Indi/Endl.php @@ -1,22 +1,19 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Record\Indi; -/** - * - */ class Endl extends Lds { } diff --git a/library/PhpGedcom/Record/Indi/Even.php b/library/PhpGedcom/Record/Indi/Even.php index 8b0a4484..f22bd10f 100644 --- a/library/PhpGedcom/Record/Indi/Even.php +++ b/library/PhpGedcom/Record/Indi/Even.php @@ -1,24 +1,23 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Record\Indi; -use \PhpGedcom\Record; +use PhpGedcom\Record; /** - * Class Even - * @package PhpGedcom\Record\Indi + * Class Even. */ class Even extends Record implements Record\Objectable, Record\Sourceable, Record\Noteable { @@ -60,7 +59,7 @@ class Even extends Record implements Record\Objectable, Record\Sourceable, Recor /** * @var array */ - protected $phon = array(); + protected $phon = []; /** * @var string @@ -70,22 +69,22 @@ class Even extends Record implements Record\Objectable, Record\Sourceable, Recor /** * @var array */ - public $ref = array(); + public $ref = []; /** * @var array */ - protected $obje = array(); + protected $obje = []; /** * @var array */ - protected $sour = array(); + protected $sour = []; /** * @var array */ - protected $note = array(); + protected $note = []; /** * @var Record\Chan @@ -102,11 +101,13 @@ public function getPhon() /** * @param Record\Phon $phon + * * @return Even */ public function addPhon($phon = []) { $this->phon[] = $phon; + return $this; } @@ -120,11 +121,13 @@ public function getObje() /** * @param Record\ObjeRef $obje + * * @return Even */ public function addObje($obje = []) { $this->obje[] = $obje; + return $this; } @@ -138,11 +141,13 @@ public function getSour() /** * @param Record\SourRef $sour + * * @return Even */ public function addSour($sour = []) { $this->sour[] = $sour; + return $this; } @@ -156,21 +161,25 @@ public function getNote() /** * @param Record\NoteRef $note + * * @return Even */ public function addNote($note = []) { $this->note[] = $note; + return $this; } /** * @param \PhpGedcom\Record\Addr $addr + * * @return Even */ public function setAddr($addr = []) { $this->addr = $addr; + return $this; } @@ -184,11 +193,13 @@ public function getAddr() /** * @param string $age + * * @return Even */ public function setAge($age = '') { $this->age = $age; + return $this; } @@ -202,11 +213,13 @@ public function getAge() /** * @param string $agnc + * * @return Even */ public function setAgnc($agnc = '') { $this->agnc = $agnc; + return $this; } @@ -220,11 +233,13 @@ public function getAgnc() /** * @param string $caus + * * @return Even */ public function setCaus($caus = '') { $this->caus = $caus; + return $this; } @@ -238,11 +253,13 @@ public function getCaus() /** * @param string $date + * * @return Even */ public function setDate($date = '') { $this->date = $date; + return $this; } @@ -256,11 +273,13 @@ public function getDate() /** * @param \PhpGedcom\Record\Indi\Even\Plac $plac + * * @return Even */ public function setPlac($plac = []) { $this->plac = $plac; + return $this; } @@ -274,11 +293,13 @@ public function getPlac() /** * @param string $type + * * @return Even */ public function setType($type = '') { $this->type = $type; + return $this; } @@ -292,11 +313,13 @@ public function getType() /** * @param array $ref + * * @return Even */ public function setRef($ref = '') { $this->ref = $ref; + return $this; } @@ -318,11 +341,13 @@ public function getChan() /** * @param Record\Chan $chan + * * @return $this */ public function setChan($chan = []) { $this->chan = $chan; + return $this; } } diff --git a/library/PhpGedcom/Record/Indi/Even/Plac.php b/library/PhpGedcom/Record/Indi/Even/Plac.php index e83f037f..df54c4b7 100644 --- a/library/PhpGedcom/Record/Indi/Even/Plac.php +++ b/library/PhpGedcom/Record/Indi/Even/Plac.php @@ -1,24 +1,23 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Record\Indi\Even; -use \PhpGedcom\Record; +use PhpGedcom\Record; /** - * Class Plac - * @package PhpGedcom\Record\Indi\Even + * Class Plac. */ class Plac extends Record implements Record\Noteable, Record\Sourceable { @@ -35,20 +34,22 @@ class Plac extends Record implements Record\Noteable, Record\Sourceable /** * @var array */ - protected $note = array(); + protected $note = []; /** * @var array */ - protected $sour = array(); + protected $sour = []; /** * @param string $form + * * @return Plac */ public function setForm($form = '') { $this->form = $form; + return $this; } @@ -62,11 +63,13 @@ public function getForm() /** * @param string $plac + * * @return Plac */ public function setPlac($plac = '') { $this->plac = $plac; + return $this; } @@ -88,11 +91,13 @@ public function getNote() /** * @param Record\NoteRef $note + * * @return Plac */ public function addNote($note = []) { $this->note[] = $note; + return $this; } @@ -106,11 +111,13 @@ public function getSour() /** * @param Record\SourRef $sour + * * @return Plac */ public function addSour($sour = []) { $this->sour[] = $sour; + return $this; } } diff --git a/library/PhpGedcom/Record/Indi/Famc.php b/library/PhpGedcom/Record/Indi/Famc.php index 6e78c937..f615069e 100644 --- a/library/PhpGedcom/Record/Indi/Famc.php +++ b/library/PhpGedcom/Record/Indi/Famc.php @@ -1,37 +1,28 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Record\Indi; -use \PhpGedcom\Record\Noteable; +use PhpGedcom\Record\Noteable; -/** - * - */ class Famc extends \PhpGedcom\Record implements Noteable { protected $_famc = null; protected $_pedi = null; - /** - * - */ - protected $_note = array(); + protected $_note = []; - /** - * - */ public function addNote($note = []) { $this->_note[] = $note; diff --git a/library/PhpGedcom/Record/Indi/Fams.php b/library/PhpGedcom/Record/Indi/Fams.php index 9a143778..f0a6a0dc 100644 --- a/library/PhpGedcom/Record/Indi/Fams.php +++ b/library/PhpGedcom/Record/Indi/Fams.php @@ -1,39 +1,27 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Record\Indi; -use \PhpGedcom\Record\Noteable; +use PhpGedcom\Record\Noteable; -/** - * - */ class Fams extends \PhpGedcom\Record implements Noteable { - /** - * - */ protected $_fams = null; - /** - * - */ - protected $_note = array(); + protected $_note = []; - /** - * - */ public function addNote($note = []) { $this->_note[] = $note; diff --git a/library/PhpGedcom/Record/Indi/Fcom.php b/library/PhpGedcom/Record/Indi/Fcom.php index a6d9e1d2..81c0f83d 100644 --- a/library/PhpGedcom/Record/Indi/Fcom.php +++ b/library/PhpGedcom/Record/Indi/Fcom.php @@ -1,22 +1,19 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Record\Indi; -/** - * - */ class Fcom extends \PhpGedcom\Record\Indi\Even { } diff --git a/library/PhpGedcom/Record/Indi/Grad.php b/library/PhpGedcom/Record/Indi/Grad.php index f7eaca93..a54ea19c 100644 --- a/library/PhpGedcom/Record/Indi/Grad.php +++ b/library/PhpGedcom/Record/Indi/Grad.php @@ -1,22 +1,19 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Record\Indi; -/** - * - */ class Grad extends \PhpGedcom\Record\Indi\Even { } diff --git a/library/PhpGedcom/Record/Indi/Idno.php b/library/PhpGedcom/Record/Indi/Idno.php index ae464073..c10615de 100644 --- a/library/PhpGedcom/Record/Indi/Idno.php +++ b/library/PhpGedcom/Record/Indi/Idno.php @@ -1,22 +1,19 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Record\Indi; -/** - * - */ class Idno extends \PhpGedcom\Record\Indi\Attr { } diff --git a/library/PhpGedcom/Record/Indi/Immi.php b/library/PhpGedcom/Record/Indi/Immi.php index 7739811c..cad6fd09 100644 --- a/library/PhpGedcom/Record/Indi/Immi.php +++ b/library/PhpGedcom/Record/Indi/Immi.php @@ -1,22 +1,19 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Record\Indi; -/** - * - */ class Immi extends \PhpGedcom\Record\Indi\Even { } diff --git a/library/PhpGedcom/Record/Indi/Lds.php b/library/PhpGedcom/Record/Indi/Lds.php index a1d8c572..03479107 100644 --- a/library/PhpGedcom/Record/Indi/Lds.php +++ b/library/PhpGedcom/Record/Indi/Lds.php @@ -1,25 +1,22 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Record\Indi; -use \PhpGedcom\Record\Sourceable; -use \PhpGedcom\Record\Noteable; +use PhpGedcom\Record\Noteable; +use PhpGedcom\Record\Sourceable; -/** - * - */ abstract class Lds extends \PhpGedcom\Record implements Sourceable, Noteable { protected $_stat; @@ -27,27 +24,15 @@ abstract class Lds extends \PhpGedcom\Record implements Sourceable, Noteable protected $_plac; protected $_temp; - /** - * - */ - protected $_sour = array(); + protected $_sour = []; - /** - * - */ - protected $_note = array(); + protected $_note = []; - /** - * - */ public function addSour($sour = []) { $this->_sour[] = $sour; } - /** - * - */ public function addNote($note = []) { $this->_note[] = $note; diff --git a/library/PhpGedcom/Record/Indi/Name.php b/library/PhpGedcom/Record/Indi/Name.php index 2e6ad000..dfeec6de 100644 --- a/library/PhpGedcom/Record/Indi/Name.php +++ b/library/PhpGedcom/Record/Indi/Name.php @@ -1,14 +1,14 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ @@ -23,38 +23,30 @@ * @method string getSurn() * @method string getNsfx() */ -class Name extends \PhpGedcom\Record implements \PhpGedcom\Record\Sourceable { - protected $_name = null; - protected $_npfx = null; - protected $_givn = null; - protected $_nick = null; - protected $_spfx = null; - protected $_surn = null; - protected $_nsfx = null; - protected $_fone = null; // PhpGedcom/ - protected $_romn = null; - protected $_type = null; - /** - * - */ - protected $_note = array(); +class Name extends \PhpGedcom\Record implements \PhpGedcom\Record\Sourceable +{ + protected $_name = null; + protected $_npfx = null; + protected $_givn = null; + protected $_nick = null; + protected $_spfx = null; + protected $_surn = null; + protected $_nsfx = null; + protected $_fone = null; // PhpGedcom/ + protected $_romn = null; + protected $_type = null; + + protected $_note = []; - /** - * - */ - protected $_sour = array(); + protected $_sour = []; - /** - * - */ - public function addSour($sour = []) { - $this->_sour[] = $sour; - } + public function addSour($sour = []) + { + $this->_sour[] = $sour; + } - /** - * - */ - public function addNote($note = []) { - $this->_note[] = $note; - } + public function addNote($note = []) + { + $this->_note[] = $note; + } } diff --git a/library/PhpGedcom/Record/Indi/Name/Fone.php b/library/PhpGedcom/Record/Indi/Name/Fone.php index 11cba359..53916383 100644 --- a/library/PhpGedcom/Record/Indi/Name/Fone.php +++ b/library/PhpGedcom/Record/Indi/Name/Fone.php @@ -1,14 +1,14 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ @@ -17,8 +17,7 @@ use PhpGedcom\Record; /** - * Class Refn - * @package PhpGedcom\Record + * Class Refn. */ class Fone extends Record { @@ -32,51 +31,47 @@ class Fone extends Record */ protected $type; /** - * string name_piece_prefix - */ - protected $_npfx = null; - /** - * string name_piece_given - */ - protected $_givn = null; - /** - * string name_piece_nickname - */ - protected $_nick = null; - /** - * strign name_piece_surname_prefix - */ - protected $_spfx = null; - /** - * string name_piece_surname - */ - protected $_surn = null; - /** - * string name_piece_suffix - */ - protected $_nsfx = null; + * string name_piece_prefix. + */ + protected $_npfx = null; + /** + * string name_piece_given. + */ + protected $_givn = null; + /** + * string name_piece_nickname. + */ + protected $_nick = null; + /** + * strign name_piece_surname_prefix. + */ + protected $_spfx = null; + /** + * string name_piece_surname. + */ + protected $_surn = null; + /** + * string name_piece_suffix. + */ + protected $_nsfx = null; - /** - * PhpGedcom\Record\NoteRef - */ - protected $_note = array(); + /** + * PhpGedcom\Record\NoteRef. + */ + protected $_note = []; - /** - * PhpGedcom\Record\SourRef - */ - protected $_sour = array(); + /** + * PhpGedcom\Record\SourRef. + */ + protected $_sour = []; - /** - * - */ - public function addSour($sour = []) { - $this->_sour[] = $sour; - } + public function addSour($sour = []) + { + $this->_sour[] = $sour; + } - /** - * - */ - public function addNote($note = []) { - $this->_note[] = $note; - } + public function addNote($note = []) + { + $this->_note[] = $note; + } } diff --git a/library/PhpGedcom/Record/Indi/Name/Romn.php b/library/PhpGedcom/Record/Indi/Name/Romn.php index dfa1f39c..0e079b6b 100644 --- a/library/PhpGedcom/Record/Indi/Name/Romn.php +++ b/library/PhpGedcom/Record/Indi/Name/Romn.php @@ -1,14 +1,14 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ @@ -17,8 +17,7 @@ use PhpGedcom\Record; /** - * Class Refn - * @package PhpGedcom\Record + * Class Refn. */ class Romn extends Record { @@ -31,52 +30,48 @@ class Romn extends Record * @var string romanized_type */ protected $type; - /** - * string name_piece_prefix - */ - protected $_npfx = null; - /** - * string name_piece_given - */ - protected $_givn = null; - /** - * string name_piece_nickname - */ - protected $_nick = null; - /** - * strign name_piece_surname_prefix - */ - protected $_spfx = null; - /** - * string name_piece_surname - */ - protected $_surn = null; - /** - * string name_piece_suffix - */ - protected $_nsfx = null; + /** + * string name_piece_prefix. + */ + protected $_npfx = null; + /** + * string name_piece_given. + */ + protected $_givn = null; + /** + * string name_piece_nickname. + */ + protected $_nick = null; + /** + * strign name_piece_surname_prefix. + */ + protected $_spfx = null; + /** + * string name_piece_surname. + */ + protected $_surn = null; + /** + * string name_piece_suffix. + */ + protected $_nsfx = null; - /** - * PhpGedcom\Record\NoteRef - */ - protected $_note = array(); + /** + * PhpGedcom\Record\NoteRef. + */ + protected $_note = []; - /** - * PhpGedcom\Record\SourRef - */ - protected $_sour = array(); + /** + * PhpGedcom\Record\SourRef. + */ + protected $_sour = []; - /** - * - */ - public function addSour($sour = []) { - $this->_sour[] = $sour; - } + public function addSour($sour = []) + { + $this->_sour[] = $sour; + } - /** - * - */ - public function addNote($note = []) { - $this->_note[] = $note; - } + public function addNote($note = []) + { + $this->_note[] = $note; + } } diff --git a/library/PhpGedcom/Record/Indi/Nati.php b/library/PhpGedcom/Record/Indi/Nati.php index 6df07bb4..77bd569f 100644 --- a/library/PhpGedcom/Record/Indi/Nati.php +++ b/library/PhpGedcom/Record/Indi/Nati.php @@ -1,22 +1,19 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Record\Indi; -/** - * - */ class Nati extends \PhpGedcom\Record\Indi\Attr { } diff --git a/library/PhpGedcom/Record/Indi/Natu.php b/library/PhpGedcom/Record/Indi/Natu.php index 60a9e436..abb8e5dc 100644 --- a/library/PhpGedcom/Record/Indi/Natu.php +++ b/library/PhpGedcom/Record/Indi/Natu.php @@ -1,22 +1,19 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Record\Indi; -/** - * - */ class Natu extends \PhpGedcom\Record\Indi\Even { } diff --git a/library/PhpGedcom/Record/Indi/Nchi.php b/library/PhpGedcom/Record/Indi/Nchi.php index 8718d684..94d7f0ee 100644 --- a/library/PhpGedcom/Record/Indi/Nchi.php +++ b/library/PhpGedcom/Record/Indi/Nchi.php @@ -1,22 +1,19 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Record\Indi; -/** - * - */ class Nchi extends \PhpGedcom\Record\Indi\Attr { } diff --git a/library/PhpGedcom/Record/Indi/Nmr.php b/library/PhpGedcom/Record/Indi/Nmr.php index 38492b7b..bdb801f4 100644 --- a/library/PhpGedcom/Record/Indi/Nmr.php +++ b/library/PhpGedcom/Record/Indi/Nmr.php @@ -1,22 +1,19 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Record\Indi; -/** - * - */ class Nmr extends \PhpGedcom\Record\Indi\Attr { } diff --git a/library/PhpGedcom/Record/Indi/Note.php b/library/PhpGedcom/Record/Indi/Note.php index 3811fb93..5b426ac5 100644 --- a/library/PhpGedcom/Record/Indi/Note.php +++ b/library/PhpGedcom/Record/Indi/Note.php @@ -1,16 +1,17 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ + namespace PhpGedcom\Record\Indi; class Note extends \PhpGedcom\Record\NoteRefAbstract diff --git a/library/PhpGedcom/Record/Indi/Occu.php b/library/PhpGedcom/Record/Indi/Occu.php index 5e73980e..b21b6376 100644 --- a/library/PhpGedcom/Record/Indi/Occu.php +++ b/library/PhpGedcom/Record/Indi/Occu.php @@ -1,22 +1,19 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Record\Indi; -/** - * - */ class Occu extends \PhpGedcom\Record\Indi\Attr { } diff --git a/library/PhpGedcom/Record/Indi/Ordn.php b/library/PhpGedcom/Record/Indi/Ordn.php index 0f5c6abe..8aa39890 100644 --- a/library/PhpGedcom/Record/Indi/Ordn.php +++ b/library/PhpGedcom/Record/Indi/Ordn.php @@ -1,22 +1,19 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Record\Indi; -/** - * - */ class Ordn extends \PhpGedcom\Record\Indi\Even { } diff --git a/library/PhpGedcom/Record/Indi/Prob.php b/library/PhpGedcom/Record/Indi/Prob.php index 16c481d7..0236f8f4 100644 --- a/library/PhpGedcom/Record/Indi/Prob.php +++ b/library/PhpGedcom/Record/Indi/Prob.php @@ -1,22 +1,19 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Record\Indi; -/** - * - */ class Prob extends \PhpGedcom\Record\Indi\Even { } diff --git a/library/PhpGedcom/Record/Indi/Prop.php b/library/PhpGedcom/Record/Indi/Prop.php index a4bfb763..99099eb1 100644 --- a/library/PhpGedcom/Record/Indi/Prop.php +++ b/library/PhpGedcom/Record/Indi/Prop.php @@ -1,22 +1,19 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Record\Indi; -/** - * - */ class Prop extends \PhpGedcom\Record\Indi\Attr { } diff --git a/library/PhpGedcom/Record/Indi/Reli.php b/library/PhpGedcom/Record/Indi/Reli.php index 8aaed6db..26b4aee7 100644 --- a/library/PhpGedcom/Record/Indi/Reli.php +++ b/library/PhpGedcom/Record/Indi/Reli.php @@ -1,22 +1,19 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Record\Indi; -/** - * - */ class Reli extends \PhpGedcom\Record\Indi\Attr { } diff --git a/library/PhpGedcom/Record/Indi/Resi.php b/library/PhpGedcom/Record/Indi/Resi.php index 9fdfbb3b..e39692d5 100644 --- a/library/PhpGedcom/Record/Indi/Resi.php +++ b/library/PhpGedcom/Record/Indi/Resi.php @@ -1,22 +1,19 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Record\Indi; -/** - * - */ class Resi extends \PhpGedcom\Record\Indi\Attr { } diff --git a/library/PhpGedcom/Record/Indi/Reti.php b/library/PhpGedcom/Record/Indi/Reti.php index 91a22147..99fd4d13 100644 --- a/library/PhpGedcom/Record/Indi/Reti.php +++ b/library/PhpGedcom/Record/Indi/Reti.php @@ -1,22 +1,19 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Record\Indi; -/** - * - */ class Reti extends \PhpGedcom\Record\Indi\Even { } diff --git a/library/PhpGedcom/Record/Indi/Slgc.php b/library/PhpGedcom/Record/Indi/Slgc.php index 2e28107f..467346fb 100644 --- a/library/PhpGedcom/Record/Indi/Slgc.php +++ b/library/PhpGedcom/Record/Indi/Slgc.php @@ -1,26 +1,20 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Record\Indi; -/** - * - */ class Slgc extends Lds { - /** - * - */ protected $_famc = null; } diff --git a/library/PhpGedcom/Record/Indi/Ssn.php b/library/PhpGedcom/Record/Indi/Ssn.php index 475f61b6..fa0c8351 100644 --- a/library/PhpGedcom/Record/Indi/Ssn.php +++ b/library/PhpGedcom/Record/Indi/Ssn.php @@ -1,22 +1,19 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Record\Indi; -/** - * - */ class Ssn extends \PhpGedcom\Record\Indi\Attr { } diff --git a/library/PhpGedcom/Record/Indi/Titl.php b/library/PhpGedcom/Record/Indi/Titl.php index e9f94f85..9ce05b07 100644 --- a/library/PhpGedcom/Record/Indi/Titl.php +++ b/library/PhpGedcom/Record/Indi/Titl.php @@ -1,21 +1,19 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ + namespace PhpGedcom\Record\Indi; -/** - * - */ class Titl extends \PhpGedcom\Record\Indi\Attr { } diff --git a/library/PhpGedcom/Record/Indi/Will.php b/library/PhpGedcom/Record/Indi/Will.php index 7c795bbc..fc8f7bbd 100644 --- a/library/PhpGedcom/Record/Indi/Will.php +++ b/library/PhpGedcom/Record/Indi/Will.php @@ -1,22 +1,19 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Record\Indi; -/** - * - */ class Will extends \PhpGedcom\Record\Indi\Even { } diff --git a/library/PhpGedcom/Record/Note.php b/library/PhpGedcom/Record/Note.php index 46b2de93..26df6ea0 100644 --- a/library/PhpGedcom/Record/Note.php +++ b/library/PhpGedcom/Record/Note.php @@ -1,49 +1,36 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Record; -/** - * - * - */ class Note extends \PhpGedcom\Record implements Sourceable { - protected $_id = null; + protected $_id = null; protected $_note = null; protected $_even = null; - protected $_refn = array(); - protected $_rin = null; + protected $_refn = []; + protected $_rin = null; - /** - * - */ - protected $_sour = array(); + protected $_sour = []; protected $_chan = null; - /** - * - */ public function addRefn($refn = []) { $this->_refn[] = $refn; } - /** - * - */ public function addSour($sour = []) { $this->_sour[] = $sour; diff --git a/library/PhpGedcom/Record/NoteRef.php b/library/PhpGedcom/Record/NoteRef.php index 26f61bc6..caf2f9e7 100644 --- a/library/PhpGedcom/Record/NoteRef.php +++ b/library/PhpGedcom/Record/NoteRef.php @@ -1,60 +1,37 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Record; -use \PhpGedcom\Record\Sourceable; - -/** - * - */ class NoteRef extends \PhpGedcom\Record implements Sourceable { - /** - * - */ - protected $_isRef = false; + protected $_isRef = false; - /** - * - */ - protected $_note = ''; + protected $_note = ''; - /** - * - */ - protected $_sour = array(); + protected $_sour = []; - /** - * - */ public function setIsReference($isReference = true) { $this->_isRef = $isReference; } - /** - * - */ public function getIsReference() { return $this->_isRef; } - /** - * - */ public function addSour($sour = []) { $this->_sour[] = $sour; diff --git a/library/PhpGedcom/Record/Noteable.php b/library/PhpGedcom/Record/Noteable.php index 1244e55e..acc21f9a 100644 --- a/library/PhpGedcom/Record/Noteable.php +++ b/library/PhpGedcom/Record/Noteable.php @@ -1,26 +1,20 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Record; -/** - * - */ interface Noteable { - /** - * - */ public function addNote($note = []); } diff --git a/library/PhpGedcom/Record/Obje.php b/library/PhpGedcom/Record/Obje.php index 8417771d..196764df 100644 --- a/library/PhpGedcom/Record/Obje.php +++ b/library/PhpGedcom/Record/Obje.php @@ -1,67 +1,50 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Record; -/** - * - */ class Obje extends \PhpGedcom\Record implements Noteable { - protected $_id = null; + protected $_id = null; - protected $_file = array(); - protected $_rin = null; + protected $_file = []; + protected $_rin = null; protected $_chan = null; - protected $_refn = array(); + protected $_refn = []; - /** - * - */ - protected $_note = array(); + protected $_note = []; - protected $_sour = array(); + protected $_sour = []; - /** - * - */ public function addRefn($refn = []) { $this->_refn[] = $refn; } - /** - * - */ public function addNote($note = []) { $this->_note[] = $note; } - /** - * - */ + public function addFile($file) { $this->_file[] = $file; } - /** - * - */ public function addSour($sour) { $this->_sour[] = $sour; - } + } } diff --git a/library/PhpGedcom/Record/ObjeRef.php b/library/PhpGedcom/Record/ObjeRef.php index 3c19a3db..859bacf4 100644 --- a/library/PhpGedcom/Record/ObjeRef.php +++ b/library/PhpGedcom/Record/ObjeRef.php @@ -1,56 +1,34 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Record; -/** - * - */ class ObjeRef extends \PhpGedcom\Record { - /** - * - */ - protected $_isRef = false; - - /** - * - */ - protected $_obje = null; + protected $_isRef = false; - /** - * - */ - protected $_titl = null; + protected $_obje = null; - /** - * - */ - protected $_file = null; + protected $_titl = null; + protected $_file = null; - /** - * - */ public function setIsReference($isReference = true) { $this->_isRef = $isReference; } - /** - * - */ public function getIsReference() { return $this->_isRef; diff --git a/library/PhpGedcom/Record/ObjeRef/File.php b/library/PhpGedcom/Record/ObjeRef/File.php index 59d71405..0a4dcfbc 100644 --- a/library/PhpGedcom/Record/ObjeRef/File.php +++ b/library/PhpGedcom/Record/ObjeRef/File.php @@ -1,14 +1,14 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ @@ -17,8 +17,7 @@ use PhpGedcom\Record; /** - * Class Refn - * @package PhpGedcom\Record + * Class Refn. */ class File extends Record { @@ -32,5 +31,4 @@ class File extends Record */ protected $_form; protected $_titl; - } diff --git a/library/PhpGedcom/Record/ObjeRef/File/Form.php b/library/PhpGedcom/Record/ObjeRef/File/Form.php index 1b2710d3..6671e0c4 100644 --- a/library/PhpGedcom/Record/ObjeRef/File/Form.php +++ b/library/PhpGedcom/Record/ObjeRef/File/Form.php @@ -1,14 +1,14 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ @@ -17,8 +17,7 @@ use PhpGedcom\Record; /** - * Class Refn - * @package PhpGedcom\Record + * Class Refn. */ class Form extends Record { @@ -29,13 +28,13 @@ class Form extends Record /** * @var string source_media_type - * for only obje + * for only obje */ protected $type; /** * @var string source_media_type - * for only objeref + * for only objeref */ protected $medi; } diff --git a/library/PhpGedcom/Record/Objectable.php b/library/PhpGedcom/Record/Objectable.php index 894eb32c..05390358 100644 --- a/library/PhpGedcom/Record/Objectable.php +++ b/library/PhpGedcom/Record/Objectable.php @@ -1,26 +1,20 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Record; -/** - * - */ interface Objectable { - /** - * - */ public function addObje($obje = []); } diff --git a/library/PhpGedcom/Record/Phon.php b/library/PhpGedcom/Record/Phon.php index 4c29a528..2079adda 100644 --- a/library/PhpGedcom/Record/Phon.php +++ b/library/PhpGedcom/Record/Phon.php @@ -1,14 +1,14 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ @@ -17,8 +17,7 @@ use PhpGedcom\Record; /** - * Class Phon - * @package PhpGedcom\Record + * Class Phon. */ class Phon extends Record { @@ -29,11 +28,13 @@ class Phon extends Record /** * @param $phon + * * @return Phon */ public function setPhon($phon = []) { $this->phon = $phon; + return $this; } diff --git a/library/PhpGedcom/Record/Plac.php b/library/PhpGedcom/Record/Plac.php index 80da6c40..5c7e2085 100644 --- a/library/PhpGedcom/Record/Plac.php +++ b/library/PhpGedcom/Record/Plac.php @@ -1,55 +1,55 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Record; -use \PhpGedcom\Record\Noteable; -/** - * - */ + class Plac extends \PhpGedcom\Record implements Noteable { /** - * string plac + * string plac. */ protected $_plac = null; /** - * string place_hierarchy + * string place_hierarchy. */ protected $_form = null; /** - * array PhpGedcom\Record\Plac\Fone + * array PhpGedcom\Record\Plac\Fone. */ protected $_fone = null; /** - * array PhpGedcom\Record\Plac\Romn + * array PhpGedcom\Record\Plac\Romn. */ protected $_romn = null; /** - * PhpGedcom\Record\Plac\Map + * PhpGedcom\Record\Plac\Map. */ protected $_map = null; /** - * array PhpGedcom\Record\NoteRef + * array PhpGedcom\Record\NoteRef. */ - protected $_note= null; + protected $_note = null; /** - * @param PhpGedcom\Record\NoteRef $note - * @return Plac - */ - public function addNote($note = null) { - $this->_note[] = $note; - return $this; - } + * @param PhpGedcom\Record\NoteRef $note + * + * @return Plac + */ + public function addNote($note = null) + { + $this->_note[] = $note; + + return $this; + } } diff --git a/library/PhpGedcom/Record/Plac/Fone.php b/library/PhpGedcom/Record/Plac/Fone.php index 309e4d18..cdd0eb09 100644 --- a/library/PhpGedcom/Record/Plac/Fone.php +++ b/library/PhpGedcom/Record/Plac/Fone.php @@ -1,14 +1,14 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ @@ -17,8 +17,7 @@ use PhpGedcom\Record; /** - * Class Refn - * @package PhpGedcom\Record + * Class Refn. */ class Fone extends Record { diff --git a/library/PhpGedcom/Record/Plac/Map.php b/library/PhpGedcom/Record/Plac/Map.php index b322f9f1..2a22a341 100644 --- a/library/PhpGedcom/Record/Plac/Map.php +++ b/library/PhpGedcom/Record/Plac/Map.php @@ -1,14 +1,14 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ @@ -17,8 +17,7 @@ use PhpGedcom\Record; /** - * Class Refn - * @package PhpGedcom\Record + * Class Refn. */ class Map extends Record { diff --git a/library/PhpGedcom/Record/Plac/Romn.php b/library/PhpGedcom/Record/Plac/Romn.php index 9f0e6b82..d49fbbee 100644 --- a/library/PhpGedcom/Record/Plac/Romn.php +++ b/library/PhpGedcom/Record/Plac/Romn.php @@ -1,14 +1,14 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ @@ -17,8 +17,7 @@ use PhpGedcom\Record; /** - * Class Refn - * @package PhpGedcom\Record + * Class Refn. */ class Romn extends Record { diff --git a/library/PhpGedcom/Record/Refn.php b/library/PhpGedcom/Record/Refn.php index 0df6d4c6..b25ea352 100644 --- a/library/PhpGedcom/Record/Refn.php +++ b/library/PhpGedcom/Record/Refn.php @@ -1,14 +1,14 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ @@ -17,8 +17,7 @@ use PhpGedcom\Record; /** - * Class Refn - * @package PhpGedcom\Record + * Class Refn. */ class Refn extends Record { @@ -34,11 +33,13 @@ class Refn extends Record /** * @param string $refn + * * @return Refn */ public function setRefn($refn = '') { $this->refn = $refn; + return $this; } @@ -52,11 +53,13 @@ public function getRefn() /** * @param string $type + * * @return Refn */ public function setType($type = '') { $this->type = $type; + return $this; } diff --git a/library/PhpGedcom/Record/Repo.php b/library/PhpGedcom/Record/Repo.php index 9bd04fd5..68b3aa0b 100644 --- a/library/PhpGedcom/Record/Repo.php +++ b/library/PhpGedcom/Record/Repo.php @@ -1,14 +1,14 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ @@ -17,244 +17,287 @@ use PhpGedcom\Record; /** - * Class Repo - * @package PhpGedcom\Record + * Class Repo. */ -class Repo extends Record implements Noteable { - /** - * @var string - */ - protected $repo; - - /** - * @var string - */ - protected $name; - - /** - * @var Addr - */ - protected $addr; - - /** - * @var array - */ - protected $phon = array(); - /** - * @var array - */ - protected $email = array(); - /** - * @var array - */ - protected $fax = array(); - /** - * @var array - */ - protected $www = array(); - /** - * @var string - */ - protected $rin; - - /** - * @var Chan - */ - protected $chan; - - - - /** - * @var array - */ - protected $refn = array(); - - /** - * @var array - */ - protected $note = array(); - - /** - * @param null - * @return Repo - */ - public function addPhon($phon = null) { - $this->phon[] = $phon; - return $this; - } - - /** - * @return array - */ - public function getPhon() { - return $this->phon; - } - - /** - * @param null - * @return Repo - */ - public function addEmail($email = null) { - $this->email[] = $email; - return $this; - } - - /** - * @return array - */ - public function getEmail() { - return $this->email; - } - - /** - * @param null - * @return Repo - */ - public function addFax($fax = null) { - $this->fax[] = $fax; - return $this; - } - - /** - * @return array - */ - public function getFax() { - return $this->fax; - } - /** - * @param null - * @return Repo - */ - public function addWww($www = null) { - $this->www[] = $www; - return $this; - } - - /** - * @return array - */ - public function getWww() { - return $this->www; - } - - /** - * @param null|\PhpGedcom\Record\Refn $refn - * @return Repo - */ - public function addRefn($refn = null) { - if (empty($refn)) { - $refn = new \PhpGedcom\Record\Refn(); - } - $this->refn[] = $refn; - return $this; - } - - /** - * @return array - */ - public function getRefn() { - return $this->refn; - } - - /** - * @param null|\PhpGedcom\Record\NoteRef $note - * @return Repo - */ - public function addNote($note = null) { - if (empty($node)) { - $note = new \PhpGedcom\Record\NoteRef(); - } - $this->note[] = $note; - return $this; - } - - /** - * @return array - */ - public function getNote() { - return $this->note; - } - - /** - * @param string $repo - * @return Repo - */ - public function setRepo($repo = '') { - $this->repo = $repo; - return $this; - } - - /** - * @return string - */ - public function getRepo() { - return $this->repo; - } - - /** - * @param string $name - * @return Repo - */ - public function setName($name = '') { - $this->name = $name; - return $this; - } - - /** - * @return string - */ - public function getName() { - return $this->name; - } - - /** - * @param null|\PhpGedcom\Record\Addr $addr - * @return Repo - */ - public function setAddr($addr = null) { - if (empty($addr)) { - $addr = new \PhpGedcom\Record\Addr(); - } - $this->addr = $addr; - return $this; - } - - /** - * @return \PhpGedcom\Record\Addr - */ - public function getAddr() { - return $this->addr; - } - - /** - * @param string $rin - * @return Repo - */ - public function setRin($rin = '') { - $this->rin = $rin; - return $this; - } - - /** - * @return string - */ - public function getRin() { - return $this->rin; - } - - /** - * @param \PhpGedcom\Record\Chan $chan - * @return Repo - */ - public function setChan($chan = []) { - $this->chan = $chan; - return $this; - } - - /** - * @return \PhpGedcom\Record\Chan - */ - public function getChan() { - return $this->chan; - } +class Repo extends Record implements Noteable +{ + /** + * @var string + */ + protected $repo; + + /** + * @var string + */ + protected $name; + + /** + * @var Addr + */ + protected $addr; + + /** + * @var array + */ + protected $phon = []; + /** + * @var array + */ + protected $email = []; + /** + * @var array + */ + protected $fax = []; + /** + * @var array + */ + protected $www = []; + /** + * @var string + */ + protected $rin; + + /** + * @var Chan + */ + protected $chan; + + /** + * @var array + */ + protected $refn = []; + + /** + * @var array + */ + protected $note = []; + + /** + * @param null + * + * @return Repo + */ + public function addPhon($phon = null) + { + $this->phon[] = $phon; + + return $this; + } + + /** + * @return array + */ + public function getPhon() + { + return $this->phon; + } + + /** + * @param null + * + * @return Repo + */ + public function addEmail($email = null) + { + $this->email[] = $email; + + return $this; + } + + /** + * @return array + */ + public function getEmail() + { + return $this->email; + } + + /** + * @param null + * + * @return Repo + */ + public function addFax($fax = null) + { + $this->fax[] = $fax; + + return $this; + } + + /** + * @return array + */ + public function getFax() + { + return $this->fax; + } + + /** + * @param null + * + * @return Repo + */ + public function addWww($www = null) + { + $this->www[] = $www; + + return $this; + } + + /** + * @return array + */ + public function getWww() + { + return $this->www; + } + + /** + * @param null|\PhpGedcom\Record\Refn $refn + * + * @return Repo + */ + public function addRefn($refn = null) + { + if (empty($refn)) { + $refn = new \PhpGedcom\Record\Refn(); + } + $this->refn[] = $refn; + + return $this; + } + + /** + * @return array + */ + public function getRefn() + { + return $this->refn; + } + + /** + * @param null|\PhpGedcom\Record\NoteRef $note + * + * @return Repo + */ + public function addNote($note = null) + { + if (empty($node)) { + $note = new \PhpGedcom\Record\NoteRef(); + } + $this->note[] = $note; + + return $this; + } + + /** + * @return array + */ + public function getNote() + { + return $this->note; + } + + /** + * @param string $repo + * + * @return Repo + */ + public function setRepo($repo = '') + { + $this->repo = $repo; + + return $this; + } + + /** + * @return string + */ + public function getRepo() + { + return $this->repo; + } + + /** + * @param string $name + * + * @return Repo + */ + public function setName($name = '') + { + $this->name = $name; + + return $this; + } + + /** + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * @param null|\PhpGedcom\Record\Addr $addr + * + * @return Repo + */ + public function setAddr($addr = null) + { + if (empty($addr)) { + $addr = new \PhpGedcom\Record\Addr(); + } + $this->addr = $addr; + + return $this; + } + + /** + * @return \PhpGedcom\Record\Addr + */ + public function getAddr() + { + return $this->addr; + } + + /** + * @param string $rin + * + * @return Repo + */ + public function setRin($rin = '') + { + $this->rin = $rin; + + return $this; + } + + /** + * @return string + */ + public function getRin() + { + return $this->rin; + } + + /** + * @param \PhpGedcom\Record\Chan $chan + * + * @return Repo + */ + public function setChan($chan = []) + { + $this->chan = $chan; + + return $this; + } + + /** + * @return \PhpGedcom\Record\Chan + */ + public function getChan() + { + return $this->chan; + } } diff --git a/library/PhpGedcom/Record/RepoRef.php b/library/PhpGedcom/Record/RepoRef.php index 53172aa9..4bdf1d15 100644 --- a/library/PhpGedcom/Record/RepoRef.php +++ b/library/PhpGedcom/Record/RepoRef.php @@ -1,36 +1,27 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Record; -/** - * - */ class RepoRef extends \PhpGedcom\Record implements Noteable { protected $_repo = null; - protected $_caln = array(); + protected $_caln = []; - /** - * - */ - protected $_note = array(); + protected $_note = []; - /** - * - */ public function addNote($note = []) { $this->_note[] = $note; diff --git a/library/PhpGedcom/Record/Sour.php b/library/PhpGedcom/Record/Sour.php index f1dfa271..0a9df348 100644 --- a/library/PhpGedcom/Record/Sour.php +++ b/library/PhpGedcom/Record/Sour.php @@ -1,14 +1,14 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ @@ -17,8 +17,7 @@ use PhpGedcom\Record; /** - * Class Sour - * @package PhpGedcom\Record + * Class Sour. */ class Sour extends Record implements Noteable, Objectable { @@ -65,7 +64,7 @@ class Sour extends Record implements Noteable, Objectable /** * @var array */ - protected $refn = array(); + protected $refn = []; /** * @var string @@ -80,20 +79,22 @@ class Sour extends Record implements Noteable, Objectable /** * @var array */ - protected $note = array(); + protected $note = []; /** * @var array */ - protected $obje = array(); + protected $obje = []; /** * @param string $sour + * * @return Sour */ public function setSour($sour = '') { $this->sour = $sour; + return $this; } @@ -107,11 +108,13 @@ public function getSour() /** * @param string $titl + * * @return Sour */ public function setTitl($titl = '') { $this->titl = $titl; + return $this; } @@ -125,11 +128,13 @@ public function getTitl() /** * @param string $abbr + * * @return Sour */ public function setAbbr($abbr = '') { $this->abbr = $abbr; + return $this; } @@ -143,11 +148,13 @@ public function getAbbr() /** * @param string $auth + * * @return Sour */ public function setAuth($auth = '') { $this->auth = $auth; + return $this; } @@ -161,11 +168,13 @@ public function getAuth() /** * @param string $publ + * * @return Sour */ public function setPubl($publ = '') { $this->publ = $publ; + return $this; } @@ -179,11 +188,13 @@ public function getPubl() /** * @param \PhpGedcom\Record\Repo $repo + * * @return Sour */ public function setRepo($repo) { $this->repo = $repo; + return $this; } @@ -197,11 +208,13 @@ public function getRepo() /** * @param string $text + * * @return Sour */ public function setText($text = '') { $this->text = $text; + return $this; } @@ -215,11 +228,13 @@ public function getText() /** * @param string $data + * * @return Sour */ public function setData($data = '') { $this->data = $data; + return $this; } @@ -233,11 +248,13 @@ public function getData() /** * @param string $rin + * * @return Sour */ public function setRin($rin = '') { $this->rin = $rin; + return $this; } @@ -251,11 +268,13 @@ public function getRin() /** * @param \PhpGedcom\Record\Chan $chan + * * @return Sour */ public function setChan($chan = []) { $this->chan = $chan; + return $this; } @@ -269,11 +288,13 @@ public function getChan() /** * @param Refn $refn + * * @return Sour */ public function addRefn($refn = []) { $this->refn[] = $refn; + return $this; } @@ -287,11 +308,13 @@ public function getRefn() /** * @param NoteRef $note + * * @return Sour */ public function addNote($note = []) { $this->note[] = $note; + return $this; } @@ -305,11 +328,13 @@ public function getNote() /** * @param ObjeRef $obje + * * @return Sour */ public function addObje($obje = []) { $this->obje[] = $obje; + return $this; } diff --git a/library/PhpGedcom/Record/Sour/Data.php b/library/PhpGedcom/Record/Sour/Data.php index 2d960be6..9c9fdceb 100644 --- a/library/PhpGedcom/Record/Sour/Data.php +++ b/library/PhpGedcom/Record/Sour/Data.php @@ -1,40 +1,31 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Record\Sour; -use \PhpGedcom\Record\Noteable; +use PhpGedcom\Record\Noteable; -/** - * - */ class Data extends \PhpGedcom\Record implements Noteable { - protected $_even = array(); + protected $_even = []; protected $_agnc = null; protected $_date = null; protected $_text = null; - /** - * - */ - protected $_note = array(); + protected $_note = []; - /** - * - */ public function addNote($note = []) { $this->_note[] = $note; diff --git a/library/PhpGedcom/Record/Sour/Data/Even.php b/library/PhpGedcom/Record/Sour/Data/Even.php index 2601b552..9857ce1e 100644 --- a/library/PhpGedcom/Record/Sour/Data/Even.php +++ b/library/PhpGedcom/Record/Sour/Data/Even.php @@ -1,22 +1,19 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Record\Sour\Data; -/** - * - */ class Even extends \PhpGedcom\Record { protected $_date = null; diff --git a/library/PhpGedcom/Record/Sour/Repo.php b/library/PhpGedcom/Record/Sour/Repo.php index fa15bb57..af7d01dc 100644 --- a/library/PhpGedcom/Record/Sour/Repo.php +++ b/library/PhpGedcom/Record/Sour/Repo.php @@ -1,49 +1,41 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Record\Sour; -use \PhpGedcom\Record\Noteable; +use PhpGedcom\Record\Noteable; -/** - * - */ class Repo extends \PhpGedcom\Record implements Noteable { protected $_repo = null; /** - * array PhpGedcom\Record\Sour\Repo\Caln - */ - protected $_caln = array(); - - /** - * array PhpGedcom\Record\NoteRef + * array PhpGedcom\Record\Sour\Repo\Caln. */ - protected $_note = array(); + protected $_caln = []; /** - * + * array PhpGedcom\Record\NoteRef. */ + protected $_note = []; + public function addNote($note = []) { $this->_note[] = $note; } - /** - * - */ - public function addCaln($caln=[]){ + public function addCaln($caln = []) + { $this->_caln[] = $caln; } } diff --git a/library/PhpGedcom/Record/Sour/Repo/Caln.php b/library/PhpGedcom/Record/Sour/Repo/Caln.php index 0f0bf547..7fbbe437 100644 --- a/library/PhpGedcom/Record/Sour/Repo/Caln.php +++ b/library/PhpGedcom/Record/Sour/Repo/Caln.php @@ -1,30 +1,27 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Record\Sour\Repo; -/** - * - */ class Caln extends \PhpGedcom\Record { /** - * string source_call_number + * string source_call_number. */ protected $_caln = null; /** - * string source_media_type + * string source_media_type. */ protected $_medi = null; } diff --git a/library/PhpGedcom/Record/SourRef.php b/library/PhpGedcom/Record/SourRef.php index 319155b9..2cdbe43f 100644 --- a/library/PhpGedcom/Record/SourRef.php +++ b/library/PhpGedcom/Record/SourRef.php @@ -1,33 +1,30 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Record; -/** - * - */ class SourRef extends \PhpGedcom\Record { - protected $_isRef = false; - - protected $_sour = null; - protected $_page = null; - protected $_even = null; - protected $_data = null; - protected $_quay = null; - protected $_text = null; - - protected $_obje = array(); - protected $_note = array(); + protected $_isRef = false; + + protected $_sour = null; + protected $_page = null; + protected $_even = null; + protected $_data = null; + protected $_quay = null; + protected $_text = null; + + protected $_obje = []; + protected $_note = []; } diff --git a/library/PhpGedcom/Record/SourRef/Data.php b/library/PhpGedcom/Record/SourRef/Data.php index 9757f079..51dc0c9b 100644 --- a/library/PhpGedcom/Record/SourRef/Data.php +++ b/library/PhpGedcom/Record/SourRef/Data.php @@ -1,30 +1,27 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Record\SourRef; -/** - * - */ class Data extends \PhpGedcom\Record { /** - * string entry_recording_date + * string entry_recording_date. */ - protected $_date = null; + protected $_date = null; /** - * string text_from_source + * string text_from_source. */ - protected $_text = null; + protected $_text = null; } diff --git a/library/PhpGedcom/Record/SourRef/Even.php b/library/PhpGedcom/Record/SourRef/Even.php index 5d2c1a58..ddf9ac3f 100644 --- a/library/PhpGedcom/Record/SourRef/Even.php +++ b/library/PhpGedcom/Record/SourRef/Even.php @@ -1,24 +1,21 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Record\SourRef; -/** - * - */ class Even extends \PhpGedcom\Record { - protected $_even = null; - protected $_role = null; + protected $_even = null; + protected $_role = null; } diff --git a/library/PhpGedcom/Record/Sourceable.php b/library/PhpGedcom/Record/Sourceable.php index 3485cd6b..d130db16 100644 --- a/library/PhpGedcom/Record/Sourceable.php +++ b/library/PhpGedcom/Record/Sourceable.php @@ -1,26 +1,20 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Record; -/** - * - */ interface Sourceable { - /** - * - */ public function addSour($sour = []); } diff --git a/library/PhpGedcom/Record/Subm.php b/library/PhpGedcom/Record/Subm.php index 8721be7e..beeafe5e 100644 --- a/library/PhpGedcom/Record/Subm.php +++ b/library/PhpGedcom/Record/Subm.php @@ -1,14 +1,14 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ @@ -17,293 +17,344 @@ use PhpGedcom\Record; /** - * Class Subm - * @package PhpGedcom\Record + * Class Subm. */ -class Subm extends Record implements Objectable { - /** - * @var string - */ - protected $subm; - - /** - * @var Record\Chan - */ - protected $chan; - - /** - * @var string - */ - protected $name; - - /** - * @var Record\Addr - */ - protected $addr; - - /** - * @var string - */ - protected $rin; - - /** - * @var string - */ - protected $rfn; - - /** - * @var array - */ - protected $lang = array(); - - /** - * @var array - */ - protected $phon = array(); - - /** - * @var array - */ - protected $email = array(); - - /** - * @var array - */ - protected $fax = array(); - - /** - * @var array - */ - protected $www = array(); - - /** - * @var array - */ - protected $obje = array(); - - /** - * @var array - */ - protected $note = array(); - - /** - * @param string $subm - * @return Subm - */ - public function setSubm($subm = '') { - $this->subm = $subm; - return $this; - } - - /** - * @return string - */ - public function getSubm() { - return $this->subm; - } - - /** - * @param string $name - * @return Subm - */ - public function setName($name = '') { - $this->name = $name; - return $this; - } - - /** - * @return string - */ - public function getName() { - return $this->name; - } - - /** - * @param array $phon - * @return Subm - */ - public function setPhon($phon = []) { - $this->phon = $phon; - return $this; - } - - /** - * @return array - */ - public function getPhon() { - return $this->phon; - } - - - /** - * @param Record\Phon $phon - * @return Subm - */ - public function addPhon($phon = []) { - $this->phon[] = $phon; - return $this; - } - - /** - * @return array - */ - public function getEmail() { - return $this->email; - } - - - /** - * @param Record\Phon $phon - * @return Subm - */ - public function addEmail($email) { - $this->email[] = $email; - return $this; - } - - /** - * @return array - */ - public function getFax() { - return $this->fax; - } - - - /** - * @param Record\Phon $phon - * @return Subm - */ - public function addFax($fax) { - $this->fax[] = $fax; - return $this; - } - - /** - * @return array - */ - public function getWww() { - return $this->www; - } - - - /** - * @param Record\Phon $phon - * @return Subm - */ - public function addWww($www) { - $this->www[] = $www; - return $this; - } - - /** - * @param string $rfn - * @return Subm - */ - public function setRfn($rfn = '') { - $this->rfn = $rfn; - return $this; - } - - /** - * @return string - */ - public function getRfn() { - return $this->rfn; - } - - /** - * @param string $rin - * @return Subm - */ - public function setRin($rin = '') { - $this->rin = $rin; - return $this; - } - - /** - * @return string - */ - public function getRin() { - return $this->rin; - } - - /** - * @param \PhpGedcom\Record\Chan $chan - * @return Subm - */ - public function setChan($chan = []) { - $this->chan = $chan; - return $this; - } - - /** - * @return \PhpGedcom\Record\Chan - */ - public function getChan() { - return $this->chan; - } - - /** - * @return array - */ - public function getLang() { - return $this->lang; - } - - /** - * @param string $lang - * @return Subm - */ - public function addLang($lang = '') { - $this->lang[] = $lang; - return $this; - } - - /** - * @return Addr - */ - public function getAddr() { - return $this->addr; - } - - /** - * @param Addr $addr - * @return Subm - */ - public function setAddr($addr = []) { - $this->addr = $addr; - return $this; - } - - /** - * @return array - */ - public function getObje() { - return $this->obje; - } - - /** - * @param Record\ObjeRef $obje - * @return Subm - */ - public function addObje($obje = []) { - $this->obje[] = $obje; - return $this; - } - - /** - * @return array - */ - public function getNote() { - return $this->note; - } - - /** - * @param Record\Note $note - * @return Subm - */ - public function addNote($note = []) { - $this->note[] = $note; - return $this; - } +class Subm extends Record implements Objectable +{ + /** + * @var string + */ + protected $subm; + + /** + * @var Record\Chan + */ + protected $chan; + + /** + * @var string + */ + protected $name; + + /** + * @var Record\Addr + */ + protected $addr; + + /** + * @var string + */ + protected $rin; + + /** + * @var string + */ + protected $rfn; + + /** + * @var array + */ + protected $lang = []; + + /** + * @var array + */ + protected $phon = []; + + /** + * @var array + */ + protected $email = []; + + /** + * @var array + */ + protected $fax = []; + + /** + * @var array + */ + protected $www = []; + + /** + * @var array + */ + protected $obje = []; + + /** + * @var array + */ + protected $note = []; + + /** + * @param string $subm + * + * @return Subm + */ + public function setSubm($subm = '') + { + $this->subm = $subm; + + return $this; + } + + /** + * @return string + */ + public function getSubm() + { + return $this->subm; + } + + /** + * @param string $name + * + * @return Subm + */ + public function setName($name = '') + { + $this->name = $name; + + return $this; + } + + /** + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * @param array $phon + * + * @return Subm + */ + public function setPhon($phon = []) + { + $this->phon = $phon; + + return $this; + } + + /** + * @return array + */ + public function getPhon() + { + return $this->phon; + } + + /** + * @param Record\Phon $phon + * + * @return Subm + */ + public function addPhon($phon = []) + { + $this->phon[] = $phon; + + return $this; + } + + /** + * @return array + */ + public function getEmail() + { + return $this->email; + } + + /** + * @param Record\Phon $phon + * + * @return Subm + */ + public function addEmail($email) + { + $this->email[] = $email; + + return $this; + } + + /** + * @return array + */ + public function getFax() + { + return $this->fax; + } + + /** + * @param Record\Phon $phon + * + * @return Subm + */ + public function addFax($fax) + { + $this->fax[] = $fax; + + return $this; + } + + /** + * @return array + */ + public function getWww() + { + return $this->www; + } + + /** + * @param Record\Phon $phon + * + * @return Subm + */ + public function addWww($www) + { + $this->www[] = $www; + + return $this; + } + + /** + * @param string $rfn + * + * @return Subm + */ + public function setRfn($rfn = '') + { + $this->rfn = $rfn; + + return $this; + } + + /** + * @return string + */ + public function getRfn() + { + return $this->rfn; + } + + /** + * @param string $rin + * + * @return Subm + */ + public function setRin($rin = '') + { + $this->rin = $rin; + + return $this; + } + + /** + * @return string + */ + public function getRin() + { + return $this->rin; + } + + /** + * @param \PhpGedcom\Record\Chan $chan + * + * @return Subm + */ + public function setChan($chan = []) + { + $this->chan = $chan; + + return $this; + } + + /** + * @return \PhpGedcom\Record\Chan + */ + public function getChan() + { + return $this->chan; + } + + /** + * @return array + */ + public function getLang() + { + return $this->lang; + } + + /** + * @param string $lang + * + * @return Subm + */ + public function addLang($lang = '') + { + $this->lang[] = $lang; + + return $this; + } + + /** + * @return Addr + */ + public function getAddr() + { + return $this->addr; + } + + /** + * @param Addr $addr + * + * @return Subm + */ + public function setAddr($addr = []) + { + $this->addr = $addr; + + return $this; + } + + /** + * @return array + */ + public function getObje() + { + return $this->obje; + } + + /** + * @param Record\ObjeRef $obje + * + * @return Subm + */ + public function addObje($obje = []) + { + $this->obje[] = $obje; + + return $this; + } + + /** + * @return array + */ + public function getNote() + { + return $this->note; + } + + /** + * @param Record\Note $note + * + * @return Subm + */ + public function addNote($note = []) + { + $this->note[] = $note; + + return $this; + } } diff --git a/library/PhpGedcom/Record/Subn.php b/library/PhpGedcom/Record/Subn.php index 806a80ab..cfba4c93 100644 --- a/library/PhpGedcom/Record/Subn.php +++ b/library/PhpGedcom/Record/Subn.php @@ -1,14 +1,14 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ @@ -17,8 +17,7 @@ use PhpGedcom\Record; /** - * Class Subn - * @package PhpGedcom\Record + * Class Subn. */ class Subn extends Record { @@ -65,38 +64,46 @@ class Subn extends Record /** * @var array */ - protected $_note = array(); + protected $_note = []; /** * @var \PhpGedcom\Record\Chan */ protected $_chan = null; - public function setChan($chan) { + public function setChan($chan) + { $this->_chan = $chan; + return $this; } - public function getChan() { + public function getChan() + { return $this->_chan; } - public function addNote($note) { + public function addNote($note) + { $this->_note[] = $note; + return $this; } - public function getNote() { + public function getNote() + { return $this->_note; } /** * @param string $subn + * * @return Subn */ public function setSubn($subn = '') { $this->subn = $subn; + return $this; } @@ -110,11 +117,13 @@ public function getSubn() /** * @param string $subm + * * @return Subn */ public function setSubm($subm = '') { $this->subm = $subm; + return $this; } @@ -128,11 +137,13 @@ public function getSubm() /** * @param string $famf + * * @return Subn */ public function setFamf($famf = '') { $this->famf = $famf; + return $this; } @@ -146,11 +157,13 @@ public function getFamf() /** * @param string $temp + * * @return Subn */ public function setTemp($temp = '') { $this->temp = $temp; + return $this; } @@ -164,11 +177,13 @@ public function getTemp() /** * @param string $ance + * * @return Subn */ public function setAnce($ance = '') { $this->ance = $ance; + return $this; } @@ -182,11 +197,13 @@ public function getAnce() /** * @param string $desc + * * @return Subn */ public function setDesc($desc = '') { $this->desc = $desc; + return $this; } @@ -200,11 +217,13 @@ public function getDesc() /** * @param string $ordi + * * @return Subn */ public function setOrdi($ordi = '') { $this->ordi = $ordi; + return $this; } @@ -218,11 +237,13 @@ public function getOrdi() /** * @param string $rin + * * @return Subn */ public function setRin($rin = '') { $this->rin = $rin; + return $this; } diff --git a/library/PhpGedcom/Writer.php b/library/PhpGedcom/Writer.php index 36a44faa..09bd368d 100644 --- a/library/PhpGedcom/Writer.php +++ b/library/PhpGedcom/Writer.php @@ -1,43 +1,39 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom; -use \PhpGedcom\Gedcom; -use \PhpGedcom\Writer\Head; -use \PhpGedcom\Writer\Subn; -use \PhpGedcom\Writer\Subm; -use \PhpGedcom\Writer\Sour; -use \PhpGedcom\Writer\Indi; -use \PhpGedcom\Writer\Fam; -use \PhpGedcom\Writer\Note; -use \PhpGedcom\Writer\Repo; -use \PhpGedcom\Writer\Obje; +use PhpGedcom\Writer\Fam; +use PhpGedcom\Writer\Head; +use PhpGedcom\Writer\Indi; +use PhpGedcom\Writer\Note; +use PhpGedcom\Writer\Obje; +use PhpGedcom\Writer\Repo; +use PhpGedcom\Writer\Sour; +use PhpGedcom\Writer\Subm; +use PhpGedcom\Writer\Subn; -/** - * - */ class Writer { const GEDCOM55 = 'gedcom5.5'; - + protected $_output = null; - + /** - * * @param \PhpGedcom\Gedcom $gedcom The GEDCOM object - * @param string $format The format to convert the GEDCOM object to + * @param string $format The format to convert the GEDCOM object to + * * @return string The contents of the document in the converted format */ public static function convert(Gedcom $gedcom, $format = self::GEDCOM55) @@ -51,81 +47,82 @@ public static function convert(Gedcom $gedcom, $format = self::GEDCOM55) $notes = $gedcom->getNote(); // array() $repos = $gedcom->getRepo(); // array() $objes = $gedcom->getObje(); // array() - - $output = "0 FORMAT ".$format."\n"; + + $output = '0 FORMAT '.$format."\n"; // head - if($head){ + if ($head) { $output = Head::convert($head, $format); } - + // subn - if($subn){ + if ($subn) { $output .= Subn::convert($subn); } // subms - if(!empty($subms) && count($subms) > 0){ - foreach($subms as $item){ - if($item){ + if (!empty($subms) && count($subms) > 0) { + foreach ($subms as $item) { + if ($item) { $output .= Subm::convert($item); } } } - + // sours - if(!empty($sours) && count($sours) > 0){ - foreach($sours as $item){ - if($item){ + if (!empty($sours) && count($sours) > 0) { + foreach ($sours as $item) { + if ($item) { $output .= Sour::convert($item); } } } // indis - if(!empty($indis) && count($indis) > 0){ - foreach($indis as $item){ - if($item){ + if (!empty($indis) && count($indis) > 0) { + foreach ($indis as $item) { + if ($item) { $output .= Indi::convert($item); } } } // fams - if(!empty($fams) && count($fams) > 0){ - foreach($fams as $item){ - if($item){ + if (!empty($fams) && count($fams) > 0) { + foreach ($fams as $item) { + if ($item) { $output .= Fam::convert($item); } } } // notes - if(!empty($notes) && count($notes) > 0){ - foreach($notes as $item){ - if($item){ + if (!empty($notes) && count($notes) > 0) { + foreach ($notes as $item) { + if ($item) { $output .= Note::convert($item); } } } // repos - if(!empty($repos) && count($repos) > 0){ - foreach($repos as $item){ - if($item){ + if (!empty($repos) && count($repos) > 0) { + foreach ($repos as $item) { + if ($item) { $output .= Repo::convert($item); } } } // Objes - if(!empty($objes) && count($objes) > 0){ - foreach($objes as $item){ - if($item){ + if (!empty($objes) && count($objes) > 0) { + foreach ($objes as $item) { + if ($item) { $output .= Obje::convert($item); } } } // EOF $output .= "0 TRLR\n"; + return $output; } } diff --git a/library/PhpGedcom/Writer/Addr.php b/library/PhpGedcom/Writer/Addr.php index fec98109..16cf6d68 100644 --- a/library/PhpGedcom/Writer/Addr.php +++ b/library/PhpGedcom/Writer/Addr.php @@ -1,49 +1,47 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Writer; -/** - * - */ class Addr { /** * @param \PhpGedcom\Record\Addr $addr - * @param string $format - * @param int $level + * @param string $format + * @param int $level + * * @return string */ public static function convert(\PhpGedcom\Record\Addr &$addr, $format = self::GEDCOM55, $level = 1) { $addrs = explode("\n", $addr->getAddr()); - - $output = "{$level} ADDR " . $addrs[0] . "\n"; - + + $output = "{$level} ADDR ".$addrs[0]."\n"; + array_shift($addrs); - + foreach ($addrs as $cont) { - $output .= ($level+1) . " CONT " . $cont . "\n"; + $output .= ($level + 1).' CONT '.$cont."\n"; } - $output .= ($level+1) . " ADR1 " . $addr->adr1 . "\n" . - ($level+1) . " ADR2 " . $addr->getAdr2() . "\n" . - ($level+1) . " CITY " . $addr->getCity() . "\n" . - ($level+1) . " STAE " . $addr->getStae() . "\n" . - ($level+1) . " POST " . $addr->getPost() . "\n" . - ($level+1) . " CTRY " . $addr->getCtry() . "\n"; - + $output .= ($level + 1).' ADR1 '.$addr->adr1."\n". + ($level + 1).' ADR2 '.$addr->getAdr2()."\n". + ($level + 1).' CITY '.$addr->getCity()."\n". + ($level + 1).' STAE '.$addr->getStae()."\n". + ($level + 1).' POST '.$addr->getPost()."\n". + ($level + 1).' CTRY '.$addr->getCtry()."\n"; + return $output; } } diff --git a/library/PhpGedcom/Writer/Caln.php b/library/PhpGedcom/Writer/Caln.php index aee2cd12..39212331 100644 --- a/library/PhpGedcom/Writer/Caln.php +++ b/library/PhpGedcom/Writer/Caln.php @@ -1,37 +1,35 @@ * @copyright Copyright (c) 2010-2013, Xiang Ming - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Writer; -/** - * - */ class Caln { /** * @param \PhpGedcom\Record\Caln $note - * @param int $level + * @param int $level + * * @return string */ public static function convert(\PhpGedcom\Record\Caln &$caln, $level) { - $output = ""; + $output = ''; $_caln = $caln->getCaln(); - if(empty($_caln)){ + if (empty($_caln)) { return $output; - }else{ - $output.=$level." CALN ".$_caln."\n"; + } else { + $output .= $level.' CALN '.$_caln."\n"; } // level up @@ -39,9 +37,10 @@ public static function convert(\PhpGedcom\Record\Caln &$caln, $level) // medi $medi = $caln->getMedi(); - if(!empty($medi)){ - $output.=$level." MEDI ".$medi."\n"; + if (!empty($medi)) { + $output .= $level.' MEDI '.$medi."\n"; } + return $output; } } diff --git a/library/PhpGedcom/Writer/Chan.php b/library/PhpGedcom/Writer/Chan.php index 0d119b51..ae4a7e29 100644 --- a/library/PhpGedcom/Writer/Chan.php +++ b/library/PhpGedcom/Writer/Chan.php @@ -1,27 +1,25 @@ * @copyright Copyright (c) 2010-2013, Xiang Ming - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Writer; -/** - * - */ class Chan { /** * @param \PhpGedcom\Record\Chan $note - * @param int $level + * @param int $level + * * @return string */ public static function convert(\PhpGedcom\Record\Chan &$chan, $level) @@ -31,22 +29,23 @@ public static function convert(\PhpGedcom\Record\Chan &$chan, $level) $level++; // DATE $_date = $chan->getDate(); - if(!empty($_date)){ - $output.=$level." DATE ".$_date."\n"; + if (!empty($_date)) { + $output .= $level.' DATE '.$_date."\n"; } // TIME $_time = $chan->getDate(); - if(!empty($_time)){ - $output.=$level." DATE ".$_time."\n"; + if (!empty($_time)) { + $output .= $level.' DATE '.$_time."\n"; } // $_note = array() $_note = $chan->getNote(); - if(!empty($_note) && count($_note) > 0){ - foreach($_note as $item){ + if (!empty($_note) && count($_note) > 0) { + foreach ($_note as $item) { $_convert = \PhpGedcom\Writer\NoteRef::convert($item, $level); - $output.=$_convert; + $output .= $_convert; } } + return $output; } } diff --git a/library/PhpGedcom/Writer/Fam.php b/library/PhpGedcom/Writer/Fam.php index e97e5b9e..c9188bc8 100644 --- a/library/PhpGedcom/Writer/Fam.php +++ b/library/PhpGedcom/Writer/Fam.php @@ -1,155 +1,153 @@ * @copyright Copyright (c) 2010-2013, Xiang Ming - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Writer; -/** - * - */ class Fam { /** * @param \PhpGedcom\Record\Fam $sour - * @param int $level + * @param int $level + * * @return string */ - public static function convert(\PhpGedcom\Record\Fam &$fam, $level=0) + public static function convert(\PhpGedcom\Record\Fam &$fam, $level = 0) { - - $output = ""; + $output = ''; $id = $fam->getId(); - if(empty($id)){ + if (empty($id)) { return $output; - }else{ - $output.=$level." @".$id."@ FAM "."\n"; + } else { + $output .= $level.' @'.$id.'@ FAM '."\n"; } // level up $level++; // HUSB $husb = $fam->getHusb(); - if(!empty($husb)){ - $output.=$level." HUSB @".$husb."@\n"; + if (!empty($husb)) { + $output .= $level.' HUSB @'.$husb."@\n"; } - + // WIFE $wife = $fam->getWife(); - if(!empty($wife)){ - $output.=$level." WIFE @".$wife."@\n"; + if (!empty($wife)) { + $output .= $level.' WIFE @'.$wife."@\n"; } // CHIL $chil = $fam->getChil(); - if(!empty($chil) && count($chil) > 0){ - foreach($chil as $item){ - if($item){ - $_convert = $level." CHIL @".$item."@\n"; - $output.=$_convert; + if (!empty($chil) && count($chil) > 0) { + foreach ($chil as $item) { + if ($item) { + $_convert = $level.' CHIL @'.$item."@\n"; + $output .= $_convert; } } } // NCHI $nchi = $fam->getNchi(); - if(!empty($nchi)){ - $output.=$level." NCHI ".$nchi."\n"; + if (!empty($nchi)) { + $output .= $level.' NCHI '.$nchi."\n"; } // SUBM array $subm = $fam->getSubm(); - - if(!empty($subm) && count($subm) > 0){ - foreach($subm as $item){ - if($item){ - $output.=$level." SUBM ".$item."\n"; + + if (!empty($subm) && count($subm) > 0) { + foreach ($subm as $item) { + if ($item) { + $output .= $level.' SUBM '.$item."\n"; } } } // RIN $rin = $fam->getRin(); - if(!empty($rin)){ - $output.=$level." RIN ".$rin."\n"; + if (!empty($rin)) { + $output .= $level.' RIN '.$rin."\n"; } // CHAN $chan = $fam->getChan(); - if(!empty($chan)){ + if (!empty($chan)) { $_convert = \PhpGedcom\Writer\Chan::convert($chan, $level); - $output.=$_convert; + $output .= $_convert; } // SLGS $slgs = $fam->getSlgs(); - if(!empty($slgs) && count($slgs) > 0){ - if($slgs){ + if (!empty($slgs) && count($slgs) > 0) { + if ($slgs) { $_convert = \PhpGedcom\Writer\Fam\Slgs::convert($item, $level); - $output.=$_convert; + $output .= $_convert; } } // REFN array $refn = $fam->getRefn(); - if(!empty($refn) && count($refn) > 0){ - foreach($refn as $item){ - if($item){ + if (!empty($refn) && count($refn) > 0) { + foreach ($refn as $item) { + if ($item) { $_convert = \PhpGedcom\Writer\Refn::convert($item, $level); - $output.=$_convert; + $output .= $_convert; } } } // NOTE array $note = $fam->getNote(); - if(!empty($note) && count($note) > 0){ - foreach($note as $item){ - if($item){ + if (!empty($note) && count($note) > 0) { + foreach ($note as $item) { + if ($item) { $_convert = \PhpGedcom\Writer\NoteRef::convert($item, $level); - $output.=$_convert; + $output .= $_convert; } } } // SOUR $sour = $fam->getSour(); - if(!empty($sour) && count($sour) > 0){ - foreach($sour as $item){ - if($item){ + if (!empty($sour) && count($sour) > 0) { + foreach ($sour as $item) { + if ($item) { $_convert = \PhpGedcom\Writer\SourRef::convert($item, $level); - $output.=$_convert; + $output .= $_convert; } } } // OBJE $obje = $fam->getObje(); - if(!empty($obje) && count($obje) > 0){ - foreach($obje as $item){ - if($item){ + if (!empty($obje) && count($obje) > 0) { + foreach ($obje as $item) { + if ($item) { $_convert = \PhpGedcom\Writer\ObjeRef::convert($item, $level); - $output.=$_convert; + $output .= $_convert; } } } // EVEN $even = $fam->getAllEven(); - if(!empty($even) && count($even) > 0){ - foreach($even as $item){ - if($item){ + if (!empty($even) && count($even) > 0) { + foreach ($even as $item) { + if ($item) { $_convert = \PhpGedcom\Writer\Fam\Even::convert($item, $level); - $output.=$_convert; + $output .= $_convert; } } } + return $output; } } diff --git a/library/PhpGedcom/Writer/Fam/Even.php b/library/PhpGedcom/Writer/Fam/Even.php index 05dcc955..5ccd8317 100644 --- a/library/PhpGedcom/Writer/Fam/Even.php +++ b/library/PhpGedcom/Writer/Fam/Even.php @@ -1,106 +1,104 @@ * @copyright Copyright (c) 2010-2013, Xiang Ming - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Writer\Fam; -/** - * - */ class Even { /** * @param \PhpGedcom\Record\Fam\Even $even - * @param int $level + * @param int $level + * * @return string */ public static function convert(\PhpGedcom\Record\Fam\Even &$even, $level) { - $output = ""; + $output = ''; // $type; $type = $even->getType(); - if(!empty($type)){ - $output.=$level." ".$type."\n"; - }else{ + if (!empty($type)) { + $output .= $level.' '.$type."\n"; + } else { return $output; } $level++; // $type; $type = $even->getType(); - if(!empty($type)){ - $output.=$level." TYPE ".$type."\n"; + if (!empty($type)) { + $output .= $level.' TYPE '.$type."\n"; } // $date; $date = $even->getDate(); - if(!empty($date)){ - $output.=$level." DATE ".$date."\n"; + if (!empty($date)) { + $output .= $level.' DATE '.$date."\n"; } - + // Plac $plac = $even->getPlac(); - if(!empty($plac)){ + if (!empty($plac)) { $_convert = \PhpGedcom\Writer\Indi\Even\Plac::convert($plac, $level); - $output.=$_convert; + $output .= $_convert; } // $caus; $caus = $even->getCaus(); - if(!empty($caus)){ - $output.=$level." CAUS ".$caus."\n"; + if (!empty($caus)) { + $output .= $level.' CAUS '.$caus."\n"; } // $age; $age = $even->getAge(); - if(!empty($age)){ - $output.=$level." AGE ".$age."\n"; + if (!empty($age)) { + $output .= $level.' AGE '.$age."\n"; } // $addr $addr = $even->getAddr(); - if(!empty($addr)){ + if (!empty($addr)) { $_convert = \PhpGedcom\Writer\Addr::convert($addr, $level); - $output.=$_convert; + $output .= $_convert; } // $phon = array() $phon = $even->getPhon(); - if(!empty($phon) && count($phon) > 0){ - foreach($phon as $item){ + if (!empty($phon) && count($phon) > 0) { + foreach ($phon as $item) { $_convert = \PhpGedcom\Writer\Phon::convert($item, $level); - $output.=$_convert; + $output .= $_convert; } } // $agnc $agnc = $even->getAgnc(); - if(!empty($agnc)){ - $output.=$level." AGNC ".$agnc."\n"; + if (!empty($agnc)) { + $output .= $level.' AGNC '.$agnc."\n"; } // HUSB $husb = $even->getHusb(); - if(!empty($husb)){ + if (!empty($husb)) { $_convert = \PhpGedcom\Writer\Fam\Even\Husb::convert($husb, $level); - $output.=$_convert; + $output .= $_convert; } // WIFE $wife = $even->getWife(); - if(!empty($wife)){ + if (!empty($wife)) { $_convert = \PhpGedcom\Writer\Fam\Even\Wife::convert($wife, $level); - $output.=$_convert; + $output .= $_convert; } // $ref = array(); @@ -108,26 +106,26 @@ public static function convert(\PhpGedcom\Record\Fam\Even &$even, $level) // $obje = array(); $obje = $even->getObje(); - if(!empty($obje) && count($obje) > 0){ - foreach($obje as $item){ + if (!empty($obje) && count($obje) > 0) { + foreach ($obje as $item) { $_convert = \PhpGedcom\Writer\ObjeRef::convert($item, $level); - $output.=$_convert; + $output .= $_convert; } } // $sour = array(); $sour = $even->getSour(); - if(!empty($sour) && count($sour) > 0){ - foreach($sour as $item){ + if (!empty($sour) && count($sour) > 0) { + foreach ($sour as $item) { $_convert = \PhpGedcom\Writer\SourRef::convert($item, $level); - $output.=$_convert; + $output .= $_convert; } } // $note = array(); $note = $even->getNote(); - if(!empty($note) && count($note) > 0){ - foreach($note as $item){ + if (!empty($note) && count($note) > 0) { + foreach ($note as $item) { $_convert = \PhpGedcom\Writer\NoteRef::convert($item, $level); - $output.=$_convert; + $output .= $_convert; } } diff --git a/library/PhpGedcom/Writer/Fam/Even/Husb.php b/library/PhpGedcom/Writer/Fam/Even/Husb.php index 5c3ce27c..69739b1d 100644 --- a/library/PhpGedcom/Writer/Fam/Even/Husb.php +++ b/library/PhpGedcom/Writer/Fam/Even/Husb.php @@ -1,43 +1,41 @@ * @copyright Copyright (c) 2010-2013, Xiang Ming - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Writer\Fam\Even; -/** - * - */ class Husb { /** * @param \PhpGedcom\Record\Fam\Even\Husb $attr - * @param int $level + * @param int $level + * * @return string */ public static function convert(\PhpGedcom\Record\Fam\Even\Husb &$husb, $level = 0) { $output = ''; - - $output.= $level." WIFE \n"; + + $output .= $level." WIFE \n"; // level up $level++; - + // AGE $age = $husb->getAge(); - if(!empty($age)){ - $output.=$level." AGE ".$age."\n"; + if (!empty($age)) { + $output .= $level.' AGE '.$age."\n"; } - + return $output; } } diff --git a/library/PhpGedcom/Writer/Fam/Even/Wife.php b/library/PhpGedcom/Writer/Fam/Even/Wife.php index 02163d10..d9cb0644 100644 --- a/library/PhpGedcom/Writer/Fam/Even/Wife.php +++ b/library/PhpGedcom/Writer/Fam/Even/Wife.php @@ -1,43 +1,41 @@ * @copyright Copyright (c) 2010-2013, Xiang Ming - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Writer\Fam\Even; -/** - * - */ class Wife { /** * @param \PhpGedcom\Record\Fam\Even\Wife $attr - * @param int $level + * @param int $level + * * @return string */ public static function convert(\PhpGedcom\Record\Fam\Even\Wife &$wife, $level = 0) { $output = ''; - - $output.= $level." HUSB \n"; + + $output .= $level." HUSB \n"; // level up $level++; - + // AGE $age = $wife->getAge(); - if(!empty($age)){ - $output.=$level." AGE ".$age."\n"; + if (!empty($age)) { + $output .= $level.' AGE '.$age."\n"; } - + return $output; } } diff --git a/library/PhpGedcom/Writer/Fam/Slgs.php b/library/PhpGedcom/Writer/Fam/Slgs.php index 4923b98a..d9b00f59 100644 --- a/library/PhpGedcom/Writer/Fam/Slgs.php +++ b/library/PhpGedcom/Writer/Fam/Slgs.php @@ -1,78 +1,76 @@ * @copyright Copyright (c) 2010-2013, Xiang Ming - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Writer\Fam; -/** - * - */ class Slgs { /** * @param \PhpGedcom\Record\Fam\Slgs $slgs - * @param int $level + * @param int $level + * * @return string */ public static function convert(\PhpGedcom\Record\Fam\Slgs &$slgs, $level) { - $output = ""; - $output.=$level." SLGS \n"; - + $output = ''; + $output .= $level." SLGS \n"; + // Level up $level++; // $STAT; $stat = $slgs->getStat(); - if(!empty($stat)){ - $output.=$level." STAT ".$stat."\n"; + if (!empty($stat)) { + $output .= $level.' STAT '.$stat."\n"; } // $date; $date = $slgs->getDate(); - if(!empty($date)){ - $output.=$level." DATE ".$date."\n"; + if (!empty($date)) { + $output .= $level.' DATE '.$date."\n"; } - + // PLAC $plac = $slgs->getPlac(); - if(!empty($plac)){ - $output.=$level." PLAC ".$plac."\n"; + if (!empty($plac)) { + $output .= $level.' PLAC '.$plac."\n"; } // $TEMP; $temp = $slgs->getTemp(); - if(!empty($temp)){ - $output.=$level." TEMP ".$temp."\n"; + if (!empty($temp)) { + $output .= $level.' TEMP '.$temp."\n"; } // $sour = array(); $sour = $slgs->getSour(); - if(!empty($sour) && count($sour) > 0){ - foreach($sour as $item){ + if (!empty($sour) && count($sour) > 0) { + foreach ($sour as $item) { $_convert = \PhpGedcom\Writer\SourRef::convert($item, $level); - $output.=$_convert; + $output .= $_convert; } } // $note = array(); $note = $slgs->getNote(); - if(!empty($note) && count($note) > 0){ - foreach($note as $item){ + if (!empty($note) && count($note) > 0) { + foreach ($note as $item) { $_convert = \PhpGedcom\Writer\NoteRef::convert($item, $level); - $output.=$_convert; + $output .= $_convert; } } - + return $output; } } diff --git a/library/PhpGedcom/Writer/Head.php b/library/PhpGedcom/Writer/Head.php index 4f51f295..2d22eb3f 100644 --- a/library/PhpGedcom/Writer/Head.php +++ b/library/PhpGedcom/Writer/Head.php @@ -1,114 +1,110 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Writer; -/** - * - */ class Head { /** * @param \PhpGedcom\Record\Head $head - * @param string $format + * @param string $format + * * @return string */ public static function convert(\PhpGedcom\Record\Head &$head, $format = self::GEDCOM55) { - $level = 0; - $output = $level." HEAD\n"; - - // level up - $level++; + $level = 0; + $output = $level." HEAD\n"; - //SOUR - $sour = $head->getSour(); - if($sour){ - $_convert = \PhpGedcom\Writer\Head\Sour::convert($sour, $level); - $output.=$_convert; - } - - // DEST - $dest = $head->getDest(); - if($dest){ - $output.=$level." DEST ".$dest."\n"; - } + // level up + $level++; - //Subm - $subm = $head->getSubm(); - if($subm){ - $output.=$level." SUBM ".$subm."\n"; - } + //SOUR + $sour = $head->getSour(); + if ($sour) { + $_convert = \PhpGedcom\Writer\Head\Sour::convert($sour, $level); + $output .= $_convert; + } - // SUBN - $subn = $head->getSubn(); - if($subn){ - $output.=$level." SUBN ".$subn."\n"; - } + // DEST + $dest = $head->getDest(); + if ($dest) { + $output .= $level.' DEST '.$dest."\n"; + } - // FILE - $file = $head->getFile(); - if($file){ - $output.=$level." FILE ".$file."\n"; - } + //Subm + $subm = $head->getSubm(); + if ($subm) { + $output .= $level.' SUBM '.$subm."\n"; + } - // COPR - $copr = $head->getCopr(); - if($copr){ - $output.=$level." COPR ".$copr."\n"; - } + // SUBN + $subn = $head->getSubn(); + if ($subn) { + $output .= $level.' SUBN '.$subn."\n"; + } - // LANG - $lang = $head->getLang(); - if($lang){ - $output.=$level." LANG ".$lang."\n"; - } - // DATE - $date = $head->getDate(); - if($date){ - $_convert = \PhpGedcom\Writer\Head\Date::convert($date, $level); - $output.=$_convert; - } + // FILE + $file = $head->getFile(); + if ($file) { + $output .= $level.' FILE '.$file."\n"; + } + // COPR + $copr = $head->getCopr(); + if ($copr) { + $output .= $level.' COPR '.$copr."\n"; + } - // GEDC - $gedc = $head->getGedc(); - if($gedc){ - $_convert = \PhpGedcom\Writer\Head\Gedc::convert($gedc, $level); - $output.=$_convert; - } + // LANG + $lang = $head->getLang(); + if ($lang) { + $output .= $level.' LANG '.$lang."\n"; + } + // DATE + $date = $head->getDate(); + if ($date) { + $_convert = \PhpGedcom\Writer\Head\Date::convert($date, $level); + $output .= $_convert; + } + // GEDC + $gedc = $head->getGedc(); + if ($gedc) { + $_convert = \PhpGedcom\Writer\Head\Gedc::convert($gedc, $level); + $output .= $_convert; + } - // CHAR - $char = $head->getChar(); - if($char){ - $_convert = \PhpGedcom\Writer\Head\Char::convert($char, $level); - $output.=$_convert; - } - // PLAC - $plac = $head->getPlac(); - if($plac){ - $_convert = \PhpGedcom\Writer\Head\Plac::convert($plac, $level); - $output.=$_convert; - } + // CHAR + $char = $head->getChar(); + if ($char) { + $_convert = \PhpGedcom\Writer\Head\Char::convert($char, $level); + $output .= $_convert; + } + // PLAC + $plac = $head->getPlac(); + if ($plac) { + $_convert = \PhpGedcom\Writer\Head\Plac::convert($plac, $level); + $output .= $_convert; + } - // NOTE - $note = $head->getNote(); - if($note){ - $output.=$level." NOTE ".$note."\n"; - } - // + // NOTE + $note = $head->getNote(); + if ($note) { + $output .= $level.' NOTE '.$note."\n"; + } + // /* +1 SUBM @@ {1:1} +1 SUBN @@ {0:1} @@ -125,7 +121,7 @@ public static function convert(\PhpGedcom\Record\Head &$head, $format = self::GE +1 NOTE {0:1} +2 [CONT|CONC] {0:M} */ - + return $output; } } diff --git a/library/PhpGedcom/Writer/Head/Char.php b/library/PhpGedcom/Writer/Head/Char.php index a606d0a1..15bdc888 100644 --- a/library/PhpGedcom/Writer/Head/Char.php +++ b/library/PhpGedcom/Writer/Head/Char.php @@ -1,38 +1,36 @@ * @copyright Copyright (c) 2010-2013, Xiang Ming - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Writer\Head; -/** - * - */ class Char { /** * @param \PhpGedcom\Record\Head\Char $char - * @param string $format - * @param int $level + * @param string $format + * @param int $level + * * @return string */ public static function convert(\PhpGedcom\Record\Head\Char &$char, $level) { - $output =""; + $output = ''; // char $_char = $char->getChar(); - if($_char){ - $output.=$level." CHAR ".$_char."\n"; - }else{ + if ($_char) { + $output .= $level.' CHAR '.$_char."\n"; + } else { return $output; } @@ -40,11 +38,10 @@ public static function convert(\PhpGedcom\Record\Head\Char &$char, $level) $level++; // VERS $vers = $char->getVersion(); - if($vers){ - $output.=$level." VERS ".$vers."\n"; + if ($vers) { + $output .= $level.' VERS '.$vers."\n"; } - return $output; } } diff --git a/library/PhpGedcom/Writer/Head/Date.php b/library/PhpGedcom/Writer/Head/Date.php index b4c3d3e9..0459dd32 100644 --- a/library/PhpGedcom/Writer/Head/Date.php +++ b/library/PhpGedcom/Writer/Head/Date.php @@ -1,37 +1,35 @@ * @copyright Copyright (c) 2010-2013, Xiang Ming - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Writer\Head; -/** - * - */ class Date { /** * @param \PhpGedcom\Record\Head\Date $date - * @param string $format - * @param int $level + * @param string $format + * @param int $level + * * @return string */ public static function convert(\PhpGedcom\Record\Head\Date &$date, $level) { - $output = ""; + $output = ''; $_date = $date->getDate(); - if($_date){ - $output .=$level." DATE ".$_date."\n"; - }else{ + if ($_date) { + $output .= $level.' DATE '.$_date."\n"; + } else { return $output; } @@ -39,8 +37,8 @@ public static function convert(\PhpGedcom\Record\Head\Date &$date, $level) $level++; // Time $time = $date->getTime(); - if($time){ - $output.=$level." TIME ".$time."\n"; + if ($time) { + $output .= $level.' TIME '.$time."\n"; } return $output; diff --git a/library/PhpGedcom/Writer/Head/Gedc.php b/library/PhpGedcom/Writer/Head/Gedc.php index eb73235b..3514c14a 100644 --- a/library/PhpGedcom/Writer/Head/Gedc.php +++ b/library/PhpGedcom/Writer/Head/Gedc.php @@ -1,47 +1,46 @@ * @copyright Copyright (c) 2010-2013, Xiang Ming - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Writer\Head; -/** - * - */ class Gedc { /** * @param \PhpGedcom\Record\Head\Gedc $gedc - * @param string $format - * @param int $level + * @param string $format + * @param int $level + * * @return string */ public static function convert(\PhpGedcom\Record\Head\Gedc &$gedc, $level) { $output = $level." GEDC \n"; - + // level up $level++; // VERS $vers = $gedc->getVersion(); - if($vers){ - $output.=$level." VERS ".$vers."\n"; + if ($vers) { + $output .= $level.' VERS '.$vers."\n"; } // FORM $form = $gedc->getForm(); - if($form){ - $output.=$level." FORM ".$form."\n"; + if ($form) { + $output .= $level.' FORM '.$form."\n"; } + return $output; } } diff --git a/library/PhpGedcom/Writer/Head/Plac.php b/library/PhpGedcom/Writer/Head/Plac.php index 275f3cdd..ef3a1b8a 100644 --- a/library/PhpGedcom/Writer/Head/Plac.php +++ b/library/PhpGedcom/Writer/Head/Plac.php @@ -1,28 +1,26 @@ * @copyright Copyright (c) 2010-2013, Xiang Ming - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Writer\Head; -/** - * - */ class Plac { /** * @param \PhpGedcom\Record\Head\Plac $plac - * @param string $format - * @param int $level + * @param string $format + * @param int $level + * * @return string */ public static function convert(\PhpGedcom\Record\Head\Plac &$plac, $level) @@ -33,10 +31,10 @@ public static function convert(\PhpGedcom\Record\Head\Plac &$plac, $level) $level++; // FORM $form = $plac->getForm(); - if($form){ - $output.=$level." FORM ".$form."\n"; + if ($form) { + $output .= $level.' FORM '.$form."\n"; } - + return $output; } } diff --git a/library/PhpGedcom/Writer/Head/Sour.php b/library/PhpGedcom/Writer/Head/Sour.php index 1b76325a..d5d38258 100644 --- a/library/PhpGedcom/Writer/Head/Sour.php +++ b/library/PhpGedcom/Writer/Head/Sour.php @@ -1,37 +1,35 @@ * @copyright Copyright (c) 2010-2013, Xiang Ming - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Writer\Head; -/** - * - */ class Sour { /** * @param \PhpGedcom\Record\Head\Sour $sour - * @param string $format - * @param int $level + * @param string $format + * @param int $level + * * @return string */ public static function convert(\PhpGedcom\Record\Head\Sour &$sour, $level) { - $output = ""; + $output = ''; $_sour = $sour->getSour(); - if($_sour){ - $output.=$level." SOUR ".$_sour."\n"; - }else{ + if ($_sour) { + $output .= $level.' SOUR '.$_sour."\n"; + } else { return $output; } @@ -40,29 +38,30 @@ public static function convert(\PhpGedcom\Record\Head\Sour &$sour, $level) // VERS $vers = $sour->getVersion(); - if($vers){ - $output.=$level." VERS ".$vers."\n"; + if ($vers) { + $output .= $level.' VERS '.$vers."\n"; } // NAME $name = $sour->getName(); - if($name){ - $output.=$level." NAME ".$name."\n"; + if ($name) { + $output .= $level.' NAME '.$name."\n"; } // CORP $corp = $sour->getCorp(); - if($corp){ + if ($corp) { $_convert = \PhpGedcom\Writer\Head\Sour\Corp::convert($corp, $level); - $output.=$_convert; + $output .= $_convert; } // DATA $data = $sour->getData(); - if($data){ + if ($data) { $_convert = \PhpGedcom\Writer\Head\Sour\Data::convert($data, $level); - $output.=$_convert; + $output .= $_convert; } + return $output; } } diff --git a/library/PhpGedcom/Writer/Head/Sour/Corp.php b/library/PhpGedcom/Writer/Head/Sour/Corp.php index 83c9094c..07f795c9 100644 --- a/library/PhpGedcom/Writer/Head/Sour/Corp.php +++ b/library/PhpGedcom/Writer/Head/Sour/Corp.php @@ -1,37 +1,35 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Writer\Head\Sour; -/** - * - */ class Corp { /** * @param \PhpGedcom\Record\Head\Sour\Corp $corp - * @param string $format - * @param int $level + * @param string $format + * @param int $level + * * @return string */ public static function convert(\PhpGedcom\Record\Head\Sour\Corp &$corp, $level) { - $output = ""; + $output = ''; $_corp = $corp->getCorp(); - if($_corp){ - $output.=$level." CORP ".$_corp."\n"; - }else{ + if ($_corp) { + $output .= $level.' CORP '.$_corp."\n"; + } else { return $output; } @@ -40,18 +38,18 @@ public static function convert(\PhpGedcom\Record\Head\Sour\Corp &$corp, $level) // ADDR $addr = $corp->getAddr(); - if($addr){ + if ($addr) { $_convert = \PhpGedcom\Writer\Addr::convert($addr, $level); - $output.=$_convert; + $output .= $_convert; } // phon $phon = $corp->getPhon(); - if($phon && count($phon) > 0){ - foreach($phon as $item){ - if($item){ + if ($phon && count($phon) > 0) { + foreach ($phon as $item) { + if ($item) { $_convert = \PhpGedcom\Writer\Phon::convert($item, $level); - $output.=$_convert; + $output .= $_convert; } } } diff --git a/library/PhpGedcom/Writer/Head/Sour/Data.php b/library/PhpGedcom/Writer/Head/Sour/Data.php index 66186ae1..90307666 100644 --- a/library/PhpGedcom/Writer/Head/Sour/Data.php +++ b/library/PhpGedcom/Writer/Head/Sour/Data.php @@ -1,37 +1,35 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Writer\Head\Sour; -/** - * - */ class Data { /** * @param \PhpGedcom\Record\Head\Sour\Data $data - * @param string $format - * @param int $level + * @param string $format + * @param int $level + * * @return string */ public static function convert(\PhpGedcom\Record\Head\Sour\Data &$data, $level) { - $output = ""; + $output = ''; $_data = $data->getData(); - if($_data){ - $output.=$level." DATA ".$_data."\n"; - }else{ + if ($_data) { + $output .= $level.' DATA '.$_data."\n"; + } else { return $output; } @@ -40,14 +38,14 @@ public static function convert(\PhpGedcom\Record\Head\Sour\Data &$data, $level) // DATE $date = $corp->getDate(); - if($date){ - $output.=$level." DATE ".$date."\n"; + if ($date) { + $output .= $level.' DATE '.$date."\n"; } // COPR $corp = $corp->getCorp(); - if($corp){ - $output.=$level." COPR ".$corp."\n"; + if ($corp) { + $output .= $level.' COPR '.$corp."\n"; } return $output; diff --git a/library/PhpGedcom/Writer/Indi.php b/library/PhpGedcom/Writer/Indi.php index fb44c1c5..9e3d1c0b 100644 --- a/library/PhpGedcom/Writer/Indi.php +++ b/library/PhpGedcom/Writer/Indi.php @@ -1,27 +1,25 @@ * @copyright Copyright (c) 2010-2013, Xiang Ming - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Writer; -/** - * - */ class Indi { /** * @param \PhpGedcom\Record\Indi $indi - * @param string $format + * @param string $format + * * @return string */ public static function convert(\PhpGedcom\Record\Indi &$indi) @@ -30,7 +28,7 @@ public static function convert(\PhpGedcom\Record\Indi &$indi) // id $id = $indi->getId(); - $output = $level." @".$id."@ INDI\n"; + $output = $level.' @'.$id."@ INDI\n"; // increase level after start indi $level++; @@ -43,170 +41,170 @@ public static function convert(\PhpGedcom\Record\Indi &$indi) // chan $chan = $indi->getChan(); - if(!empty($chan)){ - $output .= $level." CHAN ".$chan."\n"; + if (!empty($chan)) { + $output .= $level.' CHAN '.$chan."\n"; } // $attr // PhpGedcom/Record/Attr extend PhpGedcom/Record/Even and there is no change. // So used convert Even $attr = $indi->getAllAttr(); - if(!empty($attr) && count($attr) > 0){ - foreach($attr as $item){ + if (!empty($attr) && count($attr) > 0) { + foreach ($attr as $item) { $_convert = \PhpGedcom\Writer\Indi\Even::convert($item, $level); - $output.=$_convert; + $output .= $_convert; } } // $even $even = $indi->getAllEven(); - if(!empty($even) && count($even) > 0){ - foreach($even as $item){ + if (!empty($even) && count($even) > 0) { + foreach ($even as $item) { $_convert = \PhpGedcom\Writer\Indi\Even::convert($item, $level); - $output.=$_convert; + $output .= $_convert; } } // $note $note = $indi->getNote(); - if(!empty($note) && count($note) > 0){ - foreach($note as $item){ + if (!empty($note) && count($note) > 0) { + foreach ($note as $item) { $_convert = \PhpGedcom\Writer\NoteRef::convert($item, $level); - $output.=$_convert; + $output .= $_convert; } } // $obje $obje = $indi->getObje(); - if(!empty($obje) && count($obje) > 0){ - foreach($obje as $item){ + if (!empty($obje) && count($obje) > 0) { + foreach ($obje as $item) { $_convert = \PhpGedcom\Writer\ObjeRef::convert($item, $level); - $output.=$_convert; + $output .= $_convert; } } // $sour $sour = $indi->getSour(); - if(!empty($sour) && count($sour) > 0){ - foreach($sour as $item){ + if (!empty($sour) && count($sour) > 0) { + foreach ($sour as $item) { $_convert = \PhpGedcom\Writer\SourRef::convert($item, $level); - $output.=$_convert; + $output .= $_convert; } } // $name $name = $indi->getName(); - if(!empty($name) && count($name) > 0){ - foreach($name as $item){ + if (!empty($name) && count($name) > 0) { + foreach ($name as $item) { $_convert = \PhpGedcom\Writer\Indi\Name::convert($item, $level); - $output.=$_convert; + $output .= $_convert; } } - + // $alia $alia = $indi->getAlia(); - if(!empty($alia) && count($alia) > 0){ - foreach($alia as $item){ - if(!empty($item)){ - $_convert = $level." ALIA ".$item."\n"; - $output.=$_convert; + if (!empty($alia) && count($alia) > 0) { + foreach ($alia as $item) { + if (!empty($item)) { + $_convert = $level.' ALIA '.$item."\n"; + $output .= $_convert; } } } - + // $sex $sex = $indi->getSex(); - if(!empty($sex)){ - $output .= $level." SEX ".$sex."\n"; + if (!empty($sex)) { + $output .= $level.' SEX '.$sex."\n"; } // $rin $rin = $indi->getRin(); - if(!empty($rin)){ - $output .= $level." RIN ".$rin."\n"; + if (!empty($rin)) { + $output .= $level.' RIN '.$rin."\n"; } // $resn $resn = $indi->getResn(); - if(!empty($resn)){ - $output .= $level." RESN ".$resn."\n"; + if (!empty($resn)) { + $output .= $level.' RESN '.$resn."\n"; } // $rfn $rfn = $indi->getRfn(); - if(!empty($rfn)){ - $output .= $level." RFN ".$rfn."\n"; + if (!empty($rfn)) { + $output .= $level.' RFN '.$rfn."\n"; } // $afn $afn = $indi->getAfn(); - if(!empty($afn)){ - $output .= $level." AFN ".$afn."\n"; + if (!empty($afn)) { + $output .= $level.' AFN '.$afn."\n"; } // Fams[] $fams = $indi->getFams(); - if(!empty($fams) && count($fams) > 0){ - foreach($fams as $item){ + if (!empty($fams) && count($fams) > 0) { + foreach ($fams as $item) { $_convert = \PhpGedcom\Writer\Indi\Fams::convert($item, $level); - $output.=$_convert; + $output .= $_convert; } } // Famc[] $famc = $indi->getFamc(); - if(!empty($famc) && count($famc) > 0){ - foreach($famc as $item){ + if (!empty($famc) && count($famc) > 0) { + foreach ($famc as $item) { $_convert = \PhpGedcom\Writer\Indi\Famc::convert($item, $level); - $output.=$_convert; + $output .= $_convert; } } // Asso[] $asso = $indi->getAsso(); - if(!empty($asso) && count($asso) > 0){ - foreach($asso as $item){ + if (!empty($asso) && count($asso) > 0) { + foreach ($asso as $item) { $_convert = \PhpGedcom\Writer\Indi\Asso::convert($item, $level); - $output.=$_convert; + $output .= $_convert; } } // $subm $subm = $indi->getSubm(); - if(!empty($subm) && count($subm) > 0){ - foreach($subm as $item){ - if(!empty($item)){ - $_convert = $level." SUBM ".$item."\n"; - $output.=$_convert; + if (!empty($subm) && count($subm) > 0) { + foreach ($subm as $item) { + if (!empty($item)) { + $_convert = $level.' SUBM '.$item."\n"; + $output .= $_convert; } } } // $anci $anci = $indi->getAnci(); - if(!empty($anci) && count($anci) > 0){ - foreach($anci as $item){ - $_convert = $level." ANCI ".$item."\n"; - $output.=$_convert; + if (!empty($anci) && count($anci) > 0) { + foreach ($anci as $item) { + $_convert = $level.' ANCI '.$item."\n"; + $output .= $_convert; } } // $desi $desi = $indi->getDesi(); - if(!empty($desi) && count($desi) > 0){ - foreach($desi as $item){ - $_convert = $level." DESI ".$item."\n"; - $output.=$_convert; + if (!empty($desi) && count($desi) > 0) { + foreach ($desi as $item) { + $_convert = $level.' DESI '.$item."\n"; + $output .= $_convert; } } // Refn[] $refn = $indi->getRefn(); - if(!empty($refn) && count($refn) > 0){ - foreach($refn as $item){ + if (!empty($refn) && count($refn) > 0) { + foreach ($refn as $item) { $_convert = \PhpGedcom\Writer\Refn::convert($item, $level); - $output.=$_convert; + $output .= $_convert; } } @@ -217,7 +215,7 @@ public static function convert(\PhpGedcom\Record\Indi &$indi) // $_convert = \PhpGedcom\Writer\Indi\Bapl::convert($bapl, $level); // $output.=$_convert; // } - + // Conl // Currently Conl is empty // $conl = $indi->getConl(); diff --git a/library/PhpGedcom/Writer/Indi/Asso.php b/library/PhpGedcom/Writer/Indi/Asso.php index 1f68c424..dc922e6c 100644 --- a/library/PhpGedcom/Writer/Indi/Asso.php +++ b/library/PhpGedcom/Writer/Indi/Asso.php @@ -1,27 +1,25 @@ * @copyright Copyright (c) 2010-2013, Xiang Ming - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Writer\Indi; -/** - * - */ class Asso { /** * @param \PhpGedcom\Record\Indi\Asso $attr - * @param int $level + * @param int $level + * * @return string */ public static function convert(\PhpGedcom\Record\Indi\Asso &$asso, $level = 0) @@ -29,33 +27,33 @@ public static function convert(\PhpGedcom\Record\Indi\Asso &$asso, $level = 0) $output = ''; // _indi $_indi = $asso->getIndi(); - if(empty($_indi)){ + if (empty($_indi)) { return $output; } - $output.= $level." ASSO ".$_indi."\n"; + $output .= $level.' ASSO '.$_indi."\n"; // level up $level++; - + // RELA $rela = $asso->getRela(); - if(!empty($rela)){ - $output.=$level." RELA ".$rela."\n"; + if (!empty($rela)) { + $output .= $level.' RELA '.$rela."\n"; } // sour $sour = $asso->getSour(); - if(!empty($sour) && count($sour) > 0){ - foreach($sour as $item){ + if (!empty($sour) && count($sour) > 0) { + foreach ($sour as $item) { $_convert = \PhpGedcom\Writer\SourRef::convert($item, $level); - $output.=$_convert; + $output .= $_convert; } } // note $note = $asso->getSour(); - if(!empty($note) && count($note) > 0){ - foreach($note as $item){ + if (!empty($note) && count($note) > 0) { + foreach ($note as $item) { $_convert = \PhpGedcom\Writer\NoteRef::convert($item, $level); - $output.=$_convert; + $output .= $_convert; } } diff --git a/library/PhpGedcom/Writer/Indi/Attr.php b/library/PhpGedcom/Writer/Indi/Attr.php index 62071004..5b27b78b 100644 --- a/library/PhpGedcom/Writer/Indi/Attr.php +++ b/library/PhpGedcom/Writer/Indi/Attr.php @@ -1,32 +1,31 @@ * @copyright Copyright (c) 2010-2013, Xiang Ming - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Writer\Indi; -/** - * - */ class Attr { /** * @param \PhpGedcom\Record\Indi\Attr $attr - * @param int $level + * @param int $level + * * @return string */ public static function convert(\PhpGedcom\Record\Indi\Attr &$attr, $level = 0) { - $output = ''; + $output = ''; + return $output; } } diff --git a/library/PhpGedcom/Writer/Indi/Even.php b/library/PhpGedcom/Writer/Indi/Even.php index 8f4d8772..0221d77d 100644 --- a/library/PhpGedcom/Writer/Indi/Even.php +++ b/library/PhpGedcom/Writer/Indi/Even.php @@ -1,92 +1,90 @@ * @copyright Copyright (c) 2010-2013, Xiang Ming - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Writer\Indi; -/** - * - */ class Even { /** * @param \PhpGedcom\Record\Indi\Even $even - * @param int $level + * @param int $level + * * @return string */ public static function convert(\PhpGedcom\Record\Indi\Even &$even, $level = 0) { - $output = ""; + $output = ''; // $_attr; $attr = $even->getAttr(); - if(!empty($attr)){ - $output.=$level." EVEN ".$attr."\n"; - }else{ + if (!empty($attr)) { + $output .= $level.' EVEN '.$attr."\n"; + } else { $output = $level." EVEN\n"; } $level++; // $type; $type = $even->getType(); - if(!empty($type)){ - $output.=$level." TYPE ".$type."\n"; + if (!empty($type)) { + $output .= $level.' TYPE '.$type."\n"; } // $date; $date = $even->getDate(); - if(!empty($date)){ - $output.=$level." DATE ".$date."\n"; + if (!empty($date)) { + $output .= $level.' DATE '.$date."\n"; } - + // Plac $plac = $even->getPlac(); - if(!empty($plac)){ + if (!empty($plac)) { $_convert = \PhpGedcom\Writer\Indi\Even\Plac::convert($plac, $level); - $output.=$_convert; + $output .= $_convert; } // $caus; $caus = $even->getCaus(); - if(!empty($caus)){ - $output.=$level." CAUS ".$caus."\n"; + if (!empty($caus)) { + $output .= $level.' CAUS '.$caus."\n"; } // $age; $age = $even->getAge(); - if(!empty($age)){ - $output.=$level." AGE ".$age."\n"; + if (!empty($age)) { + $output .= $level.' AGE '.$age."\n"; } // $addr $addr = $even->getAddr(); - if(!empty($addr)){ + if (!empty($addr)) { $_convert = \PhpGedcom\Writer\Addr::convert($addr, $level); - $output.=$_convert; + $output .= $_convert; } // $phon = array() $phon = $even->getPhon(); - if(!empty($phon) && count($phon) > 0){ - foreach($phon as $item){ + if (!empty($phon) && count($phon) > 0) { + foreach ($phon as $item) { $_convert = \PhpGedcom\Writer\Phon::convert($item, $level); - $output.=$_convert; + $output .= $_convert; } } // $agnc $agnc = $even->getAgnc(); - if(!empty($agnc)){ - $output.=$level." AGNC ".$agnc."\n"; + if (!empty($agnc)) { + $output .= $level.' AGNC '.$agnc."\n"; } // $ref = array(); @@ -94,34 +92,35 @@ public static function convert(\PhpGedcom\Record\Indi\Even &$even, $level = 0) // $obje = array(); $obje = $even->getObje(); - if(!empty($obje) && count($obje) > 0){ - foreach($obje as $item){ + if (!empty($obje) && count($obje) > 0) { + foreach ($obje as $item) { $_convert = \PhpGedcom\Writer\ObjeRef::convert($item, $level); - $output.=$_convert; + $output .= $_convert; } } // $sour = array(); $sour = $even->getSour(); - if(!empty($sour) && count($sour) > 0){ - foreach($sour as $item){ + if (!empty($sour) && count($sour) > 0) { + foreach ($sour as $item) { $_convert = \PhpGedcom\Writer\SourRef::convert($item, $level); - $output.=$_convert; + $output .= $_convert; } } // $note = array(); $note = $even->getSour(); - if(!empty($note) && count($note) > 0){ - foreach($note as $item){ + if (!empty($note) && count($note) > 0) { + foreach ($note as $item) { $_convert = \PhpGedcom\Writer\NoteRef::convert($item, $level); - $output.=$_convert; + $output .= $_convert; } } // Record\Chan $chan = $even->getChan(); - if(!empty($chan) ){ + if (!empty($chan)) { $_convert = \PhpGedcom\Writer\Chan::convert($item, $level); - $output.=$_convert; + $output .= $_convert; } + return $output; } } diff --git a/library/PhpGedcom/Writer/Indi/Even/Plac.php b/library/PhpGedcom/Writer/Indi/Even/Plac.php index 214de658..5d74dc26 100644 --- a/library/PhpGedcom/Writer/Indi/Even/Plac.php +++ b/library/PhpGedcom/Writer/Indi/Even/Plac.php @@ -1,27 +1,25 @@ * @copyright Copyright (c) 2010-2013, Xiang Ming - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Writer\Indi\Even; -/** - * - */ class Plac { /** * @param \PhpGedcom\Record\Indi\Even\Plac $plac - * @param int $level + * @param int $level + * * @return string */ public static function convert(\PhpGedcom\Record\Indi\Even\Plac &$plac, $level = 0) @@ -30,9 +28,9 @@ public static function convert(\PhpGedcom\Record\Indi\Even\Plac &$plac, $level = // $plac $_plac = $plac->getPlac(); - if(!empty($_plac)){ - $output .= $level." PLAC ".$_plac."\n"; - }else{ + if (!empty($_plac)) { + $output .= $level.' PLAC '.$_plac."\n"; + } else { $output .= $level." PLAC\n"; } @@ -41,26 +39,27 @@ public static function convert(\PhpGedcom\Record\Indi\Even\Plac &$plac, $level = // $form $form = $plac->getForm(); - if(!empty($form)){ - $output .= $level." FORM ".$form."\n"; + if (!empty($form)) { + $output .= $level.' FORM '.$form."\n"; } // $note -array $note = $plac->getNote(); - if($note && count($note) > 0){ - foreach($note as $item){ + if ($note && count($note) > 0) { + foreach ($note as $item) { $_convert = \PhpGedcom\Writer\NoteRef::convert($item, $level); - $output.= $_convert; + $output .= $_convert; } } // $sour -array $sour = $plac->getSour(); - if($sour && count($sour) > 0){ - foreach($sour as $item){ + if ($sour && count($sour) > 0) { + foreach ($sour as $item) { $_convert = \PhpGedcom\Writer\SourRef::convert($item, $level); - $output.= $_convert; + $output .= $_convert; } } + return $output; } } diff --git a/library/PhpGedcom/Writer/Indi/Famc.php b/library/PhpGedcom/Writer/Indi/Famc.php index f4daec9e..9d67421b 100644 --- a/library/PhpGedcom/Writer/Indi/Famc.php +++ b/library/PhpGedcom/Writer/Indi/Famc.php @@ -1,27 +1,25 @@ * @copyright Copyright (c) 2010-2013, Xiang Ming - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Writer\Indi; -/** - * - */ class Famc { /** * @param \PhpGedcom\Record\Indi\Famc $attr - * @param int $level + * @param int $level + * * @return string */ public static function convert(\PhpGedcom\Record\Indi\Famc &$famc, $level = 0) @@ -29,25 +27,25 @@ public static function convert(\PhpGedcom\Record\Indi\Famc &$famc, $level = 0) $output = ''; // NAME $_famc = $famc->getFams(); - if(empty($_fams)){ + if (empty($_fams)) { return $output; } - $output.= $level." FAMC @".$_famc."@\n"; + $output .= $level.' FAMC @'.$_famc."@\n"; // level up $level++; - + // PEDI $pedi = $famc->getPedi(); - if(!empty($pedi)){ - $output.=$level." PEDI ".$pedi."\n"; + if (!empty($pedi)) { + $output .= $level.' PEDI '.$pedi."\n"; } - + // note $note = $famc->getSour(); - if(!empty($note) && count($note) > 0){ - foreach($note as $item){ + if (!empty($note) && count($note) > 0) { + foreach ($note as $item) { $_convert = \PhpGedcom\Writer\NoteRef::convert($item, $level); - $output.=$_convert; + $output .= $_convert; } } diff --git a/library/PhpGedcom/Writer/Indi/Fams.php b/library/PhpGedcom/Writer/Indi/Fams.php index 5454c717..3a29b758 100644 --- a/library/PhpGedcom/Writer/Indi/Fams.php +++ b/library/PhpGedcom/Writer/Indi/Fams.php @@ -1,27 +1,25 @@ * @copyright Copyright (c) 2010-2013, Xiang Ming - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Writer\Indi; -/** - * - */ class Fams { /** * @param \PhpGedcom\Record\Indi\Fams $attr - * @param int $level + * @param int $level + * * @return string */ public static function convert(\PhpGedcom\Record\Indi\Fams &$fams, $level = 0) @@ -29,19 +27,19 @@ public static function convert(\PhpGedcom\Record\Indi\Fams &$fams, $level = 0) $output = ''; // NAME $_fams = $fams->getFams(); - if(empty($_fams)){ + if (empty($_fams)) { return $output; } - $output.= $level." FAMS @".$_fams."@\n"; + $output .= $level.' FAMS @'.$_fams."@\n"; // level up $level++; - + // note $note = $fams->getNote(); - if(!empty($note) && count($note) > 0){ - foreach($note as $item){ + if (!empty($note) && count($note) > 0) { + foreach ($note as $item) { $_convert = \PhpGedcom\Writer\NoteRef::convert($item, $level); - $output.=$_convert; + $output .= $_convert; } } diff --git a/library/PhpGedcom/Writer/Indi/Name.php b/library/PhpGedcom/Writer/Indi/Name.php index b5dae323..e9c6af1f 100644 --- a/library/PhpGedcom/Writer/Indi/Name.php +++ b/library/PhpGedcom/Writer/Indi/Name.php @@ -1,27 +1,25 @@ * @copyright Copyright (c) 2010-2013, Xiang Ming - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Writer\Indi; -/** - * - */ class Name { /** * @param \PhpGedcom\Record\Indi\Name $attr - * @param int $level + * @param int $level + * * @return string */ public static function convert(\PhpGedcom\Record\Indi\Name &$name, $level = 0) @@ -29,58 +27,58 @@ public static function convert(\PhpGedcom\Record\Indi\Name &$name, $level = 0) $output = ''; // NAME $_name = $name->getName(); - if(empty($_name)){ + if (empty($_name)) { return $output; } - $output.= $level." NAME ".$_name."\n"; + $output .= $level.' NAME '.$_name."\n"; // level up $level++; - + // NPFX $npfx = $name->getNpfx(); - if(!empty($npfx)){ - $output.=$level." NPFX ".$npfx."\n"; + if (!empty($npfx)) { + $output .= $level.' NPFX '.$npfx."\n"; } // GIVN $givn = $name->getGivn(); - if(!empty($givn)){ - $output.=$level." GIVN ".$givn."\n"; + if (!empty($givn)) { + $output .= $level.' GIVN '.$givn."\n"; } // NICK $nick = $name->getNick(); - if(!empty($nick)){ - $output.=$level." NICK ".$nick."\n"; + if (!empty($nick)) { + $output .= $level.' NICK '.$nick."\n"; } // SPFX $spfx = $name->getSpfx(); - if(!empty($spfx)){ - $output.=$level." SPFX ".$spfx."\n"; + if (!empty($spfx)) { + $output .= $level.' SPFX '.$spfx."\n"; } // SURN $surn = $name->getSurn(); - if(!empty($surn)){ - $output.=$level." SURN ".$surn."\n"; + if (!empty($surn)) { + $output .= $level.' SURN '.$surn."\n"; } // NSFX $nsfx = $name->getNsfx(); - if(!empty($nsfx)){ - $output.=$level." NSFX ".$nsfx."\n"; + if (!empty($nsfx)) { + $output .= $level.' NSFX '.$nsfx."\n"; } // SOUR $sour = $name->getSour(); - if(!empty($sour) && count($sour) > 0){ - foreach($sour as $item){ + if (!empty($sour) && count($sour) > 0) { + foreach ($sour as $item) { $_convert = \PhpGedcom\Writer\SourRef::convert($item, $level); - $output.=$_convert; + $output .= $_convert; } } // note $note = $name->getSour(); - if(!empty($note) && count($note) > 0){ - foreach($note as $item){ + if (!empty($note) && count($note) > 0) { + foreach ($note as $item) { $_convert = \PhpGedcom\Writer\NoteRef::convert($item, $level); - $output.=$_convert; + $output .= $_convert; } } diff --git a/library/PhpGedcom/Writer/Note.php b/library/PhpGedcom/Writer/Note.php index 71298a49..f01a8119 100644 --- a/library/PhpGedcom/Writer/Note.php +++ b/library/PhpGedcom/Writer/Note.php @@ -1,78 +1,76 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Writer; -/** - * - */ class Note { /** * @param \PhpGedcom\Record\Note $sour - * @param int $level + * @param int $level + * * @return string */ public static function convert(\PhpGedcom\Record\Note &$note) { $level = 0; - $output = ""; + $output = ''; $id = $note->getId(); - if(!empty($id)){ - $output.= $level." ".$id." "." NOTE \n"; - }else{ + if (!empty($id)) { + $output .= $level.' '.$id.' '." NOTE \n"; + } else { return $output; } - + // Level Up $level++; // RIN $rin = $note->getRin(); - if($rin){ - $output.=$level." RIN ".$rin."\n"; + if ($rin) { + $output .= $level.' RIN '.$rin."\n"; } // cont $cont = $note->getNote(); - if($cont){ - $output.=$level." CONT ".$cont."\n"; + if ($cont) { + $output .= $level.' CONT '.$cont."\n"; } // REFN $refn = $note->getRefn(); - if(!empty($refn) && count($refn) > 0) { - foreach($refn as $item){ - if($item){ + if (!empty($refn) && count($refn) > 0) { + foreach ($refn as $item) { + if ($item) { $_convert = \PhpGedcom\Writer\Refn::convert($item, $level); - $output.=$_convert; + $output .= $_convert; } } } // CHAN $chan = $note->getChan(); - if($chan){ + if ($chan) { $_convert = \PhpGedcom\Writer\Chan::convert($chan, $level); - $output.=$_convert; + $output .= $_convert; } // SOUR array $sour = $note->getSour(); - if(!empty($sour) && count($sour) > 0) { - foreach($sour as $item){ - if($item){ + if (!empty($sour) && count($sour) > 0) { + foreach ($sour as $item) { + if ($item) { $_convert = \PhpGedcom\Writer\SourRef::convert($item, $level); - $output.=$_convert; + $output .= $_convert; } } } diff --git a/library/PhpGedcom/Writer/NoteRef.php b/library/PhpGedcom/Writer/NoteRef.php index 508c64e5..40825a45 100644 --- a/library/PhpGedcom/Writer/NoteRef.php +++ b/library/PhpGedcom/Writer/NoteRef.php @@ -1,48 +1,47 @@ * @copyright Copyright (c) 2010-2013, Xiang Ming - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Writer; -/** - * - */ class NoteRef { /** * @param \PhpGedcom\Record\NoteRef $note - * @param int $level + * @param int $level + * * @return string */ public static function convert(\PhpGedcom\Record\NoteRef &$note, $level) { - $output = ""; + $output = ''; // $_note $_note = $note->getNote(); - if(!empty($_note)){ - $output.=$level." NOTE ".$_note."\n"; + if (!empty($_note)) { + $output .= $level.' NOTE '.$_note."\n"; } $level++; // $sour $sour = $note->getSour(); - if($sour && count($sour) > 0){ - foreach($sour as $item){ + if ($sour && count($sour) > 0) { + foreach ($sour as $item) { $_convert = \PhpGedcom\Writer\SourRef::convert($item, $level); - $output.=$_convert; + $output .= $_convert; } } + return $output; } } diff --git a/library/PhpGedcom/Writer/Obje.php b/library/PhpGedcom/Writer/Obje.php index 940e700f..d26adc2c 100644 --- a/library/PhpGedcom/Writer/Obje.php +++ b/library/PhpGedcom/Writer/Obje.php @@ -1,37 +1,35 @@ * @copyright Copyright (c) 2010-2013, Xiang Ming - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Writer; -/** - * - */ class Obje { /** * @param \PhpGedcom\Record\Obje $sour - * @param int $level + * @param int $level + * * @return string */ public static function convert(\PhpGedcom\Record\Obje &$obje) { $level = 0; - $output = ""; + $output = ''; $id = $obje->getId(); - if($id){ - $output.=$level." ".$id." OBJE\n"; - }else{ + if ($id) { + $output .= $level.' '.$id." OBJE\n"; + } else { return $output; } @@ -40,67 +38,67 @@ public static function convert(\PhpGedcom\Record\Obje &$obje) // FORM $form = $obje->getName(); - if($form){ - $output.=$level." FORM ".$form."\n"; + if ($form) { + $output .= $level.' FORM '.$form."\n"; } // TITL $titl = $obje->getTitl(); - if($titl){ - $output.=$level." TITL ".$titl."\n"; + if ($titl) { + $output .= $level.' TITL '.$titl."\n"; } - // OBJE + // OBJE // This is same as FORM // RIN $rin = $obje->getRin(); - if($rin){ - $output.=$level." RIN ".$rin."\n"; + if ($rin) { + $output .= $level.' RIN '.$rin."\n"; } // REFN $refn = $obje->getRefn(); - if(!empty($refn) && count($refn) > 0) { - foreach($refn as $item){ - if($item){ + if (!empty($refn) && count($refn) > 0) { + foreach ($refn as $item) { + if ($item) { $_convert = \PhpGedcom\Writer\Refn::convert($item, $level); - $output.=$_convert; + $output .= $_convert; } } } // BLOB $blob = $obje->getBlob(); - if($blob){ - $output.=$level." BLOB ".$blob."\n"; + if ($blob) { + $output .= $level.' BLOB '.$blob."\n"; } // NOTE $note = $obje->getNote(); - if($note && count($note) > 0) { - foreach($note as $item){ - if($item){ + if ($note && count($note) > 0) { + foreach ($note as $item) { + if ($item) { $_convert = \PhpGedcom\Writer\NoteRef::convert($item, $level); - $output.=$_convert; + $output .= $_convert; } } } // CHAN $chan = $obje->getChan(); - if($chan){ + if ($chan) { $_convert = \PhpGedcom\Writer\Chan::convert($chan, $level); - $output.=$_convert; + $output .= $_convert; } // FILE $file = $obje->getFile(); - if($file){ - $output.=$level." FILE ".$file."\n"; + if ($file) { + $output .= $level.' FILE '.$file."\n"; } - // + // return $output; } } diff --git a/library/PhpGedcom/Writer/ObjeRef.php b/library/PhpGedcom/Writer/ObjeRef.php index e919dfe5..4d8b20de 100644 --- a/library/PhpGedcom/Writer/ObjeRef.php +++ b/library/PhpGedcom/Writer/ObjeRef.php @@ -1,68 +1,67 @@ * @copyright Copyright (c) 2010-2013, Xiang Ming - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Writer; -/** - * - */ class ObjeRef { /** * @param \PhpGedcom\Record\ObjeRef $note - * @param int $level + * @param int $level + * * @return string */ public static function convert(\PhpGedcom\Record\ObjeRef &$obje, $level) { - $output = ""; + $output = ''; // $_note $_obje = $obje->getObje(); - if(!empty($_note)){ - $output.=$level." OBJE ".$_obje."\n"; - }else{ - $output.=$level." OBJE \n"; + if (!empty($_note)) { + $output .= $level.' OBJE '.$_obje."\n"; + } else { + $output .= $level." OBJE \n"; } $level++; // _form $_form = $obje->getForm(); - if(!empty($_form)){ - $output.=$level." FORM ".$_form."\n"; + if (!empty($_form)) { + $output .= $level.' FORM '.$_form."\n"; } // _titl $_titl = $obje->getTitl(); - if(!empty($_titl)){ - $output.=$level." TITL ".$_titl."\n"; + if (!empty($_titl)) { + $output .= $level.' TITL '.$_titl."\n"; } // _file $_file = $obje->getFile(); - if(!empty($_file)){ - $output.=$level." FILE ".$_file."\n"; + if (!empty($_file)) { + $output .= $level.' FILE '.$_file."\n"; } // $_note = array() $_note = $obje->getNote(); - if(!empty($_note) && count($_note) > 0){ - foreach($_note as $item){ + if (!empty($_note) && count($_note) > 0) { + foreach ($_note as $item) { $_convert = \PhpGedcom\Writer\NoteRef::convert($item, $level); - $output.=$_convert; + $output .= $_convert; } } + return $output; } } diff --git a/library/PhpGedcom/Writer/Phon.php b/library/PhpGedcom/Writer/Phon.php index f731234d..fcd60c63 100644 --- a/library/PhpGedcom/Writer/Phon.php +++ b/library/PhpGedcom/Writer/Phon.php @@ -1,34 +1,32 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Writer; -/** - * - */ class Phon { /** * @param string $phon * @param string $format - * @param int $level + * @param int $level + * * @return string */ public static function convert($phon, $level = 1) { - $output = "{$level} PHON " . $phon . "\n"; - + $output = "{$level} PHON ".$phon."\n"; + return $output; } } diff --git a/library/PhpGedcom/Writer/Refn.php b/library/PhpGedcom/Writer/Refn.php index 299f8099..8eeed6f4 100644 --- a/library/PhpGedcom/Writer/Refn.php +++ b/library/PhpGedcom/Writer/Refn.php @@ -1,47 +1,44 @@ * @copyright Copyright (c) 2010-2013, Xiang Ming - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Writer; -/** - * - */ class Refn { /** * @param \PhpGedcom\Record\Refn $note - * @param int $level + * @param int $level + * * @return string */ public static function convert(\PhpGedcom\Record\Refn &$refn, $level) { - - $output = ""; + $output = ''; $_refn = $refn->getRefn(); - if(empty($_refn)){ + if (empty($_refn)) { return $output; - }else{ - $output.=$level." REFN ".$_refn."\n"; + } else { + $output .= $level.' REFN '.$_refn."\n"; } // level up $level++; // DATE $type = $refn->getType(); - if(!empty($type)){ - $output.=$level." TYPE ".$type."\n"; + if (!empty($type)) { + $output .= $level.' TYPE '.$type."\n"; } - + return $output; } } diff --git a/library/PhpGedcom/Writer/Repo.php b/library/PhpGedcom/Writer/Repo.php index 66d274d9..6a9797e1 100644 --- a/library/PhpGedcom/Writer/Repo.php +++ b/library/PhpGedcom/Writer/Repo.php @@ -1,37 +1,35 @@ * @copyright Copyright (c) 2010-2013, Xiang Ming - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Writer; -/** - * - */ class Repo { /** * @param \PhpGedcom\Record\Repo $sour - * @param int $level + * @param int $level + * * @return string */ public static function convert(\PhpGedcom\Record\Repo &$repo) { $level = 0; - $output = ""; + $output = ''; $_repo = $repo->getRepo(); - if($_repo){ - $output.=$level." ".$_repo." REPO\n"; - }else{ + if ($_repo) { + $output .= $level.' '.$_repo." REPO\n"; + } else { return $output; } @@ -40,58 +38,59 @@ public static function convert(\PhpGedcom\Record\Repo &$repo) //NAME $name = $repo->getName(); - if($name){ - $output.=$level." NAME ".$name."\n"; + if ($name) { + $output .= $level.' NAME '.$name."\n"; } - // ADDR + // ADDR $addr = $repo->getAddr(); - if($addr){ + if ($addr) { $_convert = \PhpGedcom\Writer\Addr::convert($addr, $level); - $output.=$_convert; + $output .= $_convert; } // PHON $phon = $repo->getPhon(); - if($phon){ + if ($phon) { $_convert = \PhpGedcom\Writer\Phon::convert($phon, $level); - $output.=$_convert; + $output .= $_convert; } // NOTE array $note = $repo->getNote(); - if($note && count($note) > 0) { - foreach($note as $item){ - if($item){ + if ($note && count($note) > 0) { + foreach ($note as $item) { + if ($item) { $_convert = \PhpGedcom\Writer\NoteRef::convert($item, $level); - $output.=$_convert; + $output .= $_convert; } } } // REFN $refn = $repo->getRefn(); - if(!empty($refn) && count($refn) > 0) { - foreach($refn as $item){ - if($item){ + if (!empty($refn) && count($refn) > 0) { + foreach ($refn as $item) { + if ($item) { $_convert = \PhpGedcom\Writer\Refn::convert($item, $level); - $output.=$_convert; + $output .= $_convert; } } } // CHAN $chan = $repo->getChan(); - if($chan){ + if ($chan) { $_convert = \PhpGedcom\Writer\Chan::convert($chan, $level); - $output.=$_convert; + $output .= $_convert; } // RIN $rin = $repo->getRin(); - if($rin){ - $output.=$level." RIN ".$rin."\n"; + if ($rin) { + $output .= $level.' RIN '.$rin."\n"; } + return $output; } } diff --git a/library/PhpGedcom/Writer/RepoRef.php b/library/PhpGedcom/Writer/RepoRef.php index 794a6962..cba8c1c2 100644 --- a/library/PhpGedcom/Writer/RepoRef.php +++ b/library/PhpGedcom/Writer/RepoRef.php @@ -1,57 +1,54 @@ * @copyright Copyright (c) 2010-2013, Xiang Ming - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Writer; -/** - * - */ class RepoRef { /** * @param \PhpGedcom\Record\RepoRef $reporef - * @param int $level + * @param int $level + * * @return string */ public static function convert(\PhpGedcom\Record\RepoRef &$reporef, $level) { - - $output = ""; + $output = ''; $_repo = $reporef->getRepo(); - if(empty($_sour)){ + if (empty($_sour)) { return $output; - }else{ - $output.=$level." REPO ".$_repo."\n"; + } else { + $output .= $level.' REPO '.$_repo."\n"; } // level up $level++; - // Note array + // Note array $note = $reporef->getNote(); - if(!empty($note) && count($note) > 0){ - foreach($note as $item){ + if (!empty($note) && count($note) > 0) { + foreach ($note as $item) { $_convert = \PhpGedcom\Writer\NoteRef::convert($item, $level); - $output.=$_convert; + $output .= $_convert; } } - // _caln array + // _caln array $_caln = $reporef->getCaln(); - if(!empty($_caln) && count($_caln) > 0){ - foreach($_caln as $item){ + if (!empty($_caln) && count($_caln) > 0) { + foreach ($_caln as $item) { $_convert = \PhpGedcom\Writer\Caln::convert($item, $level); - $output.=$_convert; + $output .= $_convert; } } diff --git a/library/PhpGedcom/Writer/Sour.php b/library/PhpGedcom/Writer/Sour.php index 880468c7..b4e851c5 100644 --- a/library/PhpGedcom/Writer/Sour.php +++ b/library/PhpGedcom/Writer/Sour.php @@ -1,125 +1,123 @@ * @copyright Copyright (c) 2010-2013, Xiang Ming - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Writer; -/** - * - */ class Sour { /** * @param \PhpGedcom\Record\Sour $sour - * @param int $level + * @param int $level + * * @return string */ public static function convert(\PhpGedcom\Record\Sour &$sour, $level) { - - $output = ""; + $output = ''; $_sour = $sour->getSour(); - if(empty($_sour)){ + if (empty($_sour)) { return $output; - }else{ - $output.=$level." ".$_sour." SOUR "."\n"; + } else { + $output .= $level.' '.$_sour.' SOUR '."\n"; } // level up $level++; // TITL $titl = $sour->getType(); - if(!empty($type)){ - $output.=$level." TITL ".$titl."\n"; + if (!empty($type)) { + $output .= $level.' TITL '.$titl."\n"; } - + // RIN $rin = $sour->getRin(); - if(!empty($rin)){ - $output.=$level." RIN ".$rin."\n"; + if (!empty($rin)) { + $output .= $level.' RIN '.$rin."\n"; } // AUTH $auth = $sour->getAuth(); - if(!empty($auth)){ - $output.=$level." AUTH ".$auth."\n"; + if (!empty($auth)) { + $output .= $level.' AUTH '.$auth."\n"; } // TEXT $text = $sour->getText(); - if(!empty($text)){ - $output.=$level." TEXT ".$text."\n"; + if (!empty($text)) { + $output .= $level.' TEXT '.$text."\n"; } // PUBL $publ = $sour->getPubl(); - if(!empty($publ)){ - $output.=$level." PUBL ".$publ."\n"; + if (!empty($publ)) { + $output .= $level.' PUBL '.$publ."\n"; } // ABBR $abbr = $sour->getAbbr(); - if(!empty($abbr)){ - $output.=$level." ABBR ".$abbr."\n"; + if (!empty($abbr)) { + $output .= $level.' ABBR '.$abbr."\n"; } - // REPO + // REPO $repo = $sour->getRepo(); - if(!empty($repo)){ + if (!empty($repo)) { $_convert = \PhpGedcom\Writer\RepoRef::convert($repo, $level); - $output.=$_convert; + $output .= $_convert; } // NOTE array $note = $sour->getNote(); - if(!empty($note) && count($note) > 0){ - foreach($note as $item){ + if (!empty($note) && count($note) > 0) { + foreach ($note as $item) { $_convert = \PhpGedcom\Writer\NoteRef::convert($item, $level); - $output.=$_convert; + $output .= $_convert; } } // DATA $data = $sour->getData(); - if(!empty($data)){ + if (!empty($data)) { $_convert = \PhpGedcom\Writer\Sour\Data::convert($data, $level); - $output.=$_convert; + $output .= $_convert; } // OBJE array $obje = $sour->getObje(); - if(!empty($obje) && count($obje) > 0){ - foreach($obje as $item){ + if (!empty($obje) && count($obje) > 0) { + foreach ($obje as $item) { $_convert = \PhpGedcom\Writer\ObjeRef::convert($item, $level); - $output.=$_convert; + $output .= $_convert; } } // REFN array $refn = $sour->getRefn(); - if(!empty($refn) && count($refn) > 0){ - foreach($refn as $item){ + if (!empty($refn) && count($refn) > 0) { + foreach ($refn as $item) { $_convert = \PhpGedcom\Writer\Refn::convert($item, $level); - $output.=$_convert; + $output .= $_convert; } } // chan $chan = $sour->getChan(); - if(!empty($chan)){ + if (!empty($chan)) { $_convert = \PhpGedcom\Writer\Chan::convert($chan, $level); - $output.=$_convert; + $output .= $_convert; } + return $output; } } diff --git a/library/PhpGedcom/Writer/Sour/Data.php b/library/PhpGedcom/Writer/Sour/Data.php index 747a6528..720dc3e3 100644 --- a/library/PhpGedcom/Writer/Sour/Data.php +++ b/library/PhpGedcom/Writer/Sour/Data.php @@ -1,72 +1,70 @@ * @copyright Copyright (c) 2010-2013, Xiang Ming - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Writer\Sour; -/** - * - */ class Data { /** * @param \PhpGedcom\Record\Sour\Data $data - * @param int $level + * @param int $level + * * @return string */ public static function convert(\PhpGedcom\Record\Sour\Data &$data, $level = 0) { - $output = ""; + $output = ''; $output = $level." DATA\n"; $level++; // $_date; $date = $data->getDate(); - if(!empty($date)){ - $output.=$level." DATE ".$date."\n"; + if (!empty($date)) { + $output .= $level.' DATE '.$date."\n"; } // $_agnc AGNC $_agnc = $data->getAgnc(); - if(!empty($_agnc)){ - $output.=$level." AGNC ".$_agnc."\n"; + if (!empty($_agnc)) { + $output .= $level.' AGNC '.$_agnc."\n"; } // $_text $_text = $data->getText(); - if(!empty($_text)){ - $output.=$level." TEXT ".$_text."\n"; + if (!empty($_text)) { + $output .= $level.' TEXT '.$_text."\n"; } - + // $_note $note = $data->getNote(); - if($note && count($note) > 0){ - foreach($note as $item){ + if ($note && count($note) > 0) { + foreach ($note as $item) { $_convert = \PhpGedcom\Writer\NoteRef::convert($item, $level); - $output.= $_convert; + $output .= $_convert; } - } - + } + // $_even $_even = $data->getEven(); - if($_even && count($_even) > 0){ - foreach($_even as $item){ + if ($_even && count($_even) > 0) { + foreach ($_even as $item) { $_convert = \PhpGedcom\Writer\Sour\Data\Even::convert($item, $level); - $output.= $_convert; + $output .= $_convert; } - } - + } + return $output; } } diff --git a/library/PhpGedcom/Writer/Sour/Data/Even.php b/library/PhpGedcom/Writer/Sour/Data/Even.php index c4afc8cf..13dc6c48 100644 --- a/library/PhpGedcom/Writer/Sour/Data/Even.php +++ b/library/PhpGedcom/Writer/Sour/Data/Even.php @@ -1,46 +1,44 @@ * @copyright Copyright (c) 2010-2013, Xiang Ming - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Writer\Sour\Data; -/** - * - */ class Even { /** * @param \PhpGedcom\Record\Sour\Data\Even $even - * @param int $level + * @param int $level + * * @return string */ public static function convert(\PhpGedcom\Record\Sour\Data\Even &$even, $level) { - $output = ""; + $output = ''; $output = $level." EVEN\n"; $level++; - + // $date; $date = $even->getDate(); - if(!empty($date)){ - $output.=$level." DATE ".$date."\n"; + if (!empty($date)) { + $output .= $level.' DATE '.$date."\n"; } - + // Plac $plac = $even->getPlac(); - if(!empty($plac)){ - $output.=$level." PLAC ".$plac."\n"; + if (!empty($plac)) { + $output .= $level.' PLAC '.$plac."\n"; } return $output; diff --git a/library/PhpGedcom/Writer/SourRef.php b/library/PhpGedcom/Writer/SourRef.php index f0cfdb56..921030fe 100644 --- a/library/PhpGedcom/Writer/SourRef.php +++ b/library/PhpGedcom/Writer/SourRef.php @@ -1,71 +1,69 @@ * @copyright Copyright (c) 2010-2013, Xiang Ming - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Writer; -/** - * - */ class SourRef { /** * @param \PhpGedcom\Record\SourRef $sour - * @param int $level + * @param int $level + * * @return string */ public static function convert(\PhpGedcom\Record\SourRef &$sour, $level) { - $output = ""; + $output = ''; $_sour = $sour->getSour(); - if(!empty($_sour)){ - $output.=$level." SOUR ".$_sour."\n"; + if (!empty($_sour)) { + $output .= $level.' SOUR '.$_sour."\n"; } $level++; // protected $_text = null; $_text = $sour->getText(); - if(!empty($_text)){ - $output.=$level." TEXT ".$_text."\n"; + if (!empty($_text)) { + $output .= $level.' TEXT '.$_text."\n"; } // protected $_note = array(); $note = $sour->getNote(); - if($note && count($note) > 0){ - foreach($note as $item){ + if ($note && count($note) > 0) { + foreach ($note as $item) { $_convert = \PhpGedcom\Writer\NoteRef::convert($item, $level); - $output.= $_convert; + $output .= $_convert; } } // protected $_data = null; $_data = $sour->getData(); - if($_data){ + if ($_data) { $_convert = \PhpGedcom\Writer\Sour\Data::convert($_data, $level); - $output.= $_convert; + $output .= $_convert; } - // protected $_page setPage + // protected $_page setPage $_page = $sour->getPage(); - if(!empty($_page)){ - $output.=$level." PAGE ".$_page."\n"; + if (!empty($_page)) { + $output .= $level.' PAGE '.$_page."\n"; } // protected $_even = null; $_even = $sour->getData(); - if($_even){ + if ($_even) { $_convert = \PhpGedcom\Writer\SourRef\Even::convert($_even, $level); - $output.= $_convert; + $output .= $_convert; } - // protected $_quay + // protected $_quay $_quay = $sour->getQuay(); - if(!empty($_quay)){ - $output.=$level." QUAY ".$_quay."\n"; + if (!empty($_quay)) { + $output .= $level.' QUAY '.$_quay."\n"; } // protected $_obje = array(); // This is not defined in parser. diff --git a/library/PhpGedcom/Writer/SourRef/Even.php b/library/PhpGedcom/Writer/SourRef/Even.php index af2e282e..a5dc8877 100644 --- a/library/PhpGedcom/Writer/SourRef/Even.php +++ b/library/PhpGedcom/Writer/SourRef/Even.php @@ -1,48 +1,45 @@ * @copyright Copyright (c) 2010-2013, Xiang Ming - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Writer\SourRef; -/** - * - */ -class Even +class Even { /** * @param \PhpGedcom\Record\SourRef\Even $even - * @param int $level + * @param int $level + * * @return string */ public static function convert(\PhpGedcom\Record\SourRef\Even &$even, $level = 0) { - $output = ""; + $output = ''; // $_date; $_even = $even->getEven(); - if(!empty($_even)){ - $output.=$level." EVEN ".$_even."\n"; - }else{ + if (!empty($_even)) { + $output .= $level.' EVEN '.$_even."\n"; + } else { $output = $level." EVEN\n"; } // level up $level++; - // $_role ROLE $_role = $data->getRole(); - if(!empty($_role)){ - $output.=$level." ROLE ".$_role."\n"; + if (!empty($_role)) { + $output .= $level.' ROLE '.$_role."\n"; } return $output; diff --git a/library/PhpGedcom/Writer/Subm.php b/library/PhpGedcom/Writer/Subm.php index fc25bb0b..8a3e0d9b 100644 --- a/library/PhpGedcom/Writer/Subm.php +++ b/library/PhpGedcom/Writer/Subm.php @@ -1,113 +1,111 @@ * @copyright Copyright (c) 2010-2013, Xiang Ming - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Writer; -/** - * - */ class Subm { /** * @param \PhpGedcom\Record\Subm $note - * @param int $level + * @param int $level + * * @return string */ public static function convert(\PhpGedcom\Record\Subm &$subm) { $level = 0; - $output = ""; + $output = ''; $_subm = $subm->getSubn(); - if(empty($_subm)){ + if (empty($_subm)) { return $output; - }else{ - $output.=$level." ".$_subm." SUBM "."\n"; + } else { + $output .= $level.' '.$_subm.' SUBM '."\n"; } // level up $level++; // NAME $name = $subm->getName(); - if(!empty($name)){ - $output.=$level." NAME ".$name."\n"; + if (!empty($name)) { + $output .= $level.' NAME '.$name."\n"; } // $chan $chan = $subm->getChan(); - if($chan){ + if ($chan) { $_convert = \PhpGedcom\Writer\Chan::convert($chan, $level); - $output.=$_convert; + $output .= $_convert; } // $addr $addr = $subm->getAddr(); - if($addr){ + if ($addr) { $_convert = \PhpGedcom\Writer\Addr::convert($addr, $level); - $output.=$_convert; + $output .= $_convert; } // $rin $rin = $subm->getRin(); - if(!empty($rin)){ - $output.=$level." RIN ".$rin."\n"; + if (!empty($rin)) { + $output .= $level.' RIN '.$rin."\n"; } // $rfn $rfn = $subm->getRfn(); - if(!empty($rfn)){ - $output.=$level." RFN ".$rfn."\n"; + if (!empty($rfn)) { + $output .= $level.' RFN '.$rfn."\n"; } // $lang = array() $langs = $subm->getLang(); - if(!empty($langs) && count($langs) > 0){ - foreach($langs as $item){ - if($item){ - $_convert = $level." LANG ".$item."\n"; - $output.=$_convert; + if (!empty($langs) && count($langs) > 0) { + foreach ($langs as $item) { + if ($item) { + $_convert = $level.' LANG '.$item."\n"; + $output .= $_convert; } } } // $phon = array() $phon = $subm->getLang(); - if(!empty($phon) && count($phon) > 0){ - foreach($phon as $item){ - if($item){ + if (!empty($phon) && count($phon) > 0) { + foreach ($phon as $item) { + if ($item) { $_convert = \PhpGedcom\Writer\Phon::convert($item, $level); - $output.= $_convert; + $output .= $_convert; } } } // $obje = array() $obje = $subm->getObje(); - if(!empty($obje) && count($obje) > 0){ - foreach($obje as $item){ + if (!empty($obje) && count($obje) > 0) { + foreach ($obje as $item) { $_convert = \PhpGedcom\Writer\ObjeRef::convert($item, $level); - $output.=$_convert; + $output .= $_convert; } } // note $note = $subm->getNote(); - if(!empty($note) && count($note) > 0){ - foreach($note as $item){ + if (!empty($note) && count($note) > 0) { + foreach ($note as $item) { $_convert = \PhpGedcom\Writer\NoteRef::convert($item, $level); - $output.=$_convert; + $output .= $_convert; } } - + return $output; } } diff --git a/library/PhpGedcom/Writer/Subn.php b/library/PhpGedcom/Writer/Subn.php index 0cd8de08..9aca13af 100644 --- a/library/PhpGedcom/Writer/Subn.php +++ b/library/PhpGedcom/Writer/Subn.php @@ -1,83 +1,81 @@ * @copyright Copyright (c) 2010-2013, Xiang Ming - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ namespace PhpGedcom\Writer; -/** - * - */ class Subn { /** * @param \PhpGedcom\Record\Subn $note - * @param int $level + * @param int $level + * * @return string */ public static function convert(\PhpGedcom\Record\Subn &$subn) { $level = 0; - $output = ""; + $output = ''; $_subn = $subn->getSubn(); - if(empty($_subn)){ + if (empty($_subn)) { return $output; - }else{ - $output.=$level." ".$_subn." SUBN \n"; + } else { + $output .= $level.' '.$_subn." SUBN \n"; } // level up $level++; // SUBM $subm = $subn->getSubm(); - if(!empty($subm)){ - $output.=$level." SUBM ".$subm."\n"; + if (!empty($subm)) { + $output .= $level.' SUBM '.$subm."\n"; } // FAMF $famf = $subn->getFamf(); - if(!empty($famf)){ - $output.=$level." FAMF ".$famf."\n"; + if (!empty($famf)) { + $output .= $level.' FAMF '.$famf."\n"; } // TEMP $temp = $subn->getTemp(); - if(!empty($temp)){ - $output.=$level." TEMP ".$temp."\n"; + if (!empty($temp)) { + $output .= $level.' TEMP '.$temp."\n"; } // ANCE $ance = $subn->getAnce(); - if(!empty($ance)){ - $output.=$level." ANCE ".$ance."\n"; + if (!empty($ance)) { + $output .= $level.' ANCE '.$ance."\n"; } - + // DESC $desc = $subn->getDesc(); - if(!empty($desc)){ - $output.=$level." DESC ".$desc."\n"; + if (!empty($desc)) { + $output .= $level.' DESC '.$desc."\n"; } // ORDI $ordi = $subn->getOrdi(); - if(!empty($ordi)){ - $output.=$level." ORDI ".$ordi."\n"; + if (!empty($ordi)) { + $output .= $level.' ORDI '.$ordi."\n"; } // RIN $rin = $subn->getRin(); - if(!empty($rin)){ - $output.=$level." RIN ".$rin."\n"; + if (!empty($rin)) { + $output .= $level.' RIN '.$rin."\n"; } - + return $output; } } diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 52f1b878..ebebc8e2 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -1,10 +1,10 @@ parse($sample); diff --git a/tests/issue/Issue00017Test.php b/tests/issue/Issue00017Test.php index 369f126b..3eb9e001 100644 --- a/tests/issue/Issue00017Test.php +++ b/tests/issue/Issue00017Test.php @@ -5,8 +5,7 @@ use PhpGedcom\Parser; /** - * Class Issue00017Test - * @package PhpGedcomTest + * Class Issue00017Test. */ class Issue00017Test extends \PHPUnit_Framework_TestCase { @@ -15,7 +14,7 @@ class Issue00017Test extends \PHPUnit_Framework_TestCase */ public function testEmptyFamc() { - $sample = realpath(__DIR__ . '/files/issue00017.ged'); + $sample = realpath(__DIR__.'/files/issue00017.ged'); $parser = new Parser(); $gedcom = $parser->parse($sample); diff --git a/tests/issue/Issue00018Test.php b/tests/issue/Issue00018Test.php index 5e5c6159..6fd90448 100644 --- a/tests/issue/Issue00018Test.php +++ b/tests/issue/Issue00018Test.php @@ -5,8 +5,7 @@ use PhpGedcom\Parser; /** - * Class Issue00018Test - * @package PhpGedcomTest + * Class Issue00018Test. */ class Issue00018Test extends \PHPUnit_Framework_TestCase { @@ -15,7 +14,7 @@ class Issue00018Test extends \PHPUnit_Framework_TestCase */ public function testEmptyNote() { - $sample = realpath(__DIR__ . '/files/issue00018.ged'); + $sample = realpath(__DIR__.'/files/issue00018.ged'); $parser = new Parser(); $gedcom = $parser->parse($sample); diff --git a/tests/library/Gedcom/ParserTest.php b/tests/library/Gedcom/ParserTest.php index 2776d5f5..4edc3aaa 100644 --- a/tests/library/Gedcom/ParserTest.php +++ b/tests/library/Gedcom/ParserTest.php @@ -1,14 +1,14 @@ * @copyright Copyright (c) 2010-2013, Kristopher Wilson - * @package php-gedcom * @license MIT + * * @link http://github.com/mrkrstphr/php-gedcom */ @@ -17,41 +17,31 @@ use PhpGedcom\Parser; /** - * Class ParserTest - * @package PhpGedcomTest + * Class ParserTest. */ class ParserTest extends \PHPUnit_Framework_TestCase { /** * @var \PhpGedcom\Parser */ - protected $parser = null; - + protected $parser = null; + /** * @var \PhpGedcom\Gedcom */ - protected $gedcom = null; - - /** - * - */ + protected $gedcom = null; + public function setUp() { $this->parser = new Parser(); - $this->gedcom = $this->parser->parse(TEST_DIR . '/stresstestfiles/TGC551LF.ged'); + $this->gedcom = $this->parser->parse(TEST_DIR.'/stresstestfiles/TGC551LF.ged'); } - /** - * - */ public function testNoErrors() { $this->assertEquals(1, count($this->parser->getErrors())); } - /** - * - */ public function testRecordCounts() { $this->assertEquals(count($this->gedcom->getIndi()), 15); @@ -62,9 +52,6 @@ public function testRecordCounts() $this->assertEquals(count($this->gedcom->getRepo()), 1); } - /** - * - */ public function testHead() { $head = $this->gedcom->getHead(); @@ -114,9 +101,6 @@ public function testHead() $this->assertEquals($head->getSubn(), 'SUBMISSION'); } - /** - * - */ public function testSubn() { $subn = $this->gedcom->getSubn(); @@ -131,9 +115,6 @@ public function testSubn() $this->assertEquals($subn->getRin(), '1'); } - /** - * - */ public function testSubm() { $subm = $this->gedcom->getSubm(); @@ -142,10 +123,10 @@ public function testSubm() $this->assertEquals($subm['SUBMITTER']->getName(), 'John A. Nairn'); $this->assertEquals( $subm['SUBMITTER']->getAddr()->getAddr(), - "Submitter address line 1\n" . - "Submitter address line 2\n" . - "Submitter address line 3\n" . - "Submitter address line 4" + "Submitter address line 1\n". + "Submitter address line 2\n". + "Submitter address line 3\n". + 'Submitter address line 4' ); $this->assertEquals($subm['SUBMITTER']->getAddr()->getAdr1(), 'Submitter address line 1'); @@ -175,13 +156,12 @@ public function testSubm() $note = current($obje->getNote()); $this->assertEquals($note->getNote(), 'N1'); - $this->assertEquals($subm['SM2']->getSubm(), 'SM2'); $this->assertEquals($subm['SM2']->getName(), 'Secondary Submitter'); $this->assertEquals( $subm['SM2']->getAddr()->getAddr(), - "Secondary Submitter Address 1\n" . - "Secondary Submitter Address 2" + "Secondary Submitter Address 1\n". + 'Secondary Submitter Address 2' ); $lang = $subm['SM2']->getLang(); @@ -190,54 +170,34 @@ public function testSubm() $this->assertEquals($subm['SM2']->getChan()->getTime(), '10:38:33'); $this->assertEquals($subm['SM2']->getRin(), '2'); - $this->assertEquals($subm['SM3']->getSubm(), 'SM3'); $this->assertEquals($subm['SM3']->getName(), 'H. Eichmann'); $this->assertEquals( $subm['SM3']->getAddr()->getAddr(), - "email: h.eichmann@@mbox.iqo.uni-hannover.de\n" . - "or: heiner_eichmann@@h.maus.de (no more than 16k!!!!)" + "email: h.eichmann@@mbox.iqo.uni-hannover.de\n". + 'or: heiner_eichmann@@h.maus.de (no more than 16k!!!!)' ); $this->assertEquals($subm['SM3']->getChan()->getDate(), '13 Jun 2000'); $this->assertEquals($subm['SM3']->getChan()->getTime(), '17:07:32'); $this->assertEquals($subm['SM3']->getRin(), '3'); } - /** - * - */ public function testIndi() { - } - /** - * - */ public function testFam() { - } - /** - * - */ public function testObje() { - } - /** - * - */ public function testRepo() { - } - /** - * - */ public function testSour() { $sour = $this->gedcom->getSour(); @@ -253,9 +213,6 @@ public function testSour() $this->assertEquals($secondSource->getRin(), '2'); } - /** - * - */ public function testNote() { $firstNote = current($this->gedcom->getNote());