Repo   A
last analyzed

Complexity

Total Complexity 25

Size/Duplication

Total Lines 280
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 51
dl 0
loc 280
rs 10
c 0
b 0
f 0
wmc 25

22 Methods

Rating   Name   Duplication   Size   Complexity  
A setChan() 0 5 1
A getRefn() 0 3 1
A addWww() 0 5 1
A getFax() 0 3 1
A getName() 0 3 1
A addFax() 0 5 1
A setAddr() 0 8 2
A getPhon() 0 3 1
A getWww() 0 3 1
A setRin() 0 5 1
A addNote() 0 8 2
A getNote() 0 3 1
A getAddr() 0 3 1
A addEmail() 0 5 1
A addPhon() 0 5 1
A getRin() 0 3 1
A getRepo() 0 3 1
A addRefn() 0 8 2
A setRepo() 0 5 1
A getEmail() 0 3 1
A getChan() 0 3 1
A setName() 0 5 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 Repo.
21
 */
22
class Repo extends Record implements Noteable
23
{
24
    /**
25
     * @var string
26
     */
27
    protected $repo;
28
29
    /**
30
     * @var string
31
     */
32
    protected $name;
33
34
    /**
35
     * @var Addr
36
     */
37
    protected $addr;
38
39
    /**
40
     * @var array
41
     */
42
    protected $phon = [];
43
    /**
44
     * @var array
45
     */
46
    protected $email = [];
47
    /**
48
     * @var array
49
     */
50
    protected $fax = [];
51
    /**
52
     * @var array
53
     */
54
    protected $www = [];
55
    /**
56
     * @var string
57
     */
58
    protected $rin;
59
60
    /**
61
     * @var Chan
62
     */
63
    protected $chan;
64
65
    /**
66
     * @var array
67
     */
68
    protected $refn = [];
69
70
    /**
71
     * @var array
72
     */
73
    protected $note = [];
74
75
    /**
76
     * @param null
77
     *
78
     * @return Repo
79
     */
80
    public function addPhon($phon = null)
81
    {
82
        $this->phon[] = $phon;
83
84
        return $this;
85
    }
86
87
    /**
88
     * @return array
89
     */
90
    public function getPhon()
91
    {
92
        return $this->phon;
93
    }
94
95
    /**
96
     * @param null
97
     *
98
     * @return Repo
99
     */
100
    public function addEmail($email = null)
101
    {
102
        $this->email[] = $email;
103
104
        return $this;
105
    }
106
107
    /**
108
     * @return array
109
     */
110
    public function getEmail()
111
    {
112
        return $this->email;
113
    }
114
115
    /**
116
     * @param null
117
     *
118
     * @return Repo
119
     */
120
    public function addFax($fax = null)
121
    {
122
        $this->fax[] = $fax;
123
124
        return $this;
125
    }
126
127
    /**
128
     * @return array
129
     */
130
    public function getFax()
131
    {
132
        return $this->fax;
133
    }
134
135
    /**
136
     * @param null
137
     *
138
     * @return Repo
139
     */
140
    public function addWww($www = null)
141
    {
142
        $this->www[] = $www;
143
144
        return $this;
145
    }
146
147
    /**
148
     * @return array
149
     */
150
    public function getWww()
151
    {
152
        return $this->www;
153
    }
154
155
    /**
156
     * @param null|\PhpGedcom\Record\Refn $refn
157
     *
158
     * @return Repo
159
     */
160
    public function addRefn($refn = null)
161
    {
162
        if (empty($refn)) {
163
            $refn = new \PhpGedcom\Record\Refn();
164
        }
165
        $this->refn[] = $refn;
166
167
        return $this;
168
    }
169
170
    /**
171
     * @return array
172
     */
173
    public function getRefn()
174
    {
175
        return $this->refn;
176
    }
177
178
    /**
179
     * @param null|\PhpGedcom\Record\NoteRef $note
180
     *
181
     * @return Repo
182
     */
183
    public function addNote($note = null)
184
    {
185
        if (empty($node)) {
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $node seems to never exist and therefore empty should always be true.
Loading history...
186
            $note = new \PhpGedcom\Record\NoteRef();
187
        }
188
        $this->note[] = $note;
189
190
        return $this;
191
    }
192
193
    /**
194
     * @return array
195
     */
196
    public function getNote()
197
    {
198
        return $this->note;
199
    }
200
201
    /**
202
     * @param string $repo
203
     *
204
     * @return Repo
205
     */
206
    public function setRepo($repo = '')
207
    {
208
        $this->repo = $repo;
209
210
        return $this;
211
    }
212
213
    /**
214
     * @return string
215
     */
216
    public function getRepo()
217
    {
218
        return $this->repo;
219
    }
220
221
    /**
222
     * @param string $name
223
     *
224
     * @return Repo
225
     */
226
    public function setName($name = '')
227
    {
228
        $this->name = $name;
229
230
        return $this;
231
    }
232
233
    /**
234
     * @return string
235
     */
236
    public function getName()
237
    {
238
        return $this->name;
239
    }
240
241
    /**
242
     * @param null|\PhpGedcom\Record\Addr $addr
243
     *
244
     * @return Repo
245
     */
246
    public function setAddr($addr = null)
247
    {
248
        if (empty($addr)) {
249
            $addr = new \PhpGedcom\Record\Addr();
250
        }
251
        $this->addr = $addr;
252
253
        return $this;
254
    }
255
256
    /**
257
     * @return \PhpGedcom\Record\Addr
258
     */
259
    public function getAddr()
260
    {
261
        return $this->addr;
262
    }
263
264
    /**
265
     * @param string $rin
266
     *
267
     * @return Repo
268
     */
269
    public function setRin($rin = '')
270
    {
271
        $this->rin = $rin;
272
273
        return $this;
274
    }
275
276
    /**
277
     * @return string
278
     */
279
    public function getRin()
280
    {
281
        return $this->rin;
282
    }
283
284
    /**
285
     * @param \PhpGedcom\Record\Chan $chan
286
     *
287
     * @return Repo
288
     */
289
    public function setChan($chan = [])
290
    {
291
        $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...
292
293
        return $this;
294
    }
295
296
    /**
297
     * @return \PhpGedcom\Record\Chan
298
     */
299
    public function getChan()
300
    {
301
        return $this->chan;
302
    }
303
}
304