Sour   A
last analyzed

Complexity

Total Complexity 26

Size/Duplication

Total Lines 325
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 53
dl 0
loc 325
rs 10
c 0
b 0
f 0
wmc 26

26 Methods

Rating   Name   Duplication   Size   Complexity  
A getNote() 0 3 1
A getRefn() 0 3 1
A setPubl() 0 5 1
A getRepo() 0 3 1
A setTitl() 0 5 1
A setRepo() 0 5 1
A getRin() 0 3 1
A getChan() 0 3 1
A setText() 0 5 1
A setData() 0 5 1
A getAbbr() 0 3 1
A getObje() 0 3 1
A getData() 0 3 1
A setChan() 0 5 1
A addRefn() 0 5 1
A setRin() 0 5 1
A setAbbr() 0 5 1
A getSour() 0 3 1
A getAuth() 0 3 1
A getTitl() 0 3 1
A getText() 0 3 1
A setSour() 0 5 1
A setAuth() 0 5 1
A addObje() 0 5 1
A addNote() 0 5 1
A getPubl() 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
 * @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 Sour.
21
 */
22
class Sour extends Record implements Noteable, Objectable
23
{
24
    /**
25
     * @var string
26
     */
27
    protected $sour;
28
29
    /**
30
     * @var Data
31
     */
32
    protected $data;
33
34
    /**
35
     * @var string
36
     */
37
    protected $auth;
38
39
    /**
40
     * @var string
41
     */
42
    protected $titl;
43
44
    /**
45
     * @var string
46
     */
47
    protected $abbr;
48
49
    /**
50
     * @var string
51
     */
52
    protected $publ;
53
54
    /**
55
     * @var string
56
     */
57
    protected $text;
58
59
    /**
60
     * @var Repo
61
     */
62
    protected $repo;
63
64
    /**
65
     * @var array
66
     */
67
    protected $refn = [];
68
69
    /**
70
     * @var string
71
     */
72
    protected $rin;
73
74
    /**
75
     * @var Chan
76
     */
77
    protected $chan;
78
79
    /**
80
     * @var array
81
     */
82
    protected $note = [];
83
84
    /**
85
     * @var array
86
     */
87
    protected $obje = [];
88
89
    /**
90
     * @param string $sour
91
     *
92
     * @return Sour
93
     */
94
    public function setSour($sour = '')
95
    {
96
        $this->sour = $sour;
97
98
        return $this;
99
    }
100
101
    /**
102
     * @return string
103
     */
104
    public function getSour()
105
    {
106
        return $this->sour;
107
    }
108
109
    /**
110
     * @param string $titl
111
     *
112
     * @return Sour
113
     */
114
    public function setTitl($titl = '')
115
    {
116
        $this->titl = $titl;
117
118
        return $this;
119
    }
120
121
    /**
122
     * @return string
123
     */
124
    public function getTitl()
125
    {
126
        return $this->titl;
127
    }
128
129
    /**
130
     * @param string $abbr
131
     *
132
     * @return Sour
133
     */
134
    public function setAbbr($abbr = '')
135
    {
136
        $this->abbr = $abbr;
137
138
        return $this;
139
    }
140
141
    /**
142
     * @return string
143
     */
144
    public function getAbbr()
145
    {
146
        return $this->abbr;
147
    }
148
149
    /**
150
     * @param string $auth
151
     *
152
     * @return Sour
153
     */
154
    public function setAuth($auth = '')
155
    {
156
        $this->auth = $auth;
157
158
        return $this;
159
    }
160
161
    /**
162
     * @return string
163
     */
164
    public function getAuth()
165
    {
166
        return $this->auth;
167
    }
168
169
    /**
170
     * @param string $publ
171
     *
172
     * @return Sour
173
     */
174
    public function setPubl($publ = '')
175
    {
176
        $this->publ = $publ;
177
178
        return $this;
179
    }
180
181
    /**
182
     * @return string
183
     */
184
    public function getPubl()
185
    {
186
        return $this->publ;
187
    }
188
189
    /**
190
     * @param \PhpGedcom\Record\Repo $repo
191
     *
192
     * @return Sour
193
     */
194
    public function setRepo($repo)
195
    {
196
        $this->repo = $repo;
197
198
        return $this;
199
    }
200
201
    /**
202
     * @return \PhpGedcom\Record\Repo
203
     */
204
    public function getRepo()
205
    {
206
        return $this->repo;
207
    }
208
209
    /**
210
     * @param string $text
211
     *
212
     * @return Sour
213
     */
214
    public function setText($text = '')
215
    {
216
        $this->text = $text;
217
218
        return $this;
219
    }
220
221
    /**
222
     * @return string
223
     */
224
    public function getText()
225
    {
226
        return $this->text;
227
    }
228
229
    /**
230
     * @param string $data
231
     *
232
     * @return Sour
233
     */
234
    public function setData($data = '')
235
    {
236
        $this->data = $data;
0 ignored issues
show
Documentation Bug introduced by
It seems like $data of type string is incompatible with the declared type PhpGedcom\Record\Data of property $data.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
237
238
        return $this;
239
    }
240
241
    /**
242
     * @return string
243
     */
244
    public function getData()
245
    {
246
        return $this->data;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->data returns the type PhpGedcom\Record\Data which is incompatible with the documented return type string.
Loading history...
247
    }
248
249
    /**
250
     * @param string $rin
251
     *
252
     * @return Sour
253
     */
254
    public function setRin($rin = '')
255
    {
256
        $this->rin = $rin;
257
258
        return $this;
259
    }
260
261
    /**
262
     * @return string
263
     */
264
    public function getRin()
265
    {
266
        return $this->rin;
267
    }
268
269
    /**
270
     * @param \PhpGedcom\Record\Chan $chan
271
     *
272
     * @return Sour
273
     */
274
    public function setChan($chan = [])
275
    {
276
        $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...
277
278
        return $this;
279
    }
280
281
    /**
282
     * @return \PhpGedcom\Record\Chan
283
     */
284
    public function getChan()
285
    {
286
        return $this->chan;
287
    }
288
289
    /**
290
     * @param Refn $refn
291
     *
292
     * @return Sour
293
     */
294
    public function addRefn($refn = [])
295
    {
296
        $this->refn[] = $refn;
297
298
        return $this;
299
    }
300
301
    /**
302
     * @return array
303
     */
304
    public function getRefn()
305
    {
306
        return $this->refn;
307
    }
308
309
    /**
310
     * @param NoteRef $note
311
     *
312
     * @return Sour
313
     */
314
    public function addNote($note = [])
315
    {
316
        $this->note[] = $note;
317
318
        return $this;
319
    }
320
321
    /**
322
     * @return array
323
     */
324
    public function getNote()
325
    {
326
        return $this->note;
327
    }
328
329
    /**
330
     * @param ObjeRef $obje
331
     *
332
     * @return Sour
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 getObje()
345
    {
346
        return $this->obje;
347
    }
348
}
349