Subm::addNote()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 2
dl 0
loc 5
c 0
b 0
f 0
rs 10
cc 1
nc 1
nop 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 Gedcom\Record;
16
17
use Gedcom\Record;
18
19
/**
20
 * Class Subm.
21
 */
22
class Subm extends \Gedcom\Record implements Objectable
23
{
24
    /**
25
     * @var string
26
     */
27
    protected $subm;
28
29
    /**
30
     * @var Record\Chan
31
     */
32
    protected $chan;
33
34
    /**
35
     * @var string
36
     */
37
    protected $name;
38
39
    /**
40
     * @var Record\Addr
41
     */
42
    protected $addr;
43
44
    /**
45
     * @var string
46
     */
47
    protected $rin;
48
49
    /**
50
     * @var string
51
     */
52
    protected $rfn;
53
54
    /**
55
     * @var array
56
     */
57
    protected $lang = [];
58
59
    /**
60
     * @var array
61
     */
62
    protected $phon = [];
63
64
    /**
65
     * @var array
66
     */
67
    protected $email = [];
68
69
    /**
70
     * @var array
71
     */
72
    protected $fax = [];
73
74
    /**
75
     * @var array
76
     */
77
    protected $www = [];
78
79
    /**
80
     * @var array
81
     */
82
    protected $obje = [];
83
84
    /**
85
     * @var array
86
     */
87
    protected $note = [];
88
89
    /**
90
     * @param string $subm
91
     *
92
     * @return Subm
93
     */
94
    public function setSubm($subm = '')
95
    {
96
        $this->subm = $subm;
97
98
        return $this;
99
    }
100
101
    /**
102
     * @return string
103
     */
104
    public function getSubm()
105
    {
106
        return $this->subm;
107
    }
108
109
    /**
110
     * @param string $name
111
     *
112
     * @return Subm
113
     */
114
    public function setName($name = '')
115
    {
116
        $this->name = $name;
117
118
        return $this;
119
    }
120
121
    /**
122
     * @return string
123
     */
124
    public function getName()
125
    {
126
        return $this->name;
127
    }
128
129
    /**
130
     * @param array $phon
131
     *
132
     * @return Subm
133
     */
134
    public function setPhon($phon = [])
135
    {
136
        $this->phon = $phon;
137
138
        return $this;
139
    }
140
141
    /**
142
     * @return array
143
     */
144
    public function getPhon()
145
    {
146
        return $this->phon;
147
    }
148
149
    /**
150
     * @param Record\Phon $phon
151
     *
152
     * @return Subm
153
     */
154
    public function addPhon($phon = [])
155
    {
156
        $this->phon[] = $phon;
157
158
        return $this;
159
    }
160
161
    /**
162
     * @return array
163
     */
164
    public function getEmail()
165
    {
166
        return $this->email;
167
    }
168
169
    /**
170
     * @param Record\Phon $phon
171
     *
172
     * @return Subm
173
     */
174
    public function addEmail($email)
175
    {
176
        $this->email[] = $email;
177
178
        return $this;
179
    }
180
181
    /**
182
     * @return array
183
     */
184
    public function getFax()
185
    {
186
        return $this->fax;
187
    }
188
189
    /**
190
     * @param Record\Phon $phon
191
     *
192
     * @return Subm
193
     */
194
    public function addFax($fax)
195
    {
196
        $this->fax[] = $fax;
197
198
        return $this;
199
    }
200
201
    /**
202
     * @return array
203
     */
204
    public function getWww()
205
    {
206
        return $this->www;
207
    }
208
209
    /**
210
     * @param Record\Phon $phon
211
     *
212
     * @return Subm
213
     */
214
    public function addWww($www)
215
    {
216
        $this->www[] = $www;
217
218
        return $this;
219
    }
220
221
    /**
222
     * @param string $rfn
223
     *
224
     * @return Subm
225
     */
226
    public function setRfn($rfn = '')
227
    {
228
        $this->rfn = $rfn;
229
230
        return $this;
231
    }
232
233
    /**
234
     * @return string
235
     */
236
    public function getRfn()
237
    {
238
        return $this->rfn;
239
    }
240
241
    /**
242
     * @param string $rin
243
     *
244
     * @return Subm
245
     */
246
    public function setRin($rin = '')
247
    {
248
        $this->rin = $rin;
249
250
        return $this;
251
    }
252
253
    /**
254
     * @return string
255
     */
256
    public function getRin()
257
    {
258
        return $this->rin;
259
    }
260
261
    /**
262
     * @param \Gedcom\Record\Chan $chan
263
     *
264
     * @return Subm
265
     */
266
    public function setChan($chan = [])
267
    {
268
        $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 Gedcom\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...
269
270
        return $this;
271
    }
272
273
    /**
274
     * @return \Gedcom\Record\Chan
275
     */
276
    public function getChan()
277
    {
278
        return $this->chan;
279
    }
280
281
    /**
282
     * @return array
283
     */
284
    public function getLang()
285
    {
286
        return $this->lang;
287
    }
288
289
    /**
290
     * @param string $lang
291
     *
292
     * @return Subm
293
     */
294
    public function addLang($lang = '')
295
    {
296
        $this->lang[] = $lang;
297
298
        return $this;
299
    }
300
301
    /**
302
     * @return Addr
303
     */
304
    public function getAddr()
305
    {
306
        return $this->addr;
307
    }
308
309
    /**
310
     * @param Addr $addr
311
     *
312
     * @return Subm
313
     */
314
    public function setAddr($addr = [])
315
    {
316
        $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 Gedcom\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...
317
318
        return $this;
319
    }
320
321
    /**
322
     * @return array
323
     */
324
    public function getObje()
325
    {
326
        return $this->obje;
327
    }
328
329
    /**
330
     * @param Record\ObjeRef $obje
331
     *
332
     * @return Subm
333
     */
334
    public function addObje($obje = [])
335
    {
336
        $this->obje[] = $obje;
337
338
        return $this;
339
    }
340
341
    /**
342
     * @return array
343
     */
344
    public function getNote()
345
    {
346
        return $this->note;
347
    }
348
349
    /**
350
     * @param Record\Note $note
351
     *
352
     * @return Subm
353
     */
354
    public function addNote($note = [])
355
    {
356
        $this->note[] = $note;
357
358
        return $this;
359
    }
360
}
361