Test Failed
Push — master ( a7be7e...3f892b )
by Curtis
01:44 queued 01:07
created

Indi::getGid()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
c 0
b 0
f 0
dl 0
loc 3
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 $birthday;
148
    
149
    protected $deathday;
150
    
151
    protected $burialday;
152
    
153
    public function setBirthday($birthday = '')
154
    {
155
        $this->birthday = $birthday;
156
        
157
        return $this;
158
    }
159
    
160
    public function getBirthday()
161
    {
162
        return $this->birthday;
163
    }
164
165
    public function setDeathday($deathday = '')
166
    {
167
        $this->deathday = $deathday;
168
169
        return $this;
170
    }
171
172
    public function getDeathday()
173
    {
174
        return $this->deathday;
175
    }
176
177
    public function setBurialday($burialday = '')
178
    {
179
        $this->burialday = $burialday;
180
181
        return $this;
182
    }
183
184
    public function getBurialday()
185
    {
186
        return $this->burialday;
187
    }
188
189
    /**
190
     * @param string $id
191
     *
192
     * @return Indi
193
     */
194
    public function setId($id = '')
195
    {
196
        $this->id = $id;
197
198
        return $this;
199
    }
200
201
    /**
202
     * @return string
203
     */
204
    public function getId()
205
    {
206
        return $this->id;
207
    }
208
209
    /**
210
     * @param string $id
211
     *
212
     * @return Indi
213
     */
214
    public function setGid($gid = '')
215
    {
216
        $this->gid = $gid;
217
218
        return $this;
219
    }
220
221
    /**
222
     * @return string
223
     */
224
    public function getGid()
225
    {
226
        return $this->gid;
227
    }
228
229
    /**
230
     * @param string $uid
231
     *
232
     * @return Indi
233
     */
234
    public function setUid($uid = '')
235
    {
236
        $this->uid = $uid;
237
238
        return $this;
239
    }
240
241
    /**
242
     * @return string
243
     */
244
    public function getUid()
245
    {
246
        return $this->uid;
247
    }
248
249
    /**
250
     * @param Indi\Name $name
251
     *
252
     * @return Indi
253
     */
254
    public function addName($name = [])
255
    {
256
        $this->name[] = $name;
257
258
        return $this;
259
    }
260
261
    /**
262
     * @return Indi\Name[]
263
     */
264
    public function getName()
265
    {
266
        return $this->name;
267
    }
268
269
    /**
270
     * @param Indi\Attr $attr
271
     *
272
     * @return Indi
273
     */
274
    public function addAttr($attr = [])
275
    {
276
        $attrName = $attr->getType();
277
278
        if (!array_key_exists($attrName, $this->attr)) {
279
            $this->attr[$attrName] = [];
280
        }
281
282
        $this->attr[$attrName][] = $attr;
283
284
        return $this;
285
    }
286
287
    /**
288
     * @return Indi\Attr[]
289
     */
290
    public function getAllAttr()
291
    {
292
        return $this->attr;
293
    }
294
295
    /**
296
     * @return Indi\Attr[]
297
     */
298
    public function getAttr($key = '')
299
    {
300
        if (isset($this->attr[strtoupper($key)])) {
301
            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...
302
        }
303
    }
304
305
    /**
306
     * @param Indi\Even $even
307
     *
308
     * @return Indi
309
     */
310
    public function addEven($even = [])
311
    {
312
        $evenName = $even->getType();
313
314
        if (!array_key_exists($evenName, $this->even)) {
315
            $this->even[$evenName] = [];
316
        }
317
318
        $this->even[$evenName][] = $even;
319
320
        return $this;
321
    }
322
323
    /**
324
     * @return array
325
     */
326
    public function getAllEven()
327
    {
328
        return $this->even;
329
    }
330
331
    /**
332
     * @return array
333
     */
334
    public function getEven($key = '')
335
    {
336
        if (isset($this->even[strtoupper($key)])) {
337
            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...
338
        }
339
    }
340
341
    /**
342
     * @param Indi\Asso $asso
343
     *
344
     * @return Indi
345
     */
346
    public function addAsso($asso = [])
347
    {
348
        $this->asso[] = $asso;
349
350
        return $this;
351
    }
352
353
    /**
354
     * @return array
355
     */
356
    public function getAsso()
357
    {
358
        return $this->asso;
359
    }
360
361
    /**
362
     * @param Refn $ref
363
     *
364
     * @return Indi
365
     */
366
    public function addRefn($ref = [])
367
    {
368
        $this->refn[] = $ref;
369
370
        return $this;
371
    }
372
373
    /**
374
     * @return Refn[]
375
     */
376
    public function getRefn()
377
    {
378
        return $this->refn;
379
    }
380
381
    /**
382
     * @param \Gedcom\Record\NoteRef $note
383
     *
384
     * @return Indi
385
     */
386
    public function addNote($note = [])
387
    {
388
        $this->note[] = $note;
389
390
        return $this;
391
    }
392
393
    /**
394
     * @return array
395
     */
396
    public function getNote()
397
    {
398
        return $this->note;
399
    }
400
401
    /**
402
     * @param ObjeRef $obje
403
     *
404
     * @return Indi
405
     */
406
    public function addObje($obje = [])
407
    {
408
        $this->obje[] = $obje;
409
410
        return $this;
411
    }
412
413
    /**
414
     * @return array
415
     */
416
    public function getObje()
417
    {
418
        return $this->obje;
419
    }
420
421
    /**
422
     * @param SourRef $sour
423
     *
424
     * @return Indi
425
     */
426
    public function addSour($sour = [])
427
    {
428
        $this->sour[] = $sour;
429
430
        return $this;
431
    }
432
433
    /**
434
     * @return array
435
     */
436
    public function getSour()
437
    {
438
        return $this->sour;
439
    }
440
441
    /**
442
     * @param string $indi
443
     *
444
     * @return Indi
445
     */
446
    public function addAlia($indi = '')
447
    {
448
        $this->alia[] = $indi;
449
450
        return $this;
451
    }
452
453
    /**
454
     * @return array
455
     */
456
    public function getAlia()
457
    {
458
        return $this->alia;
459
    }
460
461
    /**
462
     * @param Indi\Famc $famc
463
     *
464
     * @return Indi
465
     */
466
    public function addFamc($famc = [])
467
    {
468
        $this->famc[] = $famc;
469
470
        return $this;
471
    }
472
473
    /**
474
     * @return array
475
     */
476
    public function getFamc()
477
    {
478
        return $this->famc;
479
    }
480
481
    /**
482
     * @param Indi\Fams $fams
483
     *
484
     * @return Indi
485
     */
486
    public function addFams($fams = [])
487
    {
488
        $this->fams[] = $fams;
489
490
        return $this;
491
    }
492
493
    /**
494
     * @return array
495
     */
496
    public function getFams()
497
    {
498
        return $this->fams;
499
    }
500
501
    /**
502
     * @param string $subm
503
     *
504
     * @return Indi
505
     */
506
    public function addAnci($subm = '')
507
    {
508
        $this->anci[] = $subm;
509
510
        return $this;
511
    }
512
513
    /**
514
     * @return string[]
515
     */
516
    public function getAnci()
517
    {
518
        return $this->anci;
519
    }
520
521
    /**
522
     * @param string $subm
523
     *
524
     * @return Indi
525
     */
526
    public function addDesi($subm = '')
527
    {
528
        $this->desi[] = $subm;
529
530
        return $this;
531
    }
532
533
    /**
534
     * @return string[]
535
     */
536
    public function getDesi()
537
    {
538
        return $this->desi;
539
    }
540
541
    /**
542
     * @param string $subm
543
     *
544
     * @return Indi
545
     */
546
    public function addSubm($subm = '')
547
    {
548
        $this->subm[] = $subm;
549
550
        return $this;
551
    }
552
553
    /**
554
     * @return string[]
555
     */
556
    public function getSubm()
557
    {
558
        return $this->subm;
559
    }
560
561
    /**
562
     * @param string $resn
563
     *
564
     * @return Indi
565
     */
566
    public function setResn($resn = '')
567
    {
568
        $this->resn = $resn;
569
570
        return $this;
571
    }
572
573
    /**
574
     * @return string
575
     */
576
    public function getResn()
577
    {
578
        return $this->resn;
579
    }
580
581
    /**
582
     * @param string $sex
583
     *
584
     * @return Indi
585
     */
586
    public function setSex($sex = '')
587
    {
588
        $this->sex = $sex;
589
590
        return $this;
591
    }
592
593
    /**
594
     * @return string
595
     */
596
    public function getSex()
597
    {
598
        return $this->sex;
599
    }
600
601
    /**
602
     * @param string $rfn
603
     *
604
     * @return Indi
605
     */
606
    public function setRfn($rfn = '')
607
    {
608
        $this->rfn = $rfn;
609
610
        return $this;
611
    }
612
613
    /**
614
     * @return string
615
     */
616
    public function getRfn()
617
    {
618
        return $this->rfn;
619
    }
620
621
    /**
622
     * @param string $afn
623
     *
624
     * @return Indi
625
     */
626
    public function setAfn($afn = '')
627
    {
628
        $this->afn = $afn;
629
630
        return $this;
631
    }
632
633
    /**
634
     * @return string
635
     */
636
    public function getAfn()
637
    {
638
        return $this->afn;
639
    }
640
641
    /**
642
     * @param string $chan
643
     *
644
     * @return Indi
645
     */
646
    public function setChan($chan = null)
647
    {
648
        $this->chan = $chan;
649
650
        return $this;
651
    }
652
653
    /**
654
     * @return string
655
     */
656
    public function getChan()
657
    {
658
        return $this->chan;
659
    }
660
661
    /**
662
     * @param string $rin
663
     *
664
     * @return Indi
665
     */
666
    public function setRin($rin = '')
667
    {
668
        $this->rin = $rin;
669
670
        return $this;
671
    }
672
673
    /**
674
     * @return string
675
     */
676
    public function getRin()
677
    {
678
        return $this->rin;
679
    }
680
681
    /**
682
     * @param Indi\Bapl $bapl
683
     *
684
     * @return Indi
685
     */
686
    public function setBapl($bapl = [])
687
    {
688
        $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...
689
690
        return $this;
691
    }
692
693
    /**
694
     * @param Indi\Bapl $bapl
695
     *
696
     * @return Indi
697
     */
698
    public function addBapl($bapl = null)
699
    {
700
        $this->bapl[] = $bapl;
701
702
        return $this;
703
    }
704
705
    /**
706
     * @return Indi\Bapl
707
     */
708
    public function getBapl()
709
    {
710
        return $this->bapl;
711
    }
712
713
    /**
714
     * @param Indi\Conl $conl
715
     *
716
     * @return Indi
717
     */
718
    public function setConl($conl = [])
719
    {
720
        $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...
721
722
        return $this;
723
    }
724
725
    /**
726
     * @param Indi\Conl $conl
727
     *
728
     * @return Indi
729
     */
730
    public function addConl($conl)
731
    {
732
        $this->conl[] = $conl;
733
734
        return $this;
735
    }
736
737
    /**
738
     * @return Indi\Conl
739
     */
740
    public function getConl()
741
    {
742
        return $this->conl;
743
    }
744
745
    /**
746
     * @param Indi\Endl $endl
747
     *
748
     * @return Indi
749
     */
750
    public function setEndl($endl = [])
751
    {
752
        $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...
753
754
        return $this;
755
    }
756
757
    /**
758
     * @param Indi\Endl $endl
759
     *
760
     * @return Indi
761
     */
762
    public function addEndl($endl)
763
    {
764
        $this->endl[] = $endl;
765
766
        return $this;
767
    }
768
769
    /**
770
     * @return Indi\Endl
771
     */
772
    public function getEndl()
773
    {
774
        return $this->endl;
775
    }
776
777
    /**
778
     * @param Indi\Slgc $slgc
779
     *
780
     * @return Indi
781
     */
782
    public function setSlgc($slgc = [])
783
    {
784
        $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...
785
786
        return $this;
787
    }
788
789
    /**
790
     * @param Indi\Slgc $slgc
791
     *
792
     * @return Indi
793
     */
794
    public function addSlgc($slgc)
795
    {
796
        $this->slgc[] = $slgc;
797
798
        return $this;
799
    }
800
801
    /**
802
     * @return Indi\Slgc
803
     */
804
    public function getSlgc()
805
    {
806
        return $this->slgc;
807
    }
808
}
809