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