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

Sour::setPubl()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

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