Repo   A
last analyzed

Complexity

Total Complexity 25

Size/Duplication

Total Lines 280
Duplicated Lines 0 %

Importance

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

22 Methods

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