Sour::getTitl()   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
eloc 1
dl 0
loc 3
c 0
b 0
f 0
rs 10
cc 1
nc 1
nop 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 Gedcom\Record;
16
17
/**
18
 * Class Sour.
19
 */
20
class Sour extends \Gedcom\Record implements Noteable, Objectable
21
{
22
    /**
23
     * @var string
24
     */
25
    protected $sour;
26
27
    /**
28
     * @var Data
29
     */
30
    protected $data;
31
32
    /**
33
     * @var string
34
     */
35
    protected $auth;
36
37
    /**
38
     * @var string
39
     */
40
    protected $titl;
41
42
    /**
43
     * @var string
44
     */
45
    protected $abbr;
46
47
    /**
48
     * @var string
49
     */
50
    protected $publ;
51
52
    /**
53
     * @var string
54
     */
55
    protected $text;
56
57
    /**
58
     * @var Repo
59
     */
60
    protected $repo;
61
62
    /**
63
     * @var array
64
     */
65
    protected $refn = [];
66
67
    /**
68
     * @var string
69
     */
70
    protected $rin;
71
72
    /**
73
     * @var Chan
74
     */
75
    protected $chan;
76
77
    /**
78
     * @var array
79
     */
80
    protected $note = [];
81
82
    /**
83
     * @var array
84
     */
85
    protected $obje = [];
86
87
    /**
88
     * @param string $sour
89
     *
90
     * @return Sour
91
     */
92
    public function setSour($sour = '')
93
    {
94
        $this->sour = $sour;
95
96
        return $this;
97
    }
98
99
    /**
100
     * @return string
101
     */
102
    public function getSour()
103
    {
104
        return $this->sour;
105
    }
106
107
    /**
108
     * @param string $titl
109
     *
110
     * @return Sour
111
     */
112
    public function setTitl($titl = '')
113
    {
114
        $this->titl = $titl;
115
116
        return $this;
117
    }
118
119
    /**
120
     * @return string
121
     */
122
    public function getTitl()
123
    {
124
        return $this->titl;
125
    }
126
127
    /**
128
     * @param string $abbr
129
     *
130
     * @return Sour
131
     */
132
    public function setAbbr($abbr = '')
133
    {
134
        $this->abbr = $abbr;
135
136
        return $this;
137
    }
138
139
    /**
140
     * @return string
141
     */
142
    public function getAbbr()
143
    {
144
        return $this->abbr;
145
    }
146
147
    /**
148
     * @param string $auth
149
     *
150
     * @return Sour
151
     */
152
    public function setAuth($auth = '')
153
    {
154
        $this->auth = $auth;
155
156
        return $this;
157
    }
158
159
    /**
160
     * @return string
161
     */
162
    public function getAuth()
163
    {
164
        return $this->auth;
165
    }
166
167
    /**
168
     * @param string $publ
169
     *
170
     * @return Sour
171
     */
172
    public function setPubl($publ = '')
173
    {
174
        $this->publ = $publ;
175
176
        return $this;
177
    }
178
179
    /**
180
     * @return string
181
     */
182
    public function getPubl()
183
    {
184
        return $this->publ;
185
    }
186
187
    /**
188
     * @param \Gedcom\Record\Repo $repo
189
     *
190
     * @return Sour
191
     */
192
    public function setRepo($repo)
193
    {
194
        $this->repo = $repo;
195
196
        return $this;
197
    }
198
199
    /**
200
     * @return \Gedcom\Record\Repo
201
     */
202
    public function getRepo()
203
    {
204
        return $this->repo;
205
    }
206
207
    /**
208
     * @param string $text
209
     *
210
     * @return Sour
211
     */
212
    public function setText($text = '')
213
    {
214
        $this->text = $text;
215
216
        return $this;
217
    }
218
219
    /**
220
     * @return string
221
     */
222
    public function getText()
223
    {
224
        return $this->text;
225
    }
226
227
    /**
228
     * @param string $data
229
     *
230
     * @return Sour
231
     */
232
    public function setData($data = '')
233
    {
234
        $this->data = $data;
0 ignored issues
show
Documentation Bug introduced by
It seems like $data of type string is incompatible with the declared type Gedcom\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...
235
236
        return $this;
237
    }
238
239
    /**
240
     * @return string
241
     */
242
    public function getData()
243
    {
244
        return $this->data;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->data returns the type Gedcom\Record\Data which is incompatible with the documented return type string.
Loading history...
245
    }
246
247
    /**
248
     * @param string $rin
249
     *
250
     * @return Sour
251
     */
252
    public function setRin($rin = '')
253
    {
254
        $this->rin = $rin;
255
256
        return $this;
257
    }
258
259
    /**
260
     * @return string
261
     */
262
    public function getRin()
263
    {
264
        return $this->rin;
265
    }
266
267
    /**
268
     * @param \Gedcom\Record\Chan $chan
269
     *
270
     * @return Sour
271
     */
272
    public function setChan($chan = [])
273
    {
274
        $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...
275
276
        return $this;
277
    }
278
279
    /**
280
     * @return \Gedcom\Record\Chan
281
     */
282
    public function getChan()
283
    {
284
        return $this->chan;
285
    }
286
287
    /**
288
     * @param Refn $refn
289
     *
290
     * @return Sour
291
     */
292
    public function addRefn($refn = [])
293
    {
294
        $this->refn[] = $refn;
295
296
        return $this;
297
    }
298
299
    /**
300
     * @return array
301
     */
302
    public function getRefn()
303
    {
304
        return $this->refn;
305
    }
306
307
    /**
308
     * @param NoteRef $note
309
     *
310
     * @return Sour
311
     */
312
    public function addNote($note = [])
313
    {
314
        $this->note[] = $note;
315
316
        return $this;
317
    }
318
319
    /**
320
     * @return array
321
     */
322
    public function getNote()
323
    {
324
        return $this->note;
325
    }
326
327
    /**
328
     * @param ObjeRef $obje
329
     *
330
     * @return Sour
331
     */
332
    public function addObje($obje = [])
333
    {
334
        $this->obje[] = $obje;
335
336
        return $this;
337
    }
338
339
    /**
340
     * @return array
341
     */
342
    public function getObje()
343
    {
344
        return $this->obje;
345
    }
346
}
347