Indi::getNote()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

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