Even   A
last analyzed

Complexity

Total Complexity 26

Size/Duplication

Total Lines 330
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 54
dl 0
loc 330
rs 10
c 0
b 0
f 0
wmc 26

26 Methods

Rating   Name   Duplication   Size   Complexity  
A setChan() 0 5 1
A addNote() 0 5 1
A setAgnc() 0 5 1
A getObje() 0 3 1
A getNote() 0 3 1
A setAddr() 0 5 1
A setRef() 0 5 1
A setCaus() 0 5 1
A addSour() 0 5 1
A getAddr() 0 3 1
A getDate() 0 3 1
A getSour() 0 3 1
A getChan() 0 3 1
A getAge() 0 3 1
A addObje() 0 5 1
A getAgnc() 0 3 1
A getPhon() 0 3 1
A setDate() 0 5 1
A getPlac() 0 3 1
A getType() 0 3 1
A setPlac() 0 5 1
A setType() 0 5 1
A getRef() 0 3 1
A addPhon() 0 5 1
A getCaus() 0 3 1
A setAge() 0 5 1
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\Indi;
16
17
use PhpGedcom\Record;
18
19
/**
20
 * Class Even.
21
 */
22
class Even extends Record implements Record\Objectable, Record\Sourceable, Record\Noteable
23
{
24
    /**
25
     * @var string
26
     */
27
    protected $type;
28
29
    /**
30
     * @var string
31
     */
32
    protected $_attr;
33
34
    /**
35
     * @var string
36
     */
37
    protected $date;
38
39
    /**
40
     * @var Even\Plac
41
     */
42
    protected $plac;
43
44
    /**
45
     * @var string
46
     */
47
    protected $caus;
48
49
    /**
50
     * @var string
51
     */
52
    protected $age;
53
54
    /**
55
     * @var Record\Addr
56
     */
57
    protected $addr;
58
59
    /**
60
     * @var array
61
     */
62
    protected $phon = [];
63
64
    /**
65
     * @var string
66
     */
67
    protected $agnc;
68
69
    /**
70
     * @var array
71
     */
72
    public $ref = [];
73
74
    /**
75
     * @var array
76
     */
77
    protected $obje = [];
78
79
    /**
80
     * @var array
81
     */
82
    protected $sour = [];
83
84
    /**
85
     * @var array
86
     */
87
    protected $note = [];
88
89
    /**
90
     * @var Record\Chan
91
     */
92
    protected $chan;
93
94
    /**
95
     * @return array
96
     */
97
    public function getPhon()
98
    {
99
        return $this->phon;
100
    }
101
102
    /**
103
     * @param Record\Phon $phon
104
     *
105
     * @return Even
106
     */
107
    public function addPhon($phon = [])
108
    {
109
        $this->phon[] = $phon;
110
111
        return $this;
112
    }
113
114
    /**
115
     * @return array
116
     */
117
    public function getObje()
118
    {
119
        return $this->obje;
120
    }
121
122
    /**
123
     * @param Record\ObjeRef $obje
124
     *
125
     * @return Even
126
     */
127
    public function addObje($obje = [])
128
    {
129
        $this->obje[] = $obje;
130
131
        return $this;
132
    }
133
134
    /**
135
     * @return array
136
     */
137
    public function getSour()
138
    {
139
        return $this->sour;
140
    }
141
142
    /**
143
     * @param Record\SourRef $sour
144
     *
145
     * @return Even
146
     */
147
    public function addSour($sour = [])
148
    {
149
        $this->sour[] = $sour;
150
151
        return $this;
152
    }
153
154
    /**
155
     * @return array
156
     */
157
    public function getNote()
158
    {
159
        return $this->note;
160
    }
161
162
    /**
163
     * @param Record\NoteRef $note
164
     *
165
     * @return Even
166
     */
167
    public function addNote($note = [])
168
    {
169
        $this->note[] = $note;
170
171
        return $this;
172
    }
173
174
    /**
175
     * @param \PhpGedcom\Record\Addr $addr
176
     *
177
     * @return Even
178
     */
179
    public function setAddr($addr = [])
180
    {
181
        $this->addr = $addr;
0 ignored issues
show
Documentation Bug introduced by
It seems like $addr can also be of type array. However, the property $addr is declared as type PhpGedcom\Record\Addr. 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...
182
183
        return $this;
184
    }
185
186
    /**
187
     * @return \PhpGedcom\Record\Addr
188
     */
189
    public function getAddr()
190
    {
191
        return $this->addr;
192
    }
193
194
    /**
195
     * @param string $age
196
     *
197
     * @return Even
198
     */
199
    public function setAge($age = '')
200
    {
201
        $this->age = $age;
202
203
        return $this;
204
    }
205
206
    /**
207
     * @return string
208
     */
209
    public function getAge()
210
    {
211
        return $this->age;
212
    }
213
214
    /**
215
     * @param string $agnc
216
     *
217
     * @return Even
218
     */
219
    public function setAgnc($agnc = '')
220
    {
221
        $this->agnc = $agnc;
222
223
        return $this;
224
    }
225
226
    /**
227
     * @return string
228
     */
229
    public function getAgnc()
230
    {
231
        return $this->agnc;
232
    }
233
234
    /**
235
     * @param string $caus
236
     *
237
     * @return Even
238
     */
239
    public function setCaus($caus = '')
240
    {
241
        $this->caus = $caus;
242
243
        return $this;
244
    }
245
246
    /**
247
     * @return string
248
     */
249
    public function getCaus()
250
    {
251
        return $this->caus;
252
    }
253
254
    /**
255
     * @param string $date
256
     *
257
     * @return Even
258
     */
259
    public function setDate($date = '')
260
    {
261
        $this->date = $date;
262
263
        return $this;
264
    }
265
266
    /**
267
     * @return string
268
     */
269
    public function getDate()
270
    {
271
        return $this->date;
272
    }
273
274
    /**
275
     * @param \PhpGedcom\Record\Indi\Even\Plac $plac
276
     *
277
     * @return Even
278
     */
279
    public function setPlac($plac = [])
280
    {
281
        $this->plac = $plac;
0 ignored issues
show
Documentation Bug introduced by
It seems like $plac can also be of type array. However, the property $plac is declared as type PhpGedcom\Record\Indi\Even\Plac. 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...
282
283
        return $this;
284
    }
285
286
    /**
287
     * @return \PhpGedcom\Record\Indi\Even\Plac
288
     */
289
    public function getPlac()
290
    {
291
        return $this->plac;
292
    }
293
294
    /**
295
     * @param string $type
296
     *
297
     * @return Even
298
     */
299
    public function setType($type = '')
300
    {
301
        $this->type = $type;
302
303
        return $this;
304
    }
305
306
    /**
307
     * @return string
308
     */
309
    public function getType()
310
    {
311
        return $this->type;
312
    }
313
314
    /**
315
     * @param array $ref
316
     *
317
     * @return Even
318
     */
319
    public function setRef($ref = '')
320
    {
321
        $this->ref = $ref;
0 ignored issues
show
Documentation Bug introduced by
It seems like $ref can also be of type string. However, the property $ref is declared as type array. 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...
322
323
        return $this;
324
    }
325
326
    /**
327
     * @return array
328
     */
329
    public function getRef()
330
    {
331
        return $this->ref;
332
    }
333
334
    /**
335
     * @return Record\Chan
336
     */
337
    public function getChan()
338
    {
339
        return $this->chan;
340
    }
341
342
    /**
343
     * @param Record\Chan $chan
344
     *
345
     * @return $this
346
     */
347
    public function setChan($chan = [])
348
    {
349
        $this->chan = $chan;
0 ignored issues
show
Documentation Bug introduced by
It seems like $chan can also be of type array. However, the property $chan is declared as type PhpGedcom\Record\Chan. 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...
350
351
        return $this;
352
    }
353
}
354