Test Failed
Push — master ( 3f892b...ca4849 )
by Curtis
03:14 queued 02:42
created

Indi::getBirt()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

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

Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a mixed type is assigned to a property that is type hinted more strictly.

For example, imagine you have a variable $accountId that can either hold an Id object or false (if there is no account id yet). Your code now assigns that value to the id property of an instance of the Account class. This class holds a proper account, so the id value must no longer be false.

Either this assignment is in error or a type check should be added for that assignment.

class Id
{
    public $id;

    public function __construct($id)
    {
        $this->id = $id;
    }

}

class Account
{
    /** @var  Id $id */
    public $id;
}

$account_id = false;

if (starsAreRight()) {
    $account_id = new Id(42);
}

$account = new Account();
if ($account instanceof Id)
{
    $account->id = $account_id;
}
Loading history...
679
680
        return $this;
681
    }
682
683
    /**
684
     * @param Indi\Bapl $bapl
685
     *
686
     * @return Indi
687
     */
688
    public function addBapl($bapl = null)
689
    {
690
        $this->bapl[] = $bapl;
691
692
        return $this;
693
    }
694
695
    /**
696
     * @return Indi\Bapl
697
     */
698
    public function getBapl()
699
    {
700
        return $this->bapl;
701
    }
702
703
    /**
704
     * @param Indi\Conl $conl
705
     *
706
     * @return Indi
707
     */
708
    public function setConl($conl = [])
709
    {
710
        $this->conl = $conl;
0 ignored issues
show
Documentation Bug introduced by
It seems like $conl can also be of type array. However, the property $conl is declared as type Gedcom\Record\Indi\Conl. Maybe add an additional type check?

Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a mixed type is assigned to a property that is type hinted more strictly.

For example, imagine you have a variable $accountId that can either hold an Id object or false (if there is no account id yet). Your code now assigns that value to the id property of an instance of the Account class. This class holds a proper account, so the id value must no longer be false.

Either this assignment is in error or a type check should be added for that assignment.

class Id
{
    public $id;

    public function __construct($id)
    {
        $this->id = $id;
    }

}

class Account
{
    /** @var  Id $id */
    public $id;
}

$account_id = false;

if (starsAreRight()) {
    $account_id = new Id(42);
}

$account = new Account();
if ($account instanceof Id)
{
    $account->id = $account_id;
}
Loading history...
711
712
        return $this;
713
    }
714
715
    /**
716
     * @param Indi\Conl $conl
717
     *
718
     * @return Indi
719
     */
720
    public function addConl($conl)
721
    {
722
        $this->conl[] = $conl;
723
724
        return $this;
725
    }
726
727
    /**
728
     * @return Indi\Conl
729
     */
730
    public function getConl()
731
    {
732
        return $this->conl;
733
    }
734
735
    /**
736
     * @param Indi\Endl $endl
737
     *
738
     * @return Indi
739
     */
740
    public function setEndl($endl = [])
741
    {
742
        $this->endl = $endl;
0 ignored issues
show
Documentation Bug introduced by
It seems like $endl can also be of type array. However, the property $endl is declared as type Gedcom\Record\Indi\Endl. Maybe add an additional type check?

Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a mixed type is assigned to a property that is type hinted more strictly.

For example, imagine you have a variable $accountId that can either hold an Id object or false (if there is no account id yet). Your code now assigns that value to the id property of an instance of the Account class. This class holds a proper account, so the id value must no longer be false.

Either this assignment is in error or a type check should be added for that assignment.

class Id
{
    public $id;

    public function __construct($id)
    {
        $this->id = $id;
    }

}

class Account
{
    /** @var  Id $id */
    public $id;
}

$account_id = false;

if (starsAreRight()) {
    $account_id = new Id(42);
}

$account = new Account();
if ($account instanceof Id)
{
    $account->id = $account_id;
}
Loading history...
743
744
        return $this;
745
    }
746
747
    /**
748
     * @param Indi\Endl $endl
749
     *
750
     * @return Indi
751
     */
752
    public function addEndl($endl)
753
    {
754
        $this->endl[] = $endl;
755
756
        return $this;
757
    }
758
759
    /**
760
     * @return Indi\Endl
761
     */
762
    public function getEndl()
763
    {
764
        return $this->endl;
765
    }
766
767
    /**
768
     * @param Indi\Slgc $slgc
769
     *
770
     * @return Indi
771
     */
772
    public function setSlgc($slgc = [])
773
    {
774
        $this->slgc = $slgc;
0 ignored issues
show
Documentation Bug introduced by
It seems like $slgc can also be of type array. However, the property $slgc is declared as type Gedcom\Record\Indi\Slgc. Maybe add an additional type check?

Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a mixed type is assigned to a property that is type hinted more strictly.

For example, imagine you have a variable $accountId that can either hold an Id object or false (if there is no account id yet). Your code now assigns that value to the id property of an instance of the Account class. This class holds a proper account, so the id value must no longer be false.

Either this assignment is in error or a type check should be added for that assignment.

class Id
{
    public $id;

    public function __construct($id)
    {
        $this->id = $id;
    }

}

class Account
{
    /** @var  Id $id */
    public $id;
}

$account_id = false;

if (starsAreRight()) {
    $account_id = new Id(42);
}

$account = new Account();
if ($account instanceof Id)
{
    $account->id = $account_id;
}
Loading history...
775
776
        return $this;
777
    }
778
779
    /**
780
     * @param Indi\Slgc $slgc
781
     *
782
     * @return Indi
783
     */
784
    public function addSlgc($slgc)
785
    {
786
        $this->slgc[] = $slgc;
787
788
        return $this;
789
    }
790
791
    /**
792
     * @return Indi\Slgc
793
     */
794
    public function getSlgc()
795
    {
796
        return $this->slgc;
797
    }
798
}
799