familytree365 /
php-gedcom
| 1 | <?php |
||||
| 2 | |||||
| 3 | /** |
||||
| 4 | * php-gedcom. |
||||
| 5 | * |
||||
| 6 | * php-gedcom is a library for parsing, manipulating, importing and exporting |
||||
| 7 | * GEDCOM 5.5 files in PHP 5.3+. |
||||
| 8 | * |
||||
| 9 | * @author Kristopher Wilson <[email protected]> |
||||
| 10 | * @copyright Copyright (c) 2010-2013, Kristopher Wilson |
||||
| 11 | * @license MIT |
||||
| 12 | * |
||||
| 13 | * @link http://github.com/mrkrstphr/php-gedcom |
||||
| 14 | */ |
||||
| 15 | |||||
| 16 | namespace Gedcom; |
||||
| 17 | |||||
| 18 | /** |
||||
| 19 | * Class Gedcom. |
||||
| 20 | */ |
||||
| 21 | class Gedcom |
||||
| 22 | { |
||||
| 23 | /** |
||||
| 24 | * Stores the header information of the GEDCOM file. |
||||
| 25 | * |
||||
| 26 | * @var \Gedcom\Record\Head |
||||
| 27 | */ |
||||
| 28 | protected $head; |
||||
| 29 | |||||
| 30 | /** |
||||
| 31 | * Stores the submission information for the GEDCOM file. |
||||
| 32 | * |
||||
| 33 | * @var \Gedcom\Record\Subn |
||||
| 34 | */ |
||||
| 35 | protected $subn; |
||||
| 36 | |||||
| 37 | /** |
||||
| 38 | * Stores sources cited throughout the GEDCOM file. |
||||
| 39 | * |
||||
| 40 | * @var \Gedcom\Record\Sour[] |
||||
| 41 | */ |
||||
| 42 | protected $sour = []; |
||||
| 43 | |||||
| 44 | /** |
||||
| 45 | * Stores all the individuals contained within the GEDCOM file. |
||||
| 46 | * |
||||
| 47 | * @var \Gedcom\Record\Indi[] |
||||
| 48 | */ |
||||
| 49 | protected $indi = []; |
||||
| 50 | |||||
| 51 | /** |
||||
| 52 | * Stores all the individuals contained within the GEDCOM file. |
||||
| 53 | * |
||||
| 54 | * @var array |
||||
| 55 | */ |
||||
| 56 | protected $uid2indi = []; |
||||
| 57 | |||||
| 58 | /** |
||||
| 59 | * Stores all the families contained within the GEDCOM file. |
||||
| 60 | * |
||||
| 61 | * @var \Gedcom\Record\Fam[] |
||||
| 62 | */ |
||||
| 63 | protected $fam = []; |
||||
| 64 | |||||
| 65 | /** |
||||
| 66 | * Stores all the notes contained within the GEDCOM file that are not inline. |
||||
| 67 | * |
||||
| 68 | * @var \Gedcom\Record\Note[] |
||||
| 69 | */ |
||||
| 70 | protected $note = []; |
||||
| 71 | |||||
| 72 | /** |
||||
| 73 | * Stores all repositories that are contained within the GEDCOM file and referenced by sources. |
||||
| 74 | * |
||||
| 75 | * @var \Gedcom\Record\Repo[] |
||||
| 76 | */ |
||||
| 77 | protected $repo = []; |
||||
| 78 | |||||
| 79 | /** |
||||
| 80 | * Stores all the media objects that are contained within the GEDCOM file. |
||||
| 81 | * |
||||
| 82 | * @var \Gedcom\Record\Obje[] |
||||
| 83 | */ |
||||
| 84 | protected $obje = []; |
||||
| 85 | |||||
| 86 | /** |
||||
| 87 | * Stores information about all the submitters to the GEDCOM file. |
||||
| 88 | * |
||||
| 89 | * @var \Gedcom\Record\Subm[] |
||||
| 90 | */ |
||||
| 91 | protected $subm = []; |
||||
| 92 | |||||
| 93 | /** |
||||
| 94 | * Retrieves the header record of the GEDCOM file. |
||||
| 95 | */ |
||||
| 96 | public function setHead(\Gedcom\Record\Head $head) |
||||
| 97 | { |
||||
| 98 | $this->head = $head; |
||||
| 99 | } |
||||
| 100 | |||||
| 101 | /** |
||||
| 102 | * Retrieves the submission record of the GEDCOM file. |
||||
| 103 | */ |
||||
| 104 | public function setSubn(\Gedcom\Record\Subn $subn) |
||||
| 105 | { |
||||
| 106 | $this->subn = $subn; |
||||
| 107 | } |
||||
| 108 | |||||
| 109 | /** |
||||
| 110 | * Adds a source to the collection of sources. |
||||
| 111 | */ |
||||
| 112 | public function addSour(\Gedcom\Record\Sour $sour) |
||||
| 113 | { |
||||
| 114 | $this->sour[$sour->getSour()] = $sour; |
||||
| 115 | } |
||||
| 116 | |||||
| 117 | /** |
||||
| 118 | * Adds an individual to the collection of individuals. |
||||
| 119 | */ |
||||
| 120 | public function addIndi(\Gedcom\Record\Indi $indi) |
||||
| 121 | { |
||||
| 122 | $this->indi[$indi->getId()] = $indi; |
||||
| 123 | if ($indi->getUid()) { |
||||
| 124 | $this->uid2indi[$indi->getUid()] = $indi; |
||||
| 125 | } |
||||
| 126 | } |
||||
| 127 | |||||
| 128 | /** |
||||
| 129 | * Adds a family to the collection of families. |
||||
| 130 | */ |
||||
| 131 | public function addFam(\Gedcom\Record\Fam $fam) |
||||
| 132 | { |
||||
| 133 | $this->fam[$fam->getId()] = $fam; |
||||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||||
| 134 | } |
||||
| 135 | |||||
| 136 | /** |
||||
| 137 | * Adds a note to the collection of notes. |
||||
| 138 | */ |
||||
| 139 | public function addNote(\Gedcom\Record\Note $note) |
||||
| 140 | { |
||||
| 141 | $this->note[$note->getId()] = $note; |
||||
|
0 ignored issues
–
show
The method
getId() does not exist on Gedcom\Record\Note. Since you implemented __call, consider adding a @method annotation.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
| 142 | } |
||||
| 143 | |||||
| 144 | /** |
||||
| 145 | * Adds a repository to the collection of repositories. |
||||
| 146 | */ |
||||
| 147 | public function addRepo(\Gedcom\Record\Repo $repo) |
||||
| 148 | { |
||||
| 149 | $this->repo[$repo->getRepo()] = $repo; |
||||
| 150 | } |
||||
| 151 | |||||
| 152 | /** |
||||
| 153 | * Adds an object to the collection of objects. |
||||
| 154 | */ |
||||
| 155 | public function addObje(\Gedcom\Record\Obje $obje) |
||||
| 156 | { |
||||
| 157 | $this->obje[$obje->getId()] = $obje; |
||||
|
0 ignored issues
–
show
The method
getId() does not exist on Gedcom\Record\Obje. Since you implemented __call, consider adding a @method annotation.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
| 158 | } |
||||
| 159 | |||||
| 160 | /** |
||||
| 161 | * Adds a submitter record to the collection of submitters. |
||||
| 162 | */ |
||||
| 163 | public function addSubm(\Gedcom\Record\Subm $subm) |
||||
| 164 | { |
||||
| 165 | $this->subm[$subm->getSubm()] = $subm; |
||||
| 166 | } |
||||
| 167 | |||||
| 168 | /** |
||||
| 169 | * Gets the header information of the GEDCOM file. |
||||
| 170 | * |
||||
| 171 | * @return \Gedcom\Record\Head |
||||
| 172 | */ |
||||
| 173 | public function getHead() |
||||
| 174 | { |
||||
| 175 | return $this->head; |
||||
| 176 | } |
||||
| 177 | |||||
| 178 | /** |
||||
| 179 | * Gets the submission record of the GEDCOM file. |
||||
| 180 | * |
||||
| 181 | * @return \Gedcom\Record\Subn |
||||
| 182 | */ |
||||
| 183 | public function getSubn() |
||||
| 184 | { |
||||
| 185 | return $this->subn; |
||||
| 186 | } |
||||
| 187 | |||||
| 188 | /** |
||||
| 189 | * Gets the collection of submitters to the GEDCOM file. |
||||
| 190 | * |
||||
| 191 | * @return \Gedcom\Record\Subm[] |
||||
| 192 | */ |
||||
| 193 | public function getSubm() |
||||
| 194 | { |
||||
| 195 | return $this->subm; |
||||
| 196 | } |
||||
| 197 | |||||
| 198 | /** |
||||
| 199 | * Gets the collection of individuals stored in the GEDCOM file. |
||||
| 200 | * |
||||
| 201 | * @return \Gedcom\Record\Indi[] |
||||
| 202 | */ |
||||
| 203 | public function getIndi() |
||||
| 204 | { |
||||
| 205 | return $this->indi; |
||||
| 206 | } |
||||
| 207 | |||||
| 208 | /** |
||||
| 209 | * Gets the collection of families stored in the GEDCOM file. |
||||
| 210 | * |
||||
| 211 | * @return \Gedcom\Record\Fam[] |
||||
| 212 | */ |
||||
| 213 | public function getFam() |
||||
| 214 | { |
||||
| 215 | return $this->fam; |
||||
| 216 | } |
||||
| 217 | |||||
| 218 | /** |
||||
| 219 | * Gets the collection of repositories stored in the GEDCOM file. |
||||
| 220 | * |
||||
| 221 | * @return \Gedcom\Record\Repo[] |
||||
| 222 | */ |
||||
| 223 | public function getRepo() |
||||
| 224 | { |
||||
| 225 | return $this->repo; |
||||
| 226 | } |
||||
| 227 | |||||
| 228 | /** |
||||
| 229 | * Gets the collection of sources stored in the GEDCOM file. |
||||
| 230 | * |
||||
| 231 | * @return \Gedcom\Record\Sour[] |
||||
| 232 | */ |
||||
| 233 | public function getSour() |
||||
| 234 | { |
||||
| 235 | return $this->sour; |
||||
| 236 | } |
||||
| 237 | |||||
| 238 | /** |
||||
| 239 | * Gets the collection of note stored in the GEDCOM file. |
||||
| 240 | * |
||||
| 241 | * @return \Gedcom\Record\Note[] |
||||
| 242 | */ |
||||
| 243 | public function getNote() |
||||
| 244 | { |
||||
| 245 | return $this->note; |
||||
| 246 | } |
||||
| 247 | |||||
| 248 | /** |
||||
| 249 | * Gets the collection of objects stored in the GEDCOM file. |
||||
| 250 | * |
||||
| 251 | * @return \Gedcom\Record\Obje[] |
||||
| 252 | */ |
||||
| 253 | public function getObje() |
||||
| 254 | { |
||||
| 255 | return $this->obje; |
||||
| 256 | } |
||||
| 257 | } |
||||
| 258 |