Head::getSour()   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
 * Stores the data from the HEAD section of a GEDCOM 5.5 file.
19
 */
20
class Head extends \Gedcom\Record
21
{
22
    /**
23
     * @var Head\Sour
24
     */
25
    protected $sour;
26
27
    /**
28
     * @var string
29
     */
30
    protected $dest;
31
32
    /**
33
     * @var Head\Date
34
     */
35
    protected $date;
36
37
    /**
38
     * @var string
39
     */
40
    protected $subm;
41
42
    /**
43
     * @var string
44
     */
45
    protected $subn;
46
47
    /**
48
     * @var string
49
     */
50
    protected $file;
51
52
    /**
53
     * @var string
54
     */
55
    protected $copr;
56
57
    /**
58
     * @var Head\Gedc
59
     */
60
    protected $gedc;
61
62
    /**
63
     * @var Head\Char
64
     */
65
    protected $char;
66
67
    /**
68
     * @var string
69
     */
70
    protected $lang;
71
72
    /**
73
     * @var Head\Plac
74
     */
75
    protected $plac;
76
77
    /**
78
     * @var string
79
     */
80
    protected $note;
81
82
    /**
83
     * @param \Gedcom\Record\Head\Sour $sour
84
     *
85
     * @return Head
86
     */
87
    public function setSour($sour = [])
88
    {
89
        $this->sour = $sour;
0 ignored issues
show
Documentation Bug introduced by
It seems like $sour can also be of type array. However, the property $sour is declared as type Gedcom\Record\Head\Sour. 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...
90
91
        return $this;
92
    }
93
94
    /**
95
     * @return \Gedcom\Record\Head\Sour
96
     */
97
    public function getSour()
98
    {
99
        return $this->sour;
100
    }
101
102
    /**
103
     * @param \Gedcom\Record\Head\Date $date
104
     *
105
     * @return Head
106
     */
107
    public function setDate($date = [])
108
    {
109
        $this->date = $date;
0 ignored issues
show
Documentation Bug introduced by
It seems like $date can also be of type array. However, the property $date is declared as type Gedcom\Record\Head\Date. 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...
110
111
        return $this;
112
    }
113
114
    /**
115
     * @return \Gedcom\Record\Head\Date
116
     */
117
    public function getDate()
118
    {
119
        return $this->date;
120
    }
121
122
    /**
123
     * @param \Gedcom\Record\Head\Gedc $gedc
124
     *
125
     * @return Head
126
     */
127
    public function setGedc($gedc = [])
128
    {
129
        $this->gedc = $gedc;
0 ignored issues
show
Documentation Bug introduced by
It seems like $gedc can also be of type array. However, the property $gedc is declared as type Gedcom\Record\Head\Gedc. 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...
130
131
        return $this;
132
    }
133
134
    /**
135
     * @return \Gedcom\Record\Head\Gedc
136
     */
137
    public function getGedc()
138
    {
139
        return $this->gedc;
140
    }
141
142
    /**
143
     * @param \Gedcom\Record\Head\Char $char
144
     *
145
     * @return Head
146
     */
147
    public function setChar($char = [])
148
    {
149
        $this->char = $char;
0 ignored issues
show
Documentation Bug introduced by
It seems like $char can also be of type array. However, the property $char is declared as type Gedcom\Record\Head\Char. 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...
150
151
        return $this;
152
    }
153
154
    /**
155
     * @return \Gedcom\Record\Head\Char
156
     */
157
    public function getChar()
158
    {
159
        return $this->char;
160
    }
161
162
    /**
163
     * @param \Gedcom\Record\Head\Plac $plac
164
     *
165
     * @return Head
166
     */
167
    public function setPlac($plac = [])
168
    {
169
        $this->plac = $plac;
0 ignored issues
show
Documentation Bug introduced by
It seems like $plac can also be of type array. However, the property $plac is declared as type Gedcom\Record\Head\Plac. 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...
170
171
        return $this;
172
    }
173
174
    /**
175
     * @return \Gedcom\Record\Head\Plac
176
     */
177
    public function getPlac()
178
    {
179
        return $this->plac;
180
    }
181
182
    /**
183
     * @param string $subm
184
     *
185
     * @return Head
186
     */
187
    public function setSubm($subm = '')
188
    {
189
        $this->subm = $subm;
190
191
        return $this;
192
    }
193
194
    /**
195
     * @return string
196
     */
197
    public function getSubm()
198
    {
199
        return $this->subm;
200
    }
201
202
    /**
203
     * @param string $subn
204
     *
205
     * @return Head
206
     */
207
    public function setSubn($subn = '')
208
    {
209
        $this->subn = $subn;
210
211
        return $this;
212
    }
213
214
    /**
215
     * @return string
216
     */
217
    public function getSubn()
218
    {
219
        return $this->subn;
220
    }
221
222
    /**
223
     * @param string $lang
224
     *
225
     * @return Head
226
     */
227
    public function setLang($lang = '')
228
    {
229
        $this->lang = $lang;
230
231
        return $this;
232
    }
233
234
    /**
235
     * @return string
236
     */
237
    public function getLang()
238
    {
239
        return $this->lang;
240
    }
241
242
    /**
243
     * @param string $file
244
     *
245
     * @return Head
246
     */
247
    public function setFile($file = '')
248
    {
249
        $this->file = $file;
250
251
        return $this;
252
    }
253
254
    /**
255
     * @return string
256
     */
257
    public function getFile()
258
    {
259
        return $this->file;
260
    }
261
262
    /**
263
     * @param string $dest
264
     *
265
     * @return Head
266
     */
267
    public function setDest($dest = '')
268
    {
269
        $this->dest = $dest;
270
271
        return $this;
272
    }
273
274
    /**
275
     * @return string
276
     */
277
    public function getDest()
278
    {
279
        return $this->dest;
280
    }
281
282
    /**
283
     * @param string $copr
284
     *
285
     * @return Head
286
     */
287
    public function setCopr($copr = '')
288
    {
289
        $this->copr = $copr;
290
291
        return $this;
292
    }
293
294
    /**
295
     * @return string
296
     */
297
    public function getCopr()
298
    {
299
        return $this->copr;
300
    }
301
302
    /**
303
     * @param string $note
304
     *
305
     * @return Head
306
     */
307
    public function setNote($note = '')
308
    {
309
        $this->note = $note;
310
311
        return $this;
312
    }
313
314
    /**
315
     * @return string
316
     */
317
    public function getNote()
318
    {
319
        return $this->note;
320
    }
321
}
322