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
|
|
|
* @package php-gedcom |
11
|
|
|
* @license MIT |
12
|
|
|
* @link http://github.com/mrkrstphr/php-gedcom |
13
|
|
|
*/ |
14
|
|
|
|
15
|
|
|
namespace PhpGedcom\Record; |
16
|
|
|
|
17
|
|
|
use PhpGedcom\Record; |
18
|
|
|
use PhpGedcom\Record\NoteRef; |
19
|
|
|
use PhpGedcom\Record\ObjeRef; |
20
|
|
|
use PhpGedcom\Record\Refn; |
21
|
|
|
use PhpGedcom\Record\SourRef; |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* Class Indi |
25
|
|
|
* @package PhpGedcom\Record |
26
|
|
|
*/ |
27
|
|
|
class Indi extends Record implements Noteable, Objectable, Sourceable { |
28
|
|
|
/** |
29
|
|
|
* @var string |
30
|
|
|
*/ |
31
|
|
|
protected $id; |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* @var string |
35
|
|
|
*/ |
36
|
|
|
protected $uid; |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* @var string |
40
|
|
|
*/ |
41
|
|
|
protected $resn; |
42
|
|
|
/** |
43
|
|
|
* @var Indi\Name[] |
44
|
|
|
*/ |
45
|
|
|
protected $name = array(); |
46
|
|
|
/** |
47
|
|
|
* @var string |
48
|
|
|
*/ |
49
|
|
|
protected $sex; |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* @var Indi\Even[] |
53
|
|
|
*/ |
54
|
|
|
protected $even = array(); |
55
|
|
|
/** |
56
|
|
|
* @var Indi\Attr[] |
57
|
|
|
*/ |
58
|
|
|
protected $attr = array(); |
59
|
|
|
/** |
60
|
|
|
* @var Indi\Bapl |
61
|
|
|
*/ |
62
|
|
|
protected $bapl = array(); |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* @var Indi\Conl |
66
|
|
|
*/ |
67
|
|
|
protected $conl = array(); |
68
|
|
|
|
69
|
|
|
/** |
70
|
|
|
* @var Indi\Endl |
71
|
|
|
*/ |
72
|
|
|
protected $endl = array(); |
73
|
|
|
|
74
|
|
|
/** |
75
|
|
|
* @var Indi\Slgc |
76
|
|
|
*/ |
77
|
|
|
protected $slgc = array(); |
78
|
|
|
|
79
|
|
|
/** |
80
|
|
|
* @var Indi\Famc[] |
81
|
|
|
*/ |
82
|
|
|
protected $famc = array(); |
83
|
|
|
/** |
84
|
|
|
* @var Indi\Fams[] |
85
|
|
|
*/ |
86
|
|
|
protected $fams = array(); |
87
|
|
|
/** |
88
|
|
|
* @var string[] |
89
|
|
|
*/ |
90
|
|
|
protected $subm = array(); |
91
|
|
|
/** |
92
|
|
|
* @var string[] |
93
|
|
|
*/ |
94
|
|
|
protected $alia = array(); |
95
|
|
|
/** |
96
|
|
|
* @var string[] |
97
|
|
|
*/ |
98
|
|
|
protected $anci = array(); |
99
|
|
|
/** |
100
|
|
|
* @var string[] |
101
|
|
|
*/ |
102
|
|
|
protected $desi = array(); |
103
|
|
|
/** |
104
|
|
|
* @var string |
105
|
|
|
*/ |
106
|
|
|
protected $rfn; |
107
|
|
|
/** |
108
|
|
|
* @var string |
109
|
|
|
*/ |
110
|
|
|
protected $afn; |
111
|
|
|
/** |
112
|
|
|
* @var Refn[] |
113
|
|
|
*/ |
114
|
|
|
protected $refn = array(); |
115
|
|
|
/** |
116
|
|
|
* @var string |
117
|
|
|
*/ |
118
|
|
|
protected $rin; |
119
|
|
|
|
120
|
|
|
/** |
121
|
|
|
* @var string |
122
|
|
|
*/ |
123
|
|
|
protected $chan; |
124
|
|
|
|
125
|
|
|
|
126
|
|
|
/** |
127
|
|
|
* @var Indi\Note[] |
128
|
|
|
*/ |
129
|
|
|
protected $note = array(); |
130
|
|
|
|
131
|
|
|
/** |
132
|
|
|
* @var Obje[] |
133
|
|
|
*/ |
134
|
|
|
protected $obje = array(); |
135
|
|
|
|
136
|
|
|
/** |
137
|
|
|
* @var Sour[] |
138
|
|
|
*/ |
139
|
|
|
protected $sour = array(); |
140
|
|
|
|
141
|
|
|
|
142
|
|
|
/** |
143
|
|
|
* @var Indi\Asso[] |
144
|
|
|
*/ |
145
|
|
|
protected $asso = array(); |
146
|
|
|
|
147
|
|
|
|
148
|
|
|
|
149
|
|
|
/** |
150
|
|
|
* @param string $id |
151
|
|
|
* @return Indi |
152
|
|
|
*/ |
153
|
|
|
public function setId($id = '') { |
154
|
|
|
$this->id = $id; |
155
|
|
|
return $this; |
156
|
|
|
} |
157
|
|
|
|
158
|
|
|
/** |
159
|
|
|
* @return string |
160
|
|
|
*/ |
161
|
|
|
public function getId() { |
162
|
|
|
return $this->id; |
163
|
|
|
} |
164
|
|
|
|
165
|
|
|
/** |
166
|
|
|
* @param string $uid |
167
|
|
|
* @return Indi |
168
|
|
|
*/ |
169
|
|
|
public function setUid($uid = '') { |
170
|
|
|
$this->uid = $uid; |
171
|
|
|
return $this; |
172
|
|
|
} |
173
|
|
|
|
174
|
|
|
/** |
175
|
|
|
* @return string |
176
|
|
|
*/ |
177
|
|
|
public function getUid() { |
178
|
|
|
return $this->uid; |
179
|
|
|
} |
180
|
|
|
|
181
|
|
|
/** |
182
|
|
|
* @param Indi\Name $name |
183
|
|
|
* @return Indi |
184
|
|
|
*/ |
185
|
|
|
public function addName($name = []) { |
186
|
|
|
$this->name[] = $name; |
187
|
|
|
return $this; |
188
|
|
|
} |
189
|
|
|
|
190
|
|
|
/** |
191
|
|
|
* @return Indi\Name[] |
192
|
|
|
*/ |
193
|
|
|
public function getName() { |
194
|
|
|
return $this->name; |
195
|
|
|
} |
196
|
|
|
|
197
|
|
|
/** |
198
|
|
|
* @param Indi\Attr $attr |
199
|
|
|
* @return Indi |
200
|
|
|
*/ |
201
|
|
|
public function addAttr($attr = []) { |
202
|
|
|
$attrName = $attr->getType(); |
203
|
|
|
|
204
|
|
|
if (!array_key_exists($attrName, $this->attr)) { |
205
|
|
|
$this->attr[$attrName] = []; |
206
|
|
|
} |
207
|
|
|
|
208
|
|
|
$this->attr[$attrName][] = $attr; |
209
|
|
|
return $this; |
210
|
|
|
} |
211
|
|
|
|
212
|
|
|
/** |
213
|
|
|
* @return Indi\Attr[] |
214
|
|
|
*/ |
215
|
|
|
public function getAllAttr() { |
216
|
|
|
return $this->attr; |
217
|
|
|
} |
218
|
|
|
/** |
219
|
|
|
* @return Indi\Attr[] |
220
|
|
|
*/ |
221
|
|
|
public function getAttr($key = '') { |
222
|
|
|
if (isset($this->attr[strtoupper($key)])) { |
223
|
|
|
return $this->attr[strtoupper($key)]; |
|
|
|
|
224
|
|
|
} |
225
|
|
|
|
226
|
|
|
} |
227
|
|
|
/** |
228
|
|
|
* @param Indi\Even $even |
229
|
|
|
* @return Indi |
230
|
|
|
*/ |
231
|
|
|
public function addEven($even = []) { |
232
|
|
|
$evenName = $even->getType(); |
233
|
|
|
|
234
|
|
|
if (!array_key_exists($evenName, $this->even)) { |
235
|
|
|
$this->even[$evenName] = []; |
236
|
|
|
} |
237
|
|
|
|
238
|
|
|
$this->even[$evenName][] = $even; |
239
|
|
|
return $this; |
240
|
|
|
} |
241
|
|
|
|
242
|
|
|
/** |
243
|
|
|
* @return array |
244
|
|
|
*/ |
245
|
|
|
public function getAllEven() { |
246
|
|
|
return $this->even; |
247
|
|
|
} |
248
|
|
|
|
249
|
|
|
/** |
250
|
|
|
* @return array |
251
|
|
|
*/ |
252
|
|
|
public function getEven($key = '') { |
253
|
|
|
if (isset($this->even[strtoupper($key)])) { |
254
|
|
|
return $this->even[strtoupper($key)]; |
|
|
|
|
255
|
|
|
} |
256
|
|
|
|
257
|
|
|
} |
258
|
|
|
|
259
|
|
|
/** |
260
|
|
|
* @param Indi\Asso $asso |
261
|
|
|
* @return Indi |
262
|
|
|
*/ |
263
|
|
|
public function addAsso($asso = []) { |
264
|
|
|
$this->asso[] = $asso; |
265
|
|
|
return $this; |
266
|
|
|
} |
267
|
|
|
|
268
|
|
|
/** |
269
|
|
|
* @return array |
270
|
|
|
*/ |
271
|
|
|
public function getAsso() { |
272
|
|
|
return $this->asso; |
273
|
|
|
} |
274
|
|
|
|
275
|
|
|
/** |
276
|
|
|
* @param Refn $ref |
277
|
|
|
* @return Indi |
278
|
|
|
*/ |
279
|
|
|
public function addRefn($ref = []) { |
280
|
|
|
$this->refn[] = $ref; |
281
|
|
|
return $this; |
282
|
|
|
} |
283
|
|
|
|
284
|
|
|
/** |
285
|
|
|
* @return Refn[] |
286
|
|
|
*/ |
287
|
|
|
public function getRefn() { |
288
|
|
|
return $this->refn; |
289
|
|
|
} |
290
|
|
|
|
291
|
|
|
/** |
292
|
|
|
* @param \PhpGedcom\Record\NoteRef $note |
293
|
|
|
* @return Indi |
294
|
|
|
*/ |
295
|
|
|
public function addNote($note = []) { |
296
|
|
|
$this->note[] = $note; |
297
|
|
|
return $this; |
298
|
|
|
} |
299
|
|
|
|
300
|
|
|
/** |
301
|
|
|
* @return array |
302
|
|
|
*/ |
303
|
|
|
public function getNote() { |
304
|
|
|
return $this->note; |
305
|
|
|
} |
306
|
|
|
|
307
|
|
|
/** |
308
|
|
|
* @param ObjeRef $obje |
309
|
|
|
* @return Indi |
310
|
|
|
*/ |
311
|
|
|
public function addObje($obje = []) { |
312
|
|
|
$this->obje[] = $obje; |
313
|
|
|
return $this; |
314
|
|
|
} |
315
|
|
|
|
316
|
|
|
/** |
317
|
|
|
* @return array |
318
|
|
|
*/ |
319
|
|
|
public function getObje() { |
320
|
|
|
return $this->obje; |
321
|
|
|
} |
322
|
|
|
|
323
|
|
|
/** |
324
|
|
|
* @param SourRef $sour |
325
|
|
|
* @return Indi |
326
|
|
|
*/ |
327
|
|
|
public function addSour($sour = []) { |
328
|
|
|
$this->sour[] = $sour; |
329
|
|
|
return $this; |
330
|
|
|
} |
331
|
|
|
|
332
|
|
|
/** |
333
|
|
|
* @return array |
334
|
|
|
*/ |
335
|
|
|
public function getSour() { |
336
|
|
|
return $this->sour; |
337
|
|
|
} |
338
|
|
|
|
339
|
|
|
/** |
340
|
|
|
* @param string $indi |
341
|
|
|
* @return Indi |
342
|
|
|
*/ |
343
|
|
|
public function addAlia($indi = '') { |
344
|
|
|
$this->alia[] = $indi; |
345
|
|
|
return $this; |
346
|
|
|
} |
347
|
|
|
|
348
|
|
|
/** |
349
|
|
|
* @return array |
350
|
|
|
*/ |
351
|
|
|
public function getAlia() { |
352
|
|
|
return $this->alia; |
353
|
|
|
} |
354
|
|
|
|
355
|
|
|
/** |
356
|
|
|
* @param Indi\Famc $famc |
357
|
|
|
* @return Indi |
358
|
|
|
*/ |
359
|
|
|
public function addFamc($famc = []) { |
360
|
|
|
$this->famc[] = $famc; |
361
|
|
|
return $this; |
362
|
|
|
} |
363
|
|
|
|
364
|
|
|
/** |
365
|
|
|
* @return array |
366
|
|
|
*/ |
367
|
|
|
public function getFamc() { |
368
|
|
|
return $this->famc; |
369
|
|
|
} |
370
|
|
|
|
371
|
|
|
/** |
372
|
|
|
* @param Indi\Fams $fams |
373
|
|
|
* @return Indi |
374
|
|
|
*/ |
375
|
|
|
public function addFams($fams = []) { |
376
|
|
|
$this->fams[] = $fams; |
377
|
|
|
return $this; |
378
|
|
|
} |
379
|
|
|
|
380
|
|
|
/** |
381
|
|
|
* @return array |
382
|
|
|
*/ |
383
|
|
|
public function getFams() { |
384
|
|
|
return $this->fams; |
385
|
|
|
} |
386
|
|
|
|
387
|
|
|
/** |
388
|
|
|
* @param string $subm |
389
|
|
|
* @return Indi |
390
|
|
|
*/ |
391
|
|
|
public function addAnci($subm = '') { |
392
|
|
|
$this->anci[] = $subm; |
393
|
|
|
return $this; |
394
|
|
|
} |
395
|
|
|
|
396
|
|
|
/** |
397
|
|
|
* @return string[] |
398
|
|
|
*/ |
399
|
|
|
public function getAnci() { |
400
|
|
|
return $this->anci; |
401
|
|
|
} |
402
|
|
|
|
403
|
|
|
/** |
404
|
|
|
* @param string $subm |
405
|
|
|
* @return Indi |
406
|
|
|
*/ |
407
|
|
|
public function addDesi($subm = '') { |
408
|
|
|
$this->desi[] = $subm; |
409
|
|
|
return $this; |
410
|
|
|
} |
411
|
|
|
|
412
|
|
|
/** |
413
|
|
|
* @return string[] |
414
|
|
|
*/ |
415
|
|
|
public function getDesi() { |
416
|
|
|
return $this->desi; |
417
|
|
|
} |
418
|
|
|
|
419
|
|
|
/** |
420
|
|
|
* @param string $subm |
421
|
|
|
* @return Indi |
422
|
|
|
*/ |
423
|
|
|
public function addSubm($subm = '') { |
424
|
|
|
$this->subm[] = $subm; |
425
|
|
|
return $this; |
426
|
|
|
} |
427
|
|
|
|
428
|
|
|
/** |
429
|
|
|
* @return string[] |
430
|
|
|
*/ |
431
|
|
|
public function getSubm() { |
432
|
|
|
return $this->subm; |
433
|
|
|
} |
434
|
|
|
|
435
|
|
|
/** |
436
|
|
|
* @param string $resn |
437
|
|
|
* @return Indi |
438
|
|
|
*/ |
439
|
|
|
public function setResn($resn = '') { |
440
|
|
|
$this->resn = $resn; |
441
|
|
|
return $this; |
442
|
|
|
} |
443
|
|
|
|
444
|
|
|
/** |
445
|
|
|
* @return string |
446
|
|
|
*/ |
447
|
|
|
public function getResn() { |
448
|
|
|
return $this->resn; |
449
|
|
|
} |
450
|
|
|
|
451
|
|
|
/** |
452
|
|
|
* @param string $sex |
453
|
|
|
* @return Indi |
454
|
|
|
*/ |
455
|
|
|
public function setSex($sex = '') { |
456
|
|
|
$this->sex = $sex; |
457
|
|
|
return $this; |
458
|
|
|
} |
459
|
|
|
|
460
|
|
|
/** |
461
|
|
|
* @return string |
462
|
|
|
*/ |
463
|
|
|
public function getSex() { |
464
|
|
|
return $this->sex; |
465
|
|
|
} |
466
|
|
|
|
467
|
|
|
/** |
468
|
|
|
* @param string $rfn |
469
|
|
|
* @return Indi |
470
|
|
|
*/ |
471
|
|
|
public function setRfn($rfn = '') { |
472
|
|
|
$this->rfn = $rfn; |
473
|
|
|
return $this; |
474
|
|
|
} |
475
|
|
|
|
476
|
|
|
/** |
477
|
|
|
* @return string |
478
|
|
|
*/ |
479
|
|
|
public function getRfn() { |
480
|
|
|
return $this->rfn; |
481
|
|
|
} |
482
|
|
|
|
483
|
|
|
/** |
484
|
|
|
* @param string $afn |
485
|
|
|
* @return Indi |
486
|
|
|
*/ |
487
|
|
|
public function setAfn($afn = '') { |
488
|
|
|
$this->afn = $afn; |
489
|
|
|
return $this; |
490
|
|
|
} |
491
|
|
|
|
492
|
|
|
/** |
493
|
|
|
* @return string |
494
|
|
|
*/ |
495
|
|
|
public function getAfn() { |
496
|
|
|
return $this->afn; |
497
|
|
|
} |
498
|
|
|
|
499
|
|
|
/** |
500
|
|
|
* @param string $chan |
501
|
|
|
* @return Indi |
502
|
|
|
*/ |
503
|
|
|
public function setChan($chan = null) { |
504
|
|
|
$this->chan = $chan; |
505
|
|
|
return $this; |
506
|
|
|
} |
507
|
|
|
|
508
|
|
|
/** |
509
|
|
|
* @return string |
510
|
|
|
*/ |
511
|
|
|
public function getChan() { |
512
|
|
|
return $this->chan; |
513
|
|
|
} |
514
|
|
|
|
515
|
|
|
/** |
516
|
|
|
* @param string $rin |
517
|
|
|
* @return Indi |
518
|
|
|
*/ |
519
|
|
|
public function setRin($rin = '') { |
520
|
|
|
$this->rin = $rin; |
521
|
|
|
return $this; |
522
|
|
|
} |
523
|
|
|
|
524
|
|
|
/** |
525
|
|
|
* @return string |
526
|
|
|
*/ |
527
|
|
|
public function getRin() { |
528
|
|
|
return $this->rin; |
529
|
|
|
} |
530
|
|
|
|
531
|
|
|
/** |
532
|
|
|
* @param Indi\Bapl $bapl |
533
|
|
|
* @return Indi |
534
|
|
|
*/ |
535
|
|
|
public function setBapl($bapl = []) { |
536
|
|
|
$this->bapl = $bapl; |
|
|
|
|
537
|
|
|
return $this; |
538
|
|
|
} |
539
|
|
|
/** |
540
|
|
|
* @param Indi\Bapl $bapl |
541
|
|
|
* @return Indi |
542
|
|
|
*/ |
543
|
|
|
public function addBapl($bapl = null) { |
544
|
|
|
$this->bapl[] = $bapl; |
545
|
|
|
return $this; |
546
|
|
|
} |
547
|
|
|
/** |
548
|
|
|
* @return Indi\Bapl |
549
|
|
|
*/ |
550
|
|
|
public function getBapl() { |
551
|
|
|
return $this->bapl; |
552
|
|
|
} |
553
|
|
|
|
554
|
|
|
/** |
555
|
|
|
* @param Indi\Conl $conl |
556
|
|
|
* @return Indi |
557
|
|
|
*/ |
558
|
|
|
public function setConl($conl = []) { |
559
|
|
|
$this->conl = $conl; |
|
|
|
|
560
|
|
|
return $this; |
561
|
|
|
} |
562
|
|
|
/** |
563
|
|
|
* @param Indi\Conl $conl |
564
|
|
|
* @return Indi |
565
|
|
|
*/ |
566
|
|
|
public function addConl($conl) { |
567
|
|
|
$this->conl[] = $conl; |
568
|
|
|
return $this; |
569
|
|
|
} |
570
|
|
|
|
571
|
|
|
/** |
572
|
|
|
* @return Indi\Conl |
573
|
|
|
*/ |
574
|
|
|
public function getConl() { |
575
|
|
|
return $this->conl; |
576
|
|
|
} |
577
|
|
|
|
578
|
|
|
/** |
579
|
|
|
* @param Indi\Endl $endl |
580
|
|
|
* @return Indi |
581
|
|
|
*/ |
582
|
|
|
public function setEndl($endl = []) { |
583
|
|
|
$this->endl = $endl; |
|
|
|
|
584
|
|
|
return $this; |
585
|
|
|
} |
586
|
|
|
/** |
587
|
|
|
* @param Indi\Endl $endl |
588
|
|
|
* @return Indi |
589
|
|
|
*/ |
590
|
|
|
public function addEndl($endl) { |
591
|
|
|
$this->endl[] = $endl; |
592
|
|
|
return $this; |
593
|
|
|
} |
594
|
|
|
|
595
|
|
|
/** |
596
|
|
|
* @return Indi\Endl |
597
|
|
|
*/ |
598
|
|
|
public function getEndl() { |
599
|
|
|
return $this->endl; |
600
|
|
|
} |
601
|
|
|
|
602
|
|
|
/** |
603
|
|
|
* @param Indi\Slgc $slgc |
604
|
|
|
* @return Indi |
605
|
|
|
*/ |
606
|
|
|
public function setSlgc($slgc = []) { |
607
|
|
|
$this->slgc = $slgc; |
|
|
|
|
608
|
|
|
return $this; |
609
|
|
|
} |
610
|
|
|
|
611
|
|
|
/** |
612
|
|
|
* @param Indi\Slgc $slgc |
613
|
|
|
* @return Indi |
614
|
|
|
*/ |
615
|
|
|
public function addSlgc($slgc) { |
616
|
|
|
$this->slgc[] = $slgc; |
617
|
|
|
return $this; |
618
|
|
|
} |
619
|
|
|
|
620
|
|
|
/** |
621
|
|
|
* @return Indi\Slgc |
622
|
|
|
*/ |
623
|
|
|
public function getSlgc() { |
624
|
|
|
return $this->slgc; |
625
|
|
|
} |
626
|
|
|
} |
627
|
|
|
|