Passed
Branch master (6a7148)
by Curtis
01:48
created

Subm   A

Complexity

Total Complexity 27

Size/Duplication

Total Lines 285
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 55
dl 0
loc 285
rs 10
c 0
b 0
f 0
wmc 27

27 Methods

Rating   Name   Duplication   Size   Complexity  
A getObje() 0 2 1
A addPhon() 0 3 1
A setSubm() 0 3 1
A getChan() 0 2 1
A getRfn() 0 2 1
A getEmail() 0 2 1
A setAddr() 0 3 1
A getAddr() 0 2 1
A setChan() 0 3 1
A addWww() 0 3 1
A setName() 0 3 1
A getFax() 0 2 1
A getRin() 0 2 1
A getWww() 0 2 1
A addFax() 0 3 1
A getSubm() 0 2 1
A getLang() 0 2 1
A setRin() 0 3 1
A getName() 0 2 1
A addNote() 0 3 1
A setPhon() 0 3 1
A setRfn() 0 3 1
A addLang() 0 3 1
A getNote() 0 2 1
A addEmail() 0 3 1
A getPhon() 0 2 1
A addObje() 0 3 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
 * @package         php-gedcom
11
 * @license         MIT
12
 * @link            http://github.com/mrkrstphr/php-gedcom
13
 */
14
15
namespace PhpGedcom\Record;
16
17
use PhpGedcom\Record;
18
19
/**
20
 * Class Subm
21
 * @package PhpGedcom\Record
22
 */
23
class Subm extends Record implements Objectable {
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 = array();
58
59
	/**
60
	 * @var array
61
	 */
62
	protected $phon = array();
63
64
	/**
65
	 * @var array
66
	 */
67
	protected $email = array();
68
69
	/**
70
	 * @var array
71
	 */
72
	protected $fax = array();
73
74
	/**
75
	 * @var array
76
	 */
77
	protected $www = array();
78
79
	/**
80
	 * @var array
81
	 */
82
	protected $obje = array();
83
84
	/**
85
	 * @var array
86
	 */
87
	protected $note = array();
88
89
	/**
90
	 * @param string $subm
91
	 * @return Subm
92
	 */
93
	public function setSubm($subm = '') {
94
		$this->subm = $subm;
95
		return $this;
96
	}
97
98
	/**
99
	 * @return string
100
	 */
101
	public function getSubm() {
102
		return $this->subm;
103
	}
104
105
	/**
106
	 * @param string $name
107
	 * @return Subm
108
	 */
109
	public function setName($name = '') {
110
		$this->name = $name;
111
		return $this;
112
	}
113
114
	/**
115
	 * @return string
116
	 */
117
	public function getName() {
118
		return $this->name;
119
	}
120
121
	/**
122
	 * @param array $phon
123
	 * @return Subm
124
	 */
125
	public function setPhon($phon = []) {
126
		$this->phon = $phon;
127
		return $this;
128
	}
129
130
	/**
131
	 * @return array
132
	 */
133
	public function getPhon() {
134
		return $this->phon;
135
	}
136
137
138
	/**
139
	 * @param Record\Phon $phon
140
	 * @return Subm
141
	 */
142
	public function addPhon($phon = []) {
143
		$this->phon[] = $phon;
144
		return $this;
145
	}
146
147
	/**
148
	 * @return array
149
	 */
150
	public function getEmail() {
151
		return $this->email;
152
	}
153
154
155
	/**
156
	 * @param Record\Phon $phon
157
	 * @return Subm
158
	 */
159
	public function addEmail($email) {
160
		$this->email[] = $email;
161
		return $this;
162
	}
163
164
	/**
165
	 * @return array
166
	 */
167
	public function getFax() {
168
		return $this->fax;
169
	}
170
171
172
	/**
173
	 * @param Record\Phon $phon
174
	 * @return Subm
175
	 */
176
	public function addFax($fax) {
177
		$this->fax[] = $fax;
178
		return $this;
179
	}
180
181
	/**
182
	 * @return array
183
	 */
184
	public function getWww() {
185
		return $this->www;
186
	}
187
188
189
	/**
190
	 * @param Record\Phon $phon
191
	 * @return Subm
192
	 */
193
	public function addWww($www) {
194
		$this->www[] = $www;
195
		return $this;
196
	}
197
198
	/**
199
	 * @param string $rfn
200
	 * @return Subm
201
	 */
202
	public function setRfn($rfn = '') {
203
		$this->rfn = $rfn;
204
		return $this;
205
	}
206
207
	/**
208
	 * @return string
209
	 */
210
	public function getRfn() {
211
		return $this->rfn;
212
	}
213
214
	/**
215
	 * @param string $rin
216
	 * @return Subm
217
	 */
218
	public function setRin($rin = '') {
219
		$this->rin = $rin;
220
		return $this;
221
	}
222
223
	/**
224
	 * @return string
225
	 */
226
	public function getRin() {
227
		return $this->rin;
228
	}
229
230
	/**
231
	 * @param \PhpGedcom\Record\Chan $chan
232
	 * @return Subm
233
	 */
234
	public function setChan($chan = []) {
235
		$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...
236
		return $this;
237
	}
238
239
	/**
240
	 * @return \PhpGedcom\Record\Chan
241
	 */
242
	public function getChan() {
243
		return $this->chan;
244
	}
245
246
	/**
247
	 * @return array
248
	 */
249
	public function getLang() {
250
		return $this->lang;
251
	}
252
253
	/**
254
	 * @param string $lang
255
	 * @return Subm
256
	 */
257
	public function addLang($lang = '') {
258
		$this->lang[] = $lang;
259
		return $this;
260
	}
261
262
	/**
263
	 * @return Addr
264
	 */
265
	public function getAddr() {
266
		return $this->addr;
267
	}
268
269
	/**
270
	 * @param Addr $addr
271
	 * @return Subm
272
	 */
273
	public function setAddr($addr = []) {
274
		$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...
275
		return $this;
276
	}
277
278
	/**
279
	 * @return array
280
	 */
281
	public function getObje() {
282
		return $this->obje;
283
	}
284
285
	/**
286
	 * @param Record\ObjeRef $obje
287
	 * @return Subm
288
	 */
289
	public function addObje($obje = []) {
290
		$this->obje[] = $obje;
291
		return $this;
292
	}
293
294
	/**
295
	 * @return array
296
	 */
297
	public function getNote() {
298
		return $this->note;
299
	}
300
301
	/**
302
	 * @param Record\Note $note
303
	 * @return Subm
304
	 */
305
	public function addNote($note = []) {
306
		$this->note[] = $note;
307
		return $this;
308
	}
309
}
310