Completed
Push — master ( 53b99e...05e097 )
by Basil
03:48
created

PersonTrait   F

Complexity

Total Complexity 90

Size/Duplication

Total Lines 1016
Duplicated Lines 1.38 %

Coupling/Cohesion

Components 2
Dependencies 2

Importance

Changes 1
Bugs 1 Features 0
Metric Value
wmc 90
lcom 2
cbo 2
dl 14
loc 1016
rs 1.536
c 1
b 1
f 0

90 Methods

Rating   Name   Duplication   Size   Complexity  
A getAdditionalName() 0 4 1
A setAdditionalName() 0 5 1
A getAddress() 0 4 1
A setAddress() 0 5 1
A getAffiliation() 0 4 1
A setAffiliation() 0 5 1
A getAward() 0 4 1
A setAward() 0 5 1
A getBirthDate() 0 4 1
A setBirthDate() 0 5 1
A getBirthPlace() 0 4 1
A setBirthPlace() 0 5 1
A getBrand() 0 4 1
A setBrand() 0 5 1
A getChildren() 0 4 1
A setChildren() 0 5 1
A getColleague() 0 4 1
A setColleague() 0 5 1
A getContactPoint() 0 4 1
A setContactPoint() 0 5 1
A getDeathDate() 0 4 1
A setDeathDate() 0 5 1
A getDeathPlace() 0 4 1
A setDeathPlace() 0 5 1
A getDuns() 0 4 1
A setDuns() 0 5 1
A getEmail() 0 4 1
A setEmail() 0 5 1
A getFamilyName() 0 4 1
A setFamilyName() 0 5 1
A getFaxNumber() 0 4 1
A setFaxNumber() 0 5 1
A getFollows() 0 4 1
A setFollows() 0 5 1
A getFunder() 0 4 1
A setFunder() 7 7 1
A getGender() 0 4 1
A setGender() 0 5 1
A getGivenName() 0 4 1
A setGivenName() 0 5 1
A getGlobalLocationNumber() 0 4 1
A setGlobalLocationNumber() 0 5 1
A getHasPOS() 0 4 1
A setHasPOS() 0 5 1
A getHeight() 0 4 1
A setHeight() 0 5 1
A getHomeLocation() 0 4 1
A setHomeLocation() 0 5 1
A getHonorificPrefix() 0 4 1
A setHonorificPrefix() 0 5 1
A getHonorificSuffix() 0 4 1
A setHonorificSuffix() 0 5 1
A getIsicV4() 0 4 1
A setIsicV4() 0 5 1
A getJobTitle() 0 4 1
A setJobTitle() 0 5 1
A getKnows() 0 4 1
A setKnows() 0 5 1
A getMakesOffer() 0 4 1
A setMakesOffer() 0 5 1
A getMemberOf() 0 4 1
A setMemberOf() 0 5 1
A getNaics() 0 4 1
A setNaics() 0 5 1
A getNationality() 0 4 1
A setNationality() 0 5 1
A getParent() 0 4 1
A setParent() 0 5 1
A getPerformerIn() 0 4 1
A setPerformerIn() 0 5 1
A getPublishingPrinciples() 0 4 1
A setPublishingPrinciples() 0 5 1
A getRelatedTo() 0 4 1
A setRelatedTo() 0 5 1
A getSibling() 0 4 1
A setSibling() 0 5 1
A getSponsor() 0 4 1
A setSponsor() 7 7 1
A getSpouse() 0 4 1
A setSpouse() 0 5 1
A getTaxID() 0 4 1
A setTaxID() 0 5 1
A getTelephone() 0 4 1
A setTelephone() 0 5 1
A getVatID() 0 4 1
A setVatID() 0 5 1
A getWorkLocation() 0 4 1
A setWorkLocation() 0 5 1
A getWorksFor() 0 4 1
A setWorksFor() 0 5 1

How to fix   Duplicated Code    Complexity   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

Complex Class

 Tip:   Before tackling complexity, make sure that you eliminate any duplication first. This often can reduce the size of classes significantly.

Complex classes like PersonTrait often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.

Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.

While breaking up the class, it is a good idea to analyze how other classes use PersonTrait, and based on these observations, apply Extract Interface, too.

1
<?php
2
3
namespace luya\web\jsonld;
4
5
use luya\helpers\ObjectHelper;
6
7
/**
8
 * JsonLd - Person trait
9
 *
10
 * @see http://schema.org/Person
11
 *
12
 * @author Alex Schmid
13
 * @since 1.0.0
14
 */
15
trait PersonTrait
16
{
17
    private $_additionalName;
18
19
    /**
20
     * @return string
21
     */
22
    public function getAdditionalName()
23
    {
24
        return $this->_additionalName;
25
    }
26
27
    /**
28
     * An additional name for a Person, can be used for a middle name.
29
     *
30
     * @param string $additionalName
31
     * @return PersonTrait
0 ignored issues
show
Comprehensibility Bug introduced by
The return type PersonTrait is a trait, and thus cannot be used for type-hinting in PHP. Maybe consider adding an interface and use that for type-hinting?

In PHP traits cannot be used for type-hinting as they do not define a well-defined structure. This is because any class that uses a trait can rename that trait’s methods.

If you would like to return an object that has a guaranteed set of methods, you could create a companion interface that lists these methods explicitly.

Loading history...
32
     */
33
    public function setAdditionalName($additionalName)
34
    {
35
        $this->_additionalName = $additionalName;
36
        return $this;
37
    }
38
39
    private $_address;
40
41
    /**
42
     * @return PostalAddress|string
43
     */
44
    public function getAddress()
45
    {
46
        return $this->_address;
47
    }
48
49
    /**
50
     * Physical address of the item.
51
     *
52
     * @param PostalAddress|string $address
53
     * @return PersonTrait
0 ignored issues
show
Comprehensibility Bug introduced by
The return type PersonTrait is a trait, and thus cannot be used for type-hinting in PHP. Maybe consider adding an interface and use that for type-hinting?

In PHP traits cannot be used for type-hinting as they do not define a well-defined structure. This is because any class that uses a trait can rename that trait’s methods.

If you would like to return an object that has a guaranteed set of methods, you could create a companion interface that lists these methods explicitly.

Loading history...
54
     */
55
    public function setAddress(PostalAddress $address)
56
    {
57
        $this->_address = $address;
58
        return $this;
59
    }
60
61
    private $_affiliation;
62
63
    /**
64
     * @return Organization
65
     */
66
    public function getAffiliation()
67
    {
68
        return $this->_affiliation;
69
    }
70
71
    /**
72
     * An organization that this person is affiliated with. For example, a school/university, a club, or a team.
73
     *
74
     * @param Organization $affiliation
75
     * @return PersonTrait
0 ignored issues
show
Comprehensibility Bug introduced by
The return type PersonTrait is a trait, and thus cannot be used for type-hinting in PHP. Maybe consider adding an interface and use that for type-hinting?

In PHP traits cannot be used for type-hinting as they do not define a well-defined structure. This is because any class that uses a trait can rename that trait’s methods.

If you would like to return an object that has a guaranteed set of methods, you could create a companion interface that lists these methods explicitly.

Loading history...
76
     */
77
    public function setAffiliation(Organization $affiliation)
78
    {
79
        $this->_affiliation = $affiliation;
80
        return $this;
81
    }
82
83
    private $_award;
84
85
    /**
86
     * @return string
87
     */
88
    public function getAward()
89
    {
90
        return $this->_award;
91
    }
92
93
    /**
94
     * An award won by or for this item.
95
     * Supersedes awards.
96
     *
97
     * @param string $award
98
     * @return PersonTrait
0 ignored issues
show
Comprehensibility Bug introduced by
The return type PersonTrait is a trait, and thus cannot be used for type-hinting in PHP. Maybe consider adding an interface and use that for type-hinting?

In PHP traits cannot be used for type-hinting as they do not define a well-defined structure. This is because any class that uses a trait can rename that trait’s methods.

If you would like to return an object that has a guaranteed set of methods, you could create a companion interface that lists these methods explicitly.

Loading history...
99
     */
100
    public function setAward($award)
101
    {
102
        $this->_award = $award;
103
        return $this;
104
    }
105
106
    private $_birthDate;
107
108
    /**
109
     * @return string
110
     */
111
    public function getBirthDate()
112
    {
113
        return $this->_birthDate;
114
    }
115
116
    /**
117
     * Date of birth.
118
     *
119
     * @param DateValue $birthDate
120
     * @return PersonTrait
0 ignored issues
show
Comprehensibility Bug introduced by
The return type PersonTrait is a trait, and thus cannot be used for type-hinting in PHP. Maybe consider adding an interface and use that for type-hinting?

In PHP traits cannot be used for type-hinting as they do not define a well-defined structure. This is because any class that uses a trait can rename that trait’s methods.

If you would like to return an object that has a guaranteed set of methods, you could create a companion interface that lists these methods explicitly.

Loading history...
121
     */
122
    public function setBirthDate(DateValue $birthDate)
123
    {
124
        $this->_birthDate = $birthDate->getValue();
125
        return $this;
126
    }
127
128
    private $_birthPlace;
129
130
    /**
131
     * @return Place
132
     */
133
    public function getBirthPlace()
134
    {
135
        return $this->_birthPlace;
136
    }
137
138
    /**
139
     * The place where the person was born.
140
     *
141
     * @param Place $birthPlace
142
     * @return PersonTrait
0 ignored issues
show
Comprehensibility Bug introduced by
The return type PersonTrait is a trait, and thus cannot be used for type-hinting in PHP. Maybe consider adding an interface and use that for type-hinting?

In PHP traits cannot be used for type-hinting as they do not define a well-defined structure. This is because any class that uses a trait can rename that trait’s methods.

If you would like to return an object that has a guaranteed set of methods, you could create a companion interface that lists these methods explicitly.

Loading history...
143
     */
144
    public function setBirthPlace($birthPlace)
145
    {
146
        $this->_birthPlace = $birthPlace;
147
        return $this;
148
    }
149
150
    private $_brand;
151
152
    /**
153
     * @return Brand|Organization
154
     */
155
    public function getBrand()
156
    {
157
        return $this->_brand;
158
    }
159
160
    /**
161
     * The brand(s) associated with a product or service, or the brand(s) maintained by an organization or business person.
162
     *
163
     * @param Brand|Organization $brand
164
     * @return PersonTrait
0 ignored issues
show
Comprehensibility Bug introduced by
The return type PersonTrait is a trait, and thus cannot be used for type-hinting in PHP. Maybe consider adding an interface and use that for type-hinting?

In PHP traits cannot be used for type-hinting as they do not define a well-defined structure. This is because any class that uses a trait can rename that trait’s methods.

If you would like to return an object that has a guaranteed set of methods, you could create a companion interface that lists these methods explicitly.

Loading history...
165
     */
166
    public function setBrand($brand)
167
    {
168
        $this->_brand = $brand;
169
        return $this;
170
    }
171
172
    private $_children;
173
174
    /**
175
     * @return Person
176
     */
177
    public function getChildren()
178
    {
179
        return $this->_children;
180
    }
181
182
    /**
183
     * A child of the person.
184
     *
185
     * @param Person $children
186
     * @return PersonTrait
0 ignored issues
show
Comprehensibility Bug introduced by
The return type PersonTrait is a trait, and thus cannot be used for type-hinting in PHP. Maybe consider adding an interface and use that for type-hinting?

In PHP traits cannot be used for type-hinting as they do not define a well-defined structure. This is because any class that uses a trait can rename that trait’s methods.

If you would like to return an object that has a guaranteed set of methods, you could create a companion interface that lists these methods explicitly.

Loading history...
187
     */
188
    public function setChildren(Person $children)
189
    {
190
        $this->_children = $children;
191
        return $this;
192
    }
193
194
    private $_colleague;
195
196
    /**
197
     * @return Person
198
     */
199
    public function getColleague()
200
    {
201
        return $this->_colleague;
202
    }
203
204
    /**
205
     * A colleague of the person.
206
     *
207
     * Supersedes colleagues.
208
     *
209
     * @param Person $colleague
210
     * @return PersonTrait
0 ignored issues
show
Comprehensibility Bug introduced by
The return type PersonTrait is a trait, and thus cannot be used for type-hinting in PHP. Maybe consider adding an interface and use that for type-hinting?

In PHP traits cannot be used for type-hinting as they do not define a well-defined structure. This is because any class that uses a trait can rename that trait’s methods.

If you would like to return an object that has a guaranteed set of methods, you could create a companion interface that lists these methods explicitly.

Loading history...
211
     */
212
    public function setColleague(Person $colleague)
213
    {
214
        $this->_colleague = $colleague;
215
        return $this;
216
    }
217
218
    private $_contactPoint;
219
220
    /**
221
     * @return ContactPoint
222
     */
223
    public function getContactPoint()
224
    {
225
        return $this->_contactPoint;
226
    }
227
228
    /**
229
     * A contact point for a person or organization.
230
     *
231
     * Supersedes contactPoints.
232
     *
233
     * @param ContactPoint $contactPoint
234
     * @return PersonTrait
0 ignored issues
show
Comprehensibility Bug introduced by
The return type PersonTrait is a trait, and thus cannot be used for type-hinting in PHP. Maybe consider adding an interface and use that for type-hinting?

In PHP traits cannot be used for type-hinting as they do not define a well-defined structure. This is because any class that uses a trait can rename that trait’s methods.

If you would like to return an object that has a guaranteed set of methods, you could create a companion interface that lists these methods explicitly.

Loading history...
235
     */
236
    public function setContactPoint(ContactPoint $contactPoint)
237
    {
238
        $this->_contactPoint = $contactPoint;
239
        return $this;
240
    }
241
242
    private $_deathDate;
243
244
    /**
245
     * @return string
246
     */
247
    public function getDeathDate()
248
    {
249
        return $this->_deathDate;
250
    }
251
252
    /**
253
     * Date of death.
254
     *
255
     * @param DateValue $deathDate
256
     * @return PersonTrait
0 ignored issues
show
Comprehensibility Bug introduced by
The return type PersonTrait is a trait, and thus cannot be used for type-hinting in PHP. Maybe consider adding an interface and use that for type-hinting?

In PHP traits cannot be used for type-hinting as they do not define a well-defined structure. This is because any class that uses a trait can rename that trait’s methods.

If you would like to return an object that has a guaranteed set of methods, you could create a companion interface that lists these methods explicitly.

Loading history...
257
     */
258
    public function setDeathDate(DateValue $deathDate)
259
    {
260
        $this->_deathDate = $deathDate->getValue();
261
        return $this;
262
    }
263
264
    private $_deathPlace;
265
266
    /**
267
     * @return Place
268
     */
269
    public function getDeathPlace()
270
    {
271
        return $this->_deathPlace;
272
    }
273
274
    /**
275
     * The place where the person died.
276
     *
277
     * @param Place $deathPlace
278
     * @return PersonTrait
0 ignored issues
show
Comprehensibility Bug introduced by
The return type PersonTrait is a trait, and thus cannot be used for type-hinting in PHP. Maybe consider adding an interface and use that for type-hinting?

In PHP traits cannot be used for type-hinting as they do not define a well-defined structure. This is because any class that uses a trait can rename that trait’s methods.

If you would like to return an object that has a guaranteed set of methods, you could create a companion interface that lists these methods explicitly.

Loading history...
279
     */
280
    public function setDeathPlace(Place $deathPlace)
281
    {
282
        $this->_deathPlace = $deathPlace;
283
        return $this;
284
    }
285
286
    private $_duns;
287
288
    /**
289
     * @return string
290
     */
291
    public function getDuns()
292
    {
293
        return $this->_duns;
294
    }
295
296
    /**
297
     * The Dun & Bradstreet DUNS number for identifying an organization or business person.
298
     *
299
     * @param string $duns
300
     * @return PersonTrait
0 ignored issues
show
Comprehensibility Bug introduced by
The return type PersonTrait is a trait, and thus cannot be used for type-hinting in PHP. Maybe consider adding an interface and use that for type-hinting?

In PHP traits cannot be used for type-hinting as they do not define a well-defined structure. This is because any class that uses a trait can rename that trait’s methods.

If you would like to return an object that has a guaranteed set of methods, you could create a companion interface that lists these methods explicitly.

Loading history...
301
     */
302
    public function setDuns(Person $duns)
303
    {
304
        $this->_duns = $duns;
305
        return $this;
306
    }
307
308
    private $_email;
309
310
    /**
311
     * @return string
312
     */
313
    public function getEmail()
314
    {
315
        return $this->_email;
316
    }
317
318
    /**
319
     * Email address.
320
     *
321
     * @param string $email
322
     * @return PersonTrait
0 ignored issues
show
Comprehensibility Bug introduced by
The return type PersonTrait is a trait, and thus cannot be used for type-hinting in PHP. Maybe consider adding an interface and use that for type-hinting?

In PHP traits cannot be used for type-hinting as they do not define a well-defined structure. This is because any class that uses a trait can rename that trait’s methods.

If you would like to return an object that has a guaranteed set of methods, you could create a companion interface that lists these methods explicitly.

Loading history...
323
     */
324
    public function setEmail($email)
325
    {
326
        $this->_email = $email;
327
        return $this;
328
    }
329
330
    private $_familyName;
331
332
    /**
333
     * @return string
334
     */
335
    public function getFamilyName()
336
    {
337
        return $this->_familyName;
338
    }
339
340
    /**
341
     * Family name. In the U.S., the last name of an Person.
342
     * This can be used along with givenName instead of the name property.
343
     *
344
     * @param string $familyName
345
     * @return PersonTrait
0 ignored issues
show
Comprehensibility Bug introduced by
The return type PersonTrait is a trait, and thus cannot be used for type-hinting in PHP. Maybe consider adding an interface and use that for type-hinting?

In PHP traits cannot be used for type-hinting as they do not define a well-defined structure. This is because any class that uses a trait can rename that trait’s methods.

If you would like to return an object that has a guaranteed set of methods, you could create a companion interface that lists these methods explicitly.

Loading history...
346
     */
347
    public function setFamilyName($familyName)
348
    {
349
        $this->_familyName = $familyName;
350
        return $this;
351
    }
352
353
    private $_faxNumber;
354
355
    /**
356
     * @return string
357
     */
358
    public function getFaxNumber()
359
    {
360
        return $this->_faxNumber;
361
    }
362
363
    /**
364
     * The fax number.
365
     *
366
     * @param string $faxNumber
367
     * @return PersonTrait
0 ignored issues
show
Comprehensibility Bug introduced by
The return type PersonTrait is a trait, and thus cannot be used for type-hinting in PHP. Maybe consider adding an interface and use that for type-hinting?

In PHP traits cannot be used for type-hinting as they do not define a well-defined structure. This is because any class that uses a trait can rename that trait’s methods.

If you would like to return an object that has a guaranteed set of methods, you could create a companion interface that lists these methods explicitly.

Loading history...
368
     */
369
    public function setFaxNumber($faxNumber)
370
    {
371
        $this->_faxNumber = $faxNumber;
372
        return $this;
373
    }
374
375
    private $_follows;
376
377
    /**
378
     * @return Person
379
     */
380
    public function getFollows()
381
    {
382
        return $this->_follows;
383
    }
384
385
    /**
386
     * The most generic uni-directional social relation.
387
     *
388
     * @param Person $follows
389
     * @return PersonTrait
0 ignored issues
show
Comprehensibility Bug introduced by
The return type PersonTrait is a trait, and thus cannot be used for type-hinting in PHP. Maybe consider adding an interface and use that for type-hinting?

In PHP traits cannot be used for type-hinting as they do not define a well-defined structure. This is because any class that uses a trait can rename that trait’s methods.

If you would like to return an object that has a guaranteed set of methods, you could create a companion interface that lists these methods explicitly.

Loading history...
390
     */
391
    public function setFollows(Person $follows)
392
    {
393
        $this->_follows = $follows;
394
        return $this;
395
    }
396
397
    private $_funder;
398
399
    /**
400
     * @return Organization|Person
401
     */
402
    public function getFunder()
403
    {
404
        return $this->_funder;
405
    }
406
407
    /**
408
     * A person or organization that supports (sponsors) something through some kind of financial contribution.
409
     *
410
     * @param Organization|Person $funder
411
     * @return PersonTrait
0 ignored issues
show
Comprehensibility Bug introduced by
The return type PersonTrait is a trait, and thus cannot be used for type-hinting in PHP. Maybe consider adding an interface and use that for type-hinting?

In PHP traits cannot be used for type-hinting as they do not define a well-defined structure. This is because any class that uses a trait can rename that trait’s methods.

If you would like to return an object that has a guaranteed set of methods, you could create a companion interface that lists these methods explicitly.

Loading history...
412
     */
413 View Code Duplication
    public function setFunder($funder)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
414
    {
415
        ObjectHelper::isInstanceOf($funder, [Organization::class, PersonInterface::class]);
0 ignored issues
show
Documentation introduced by
$funder is of type object<luya\web\jsonld\O...luya\web\jsonld\Person>, but the function expects a string.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
416
        
417
        $this->_funder = $funder;
418
        return $this;
419
    }
420
421
    private $_gender;
422
423
    /**
424
     * @return GenderType|string
425
     */
426
    public function getGender()
427
    {
428
        return $this->_gender;
429
    }
430
431
    /**
432
     * Gender of the person. While http://schema.org/Male and http://schema.org/Female may be used,
433
     * text strings are also acceptable for people who do not identify as a binary gender.
434
     *
435
     * @param GenderType|string $gender
436
     * @return PersonTrait
0 ignored issues
show
Comprehensibility Bug introduced by
The return type PersonTrait is a trait, and thus cannot be used for type-hinting in PHP. Maybe consider adding an interface and use that for type-hinting?

In PHP traits cannot be used for type-hinting as they do not define a well-defined structure. This is because any class that uses a trait can rename that trait’s methods.

If you would like to return an object that has a guaranteed set of methods, you could create a companion interface that lists these methods explicitly.

Loading history...
437
     */
438
    public function setGender($gender)
439
    {
440
        $this->_gender = $gender;
441
        return $this;
442
    }
443
444
    private $_givenName;
445
446
    /**
447
     * @return string
448
     */
449
    public function getGivenName()
450
    {
451
        return $this->_givenName;
452
    }
453
454
    /**
455
     * Given name. In the U.S., the first name of a Person.
456
     * This can be used along with familyName instead of the name property.
457
     *
458
     * @param string $givenName
459
     * @return PersonTrait
0 ignored issues
show
Comprehensibility Bug introduced by
The return type PersonTrait is a trait, and thus cannot be used for type-hinting in PHP. Maybe consider adding an interface and use that for type-hinting?

In PHP traits cannot be used for type-hinting as they do not define a well-defined structure. This is because any class that uses a trait can rename that trait’s methods.

If you would like to return an object that has a guaranteed set of methods, you could create a companion interface that lists these methods explicitly.

Loading history...
460
     */
461
    public function setGivenName($givenName)
462
    {
463
        $this->_givenName = $givenName;
464
        return $this;
465
    }
466
467
    private $_globalLocationNumber;
468
469
    /**
470
     * @return string
471
     */
472
    public function getGlobalLocationNumber()
473
    {
474
        return $this->_globalLocationNumber;
475
    }
476
477
    /**
478
     * The Global Location Number (GLN, sometimes also referred to as International Location Number or ILN)
479
     * of the respective organization, person, or place.
480
     * The GLN is a 13-digit number used to identify parties and physical locations.
481
     *
482
     * @param string $globalLocationNumber
483
     * @return PersonTrait
0 ignored issues
show
Comprehensibility Bug introduced by
The return type PersonTrait is a trait, and thus cannot be used for type-hinting in PHP. Maybe consider adding an interface and use that for type-hinting?

In PHP traits cannot be used for type-hinting as they do not define a well-defined structure. This is because any class that uses a trait can rename that trait’s methods.

If you would like to return an object that has a guaranteed set of methods, you could create a companion interface that lists these methods explicitly.

Loading history...
484
     */
485
    public function setGlobalLocationNumber($globalLocationNumber)
486
    {
487
        $this->_globalLocationNumber = $globalLocationNumber;
488
        return $this;
489
    }
490
491
    private $_hasPOS;
492
493
    /**
494
     * @return Place
495
     */
496
    public function getHasPOS()
497
    {
498
        return $this->_hasPOS;
499
    }
500
501
    /**
502
     * Points-of-Sales operated by the organization or person.
503
     *
504
     * @param Place $hasPOS
505
     * @return PersonTrait
0 ignored issues
show
Comprehensibility Bug introduced by
The return type PersonTrait is a trait, and thus cannot be used for type-hinting in PHP. Maybe consider adding an interface and use that for type-hinting?

In PHP traits cannot be used for type-hinting as they do not define a well-defined structure. This is because any class that uses a trait can rename that trait’s methods.

If you would like to return an object that has a guaranteed set of methods, you could create a companion interface that lists these methods explicitly.

Loading history...
506
     */
507
    public function setHasPOS($hasPOS)
508
    {
509
        $this->_hasPOS = $hasPOS;
510
        return $this;
511
    }
512
513
    private $_height;
514
515
    /**
516
     * @return Distance|QuantitativeValue
517
     */
518
    public function getHeight()
519
    {
520
        return $this->_height;
521
    }
522
523
    /**
524
     * The height of the item.
525
     *
526
     * @param Distance|QuantitativeValue $height
527
     * @return PersonTrait
0 ignored issues
show
Comprehensibility Bug introduced by
The return type PersonTrait is a trait, and thus cannot be used for type-hinting in PHP. Maybe consider adding an interface and use that for type-hinting?

In PHP traits cannot be used for type-hinting as they do not define a well-defined structure. This is because any class that uses a trait can rename that trait’s methods.

If you would like to return an object that has a guaranteed set of methods, you could create a companion interface that lists these methods explicitly.

Loading history...
528
     */
529
    public function setHeight($height)
530
    {
531
        $this->_height = $height;
532
        return $this;
533
    }
534
535
    private $_homeLocation;
536
537
    /**
538
     * @return ContactPoint|Place
539
     */
540
    public function getHomeLocation()
541
    {
542
        return $this->_homeLocation;
543
    }
544
545
    /**
546
     * A contact location for a person's residence.
547
     *
548
     * @param ContactPoint|Place $homeLocation
549
     * @return PersonTrait
0 ignored issues
show
Comprehensibility Bug introduced by
The return type PersonTrait is a trait, and thus cannot be used for type-hinting in PHP. Maybe consider adding an interface and use that for type-hinting?

In PHP traits cannot be used for type-hinting as they do not define a well-defined structure. This is because any class that uses a trait can rename that trait’s methods.

If you would like to return an object that has a guaranteed set of methods, you could create a companion interface that lists these methods explicitly.

Loading history...
550
     */
551
    public function setHomeLocation($homeLocation)
552
    {
553
        $this->_homeLocation = $homeLocation;
554
        return $this;
555
    }
556
557
    private $_honorificPrefix;
558
559
    /**
560
     * @return string
561
     */
562
    public function getHonorificPrefix()
563
    {
564
        return $this->_honorificPrefix;
565
    }
566
567
    /**
568
     * An honorific prefix preceding a Person's name such as Dr/Mrs/Mr.
569
     *
570
     * @param string $honorificPrefix
571
     * @return PersonTrait
0 ignored issues
show
Comprehensibility Bug introduced by
The return type PersonTrait is a trait, and thus cannot be used for type-hinting in PHP. Maybe consider adding an interface and use that for type-hinting?

In PHP traits cannot be used for type-hinting as they do not define a well-defined structure. This is because any class that uses a trait can rename that trait’s methods.

If you would like to return an object that has a guaranteed set of methods, you could create a companion interface that lists these methods explicitly.

Loading history...
572
     */
573
    public function setHonorificPrefix($honorificPrefix)
574
    {
575
        $this->_honorificPrefix = $honorificPrefix;
576
        return $this;
577
    }
578
579
    private $_honorificSuffix;
580
581
    /**
582
     * @return string
583
     */
584
    public function getHonorificSuffix()
585
    {
586
        return $this->_honorificSuffix;
587
    }
588
589
    /**
590
     * An honorific suffix preceding a Person's name such as M.D. /PhD/MSCSW.
591
     *
592
     * @param string $honorificSuffix
593
     * @return PersonTrait
0 ignored issues
show
Comprehensibility Bug introduced by
The return type PersonTrait is a trait, and thus cannot be used for type-hinting in PHP. Maybe consider adding an interface and use that for type-hinting?

In PHP traits cannot be used for type-hinting as they do not define a well-defined structure. This is because any class that uses a trait can rename that trait’s methods.

If you would like to return an object that has a guaranteed set of methods, you could create a companion interface that lists these methods explicitly.

Loading history...
594
     */
595
    public function setHonorificSuffix($honorificSuffix)
596
    {
597
        $this->_honorificSuffix = $honorificSuffix;
598
        return $this;
599
    }
600
601
    private $_isicV4;
602
603
    /**
604
     * @return string
605
     */
606
    public function getIsicV4()
607
    {
608
        return $this->_isicV4;
609
    }
610
611
    /**
612
     * The International Standard of Industrial Classification of All Economic Activities (ISIC),
613
     * Revision 4 code for a particular organization, business person, or place.
614
     *
615
     * @param string $isicV4
616
     * @return PersonTrait
0 ignored issues
show
Comprehensibility Bug introduced by
The return type PersonTrait is a trait, and thus cannot be used for type-hinting in PHP. Maybe consider adding an interface and use that for type-hinting?

In PHP traits cannot be used for type-hinting as they do not define a well-defined structure. This is because any class that uses a trait can rename that trait’s methods.

If you would like to return an object that has a guaranteed set of methods, you could create a companion interface that lists these methods explicitly.

Loading history...
617
     */
618
    public function setIsicV4($isicV4)
619
    {
620
        $this->_isicV4 = $isicV4;
621
        return $this;
622
    }
623
624
    private $_jobTitle;
625
626
    /**
627
     * @return string
628
     */
629
    public function getJobTitle()
630
    {
631
        return $this->_jobTitle;
632
    }
633
634
    /**
635
     * The job title of the person (for example, Financial Manager).
636
     *
637
     * @param string $jobTitle
638
     * @return PersonTrait
0 ignored issues
show
Comprehensibility Bug introduced by
The return type PersonTrait is a trait, and thus cannot be used for type-hinting in PHP. Maybe consider adding an interface and use that for type-hinting?

In PHP traits cannot be used for type-hinting as they do not define a well-defined structure. This is because any class that uses a trait can rename that trait’s methods.

If you would like to return an object that has a guaranteed set of methods, you could create a companion interface that lists these methods explicitly.

Loading history...
639
     */
640
    public function setJobTitle($jobTitle)
641
    {
642
        $this->_jobTitle = $jobTitle;
643
        return $this;
644
    }
645
646
    private $_knows;
647
648
    /**
649
     * @return Person
650
     */
651
    public function getKnows()
652
    {
653
        return $this->_knows;
654
    }
655
656
    /**
657
     * The most generic bi-directional social/work relation.
658
     *
659
     * @param Person $knows
660
     * @return PersonTrait
0 ignored issues
show
Comprehensibility Bug introduced by
The return type PersonTrait is a trait, and thus cannot be used for type-hinting in PHP. Maybe consider adding an interface and use that for type-hinting?

In PHP traits cannot be used for type-hinting as they do not define a well-defined structure. This is because any class that uses a trait can rename that trait’s methods.

If you would like to return an object that has a guaranteed set of methods, you could create a companion interface that lists these methods explicitly.

Loading history...
661
     */
662
    public function setKnows(Person $knows)
663
    {
664
        $this->_knows = $knows;
665
        return $this;
666
    }
667
668
    private $_makesOffer;
669
670
    /**
671
     * @return Offer
672
     */
673
    public function getMakesOffer()
674
    {
675
        return $this->_makesOffer;
676
    }
677
678
    /**
679
     * A pointer to products or services offered by the organization or person.
680
     * Inverse property: offeredBy.
681
     *
682
     * @param Offer $makesOffer
683
     * @return PersonTrait
0 ignored issues
show
Comprehensibility Bug introduced by
The return type PersonTrait is a trait, and thus cannot be used for type-hinting in PHP. Maybe consider adding an interface and use that for type-hinting?

In PHP traits cannot be used for type-hinting as they do not define a well-defined structure. This is because any class that uses a trait can rename that trait’s methods.

If you would like to return an object that has a guaranteed set of methods, you could create a companion interface that lists these methods explicitly.

Loading history...
684
     */
685
    public function setMakesOffer(Offer $makesOffer)
686
    {
687
        $this->_makesOffer = $makesOffer;
688
        return $this;
689
    }
690
691
    private $_memberOf;
692
693
    /**
694
     * @return Organization|ProgramMembership
695
     */
696
    public function getMemberOf()
697
    {
698
        return $this->_memberOf;
699
    }
700
701
    /**
702
     * An Organization (or ProgramMembership) to which this Person or Organization belongs.
703
     * Inverse property: member.
704
     *
705
     * @param Organization|ProgramMembership $memberOf
706
     * @return PersonTrait
0 ignored issues
show
Comprehensibility Bug introduced by
The return type PersonTrait is a trait, and thus cannot be used for type-hinting in PHP. Maybe consider adding an interface and use that for type-hinting?

In PHP traits cannot be used for type-hinting as they do not define a well-defined structure. This is because any class that uses a trait can rename that trait’s methods.

If you would like to return an object that has a guaranteed set of methods, you could create a companion interface that lists these methods explicitly.

Loading history...
707
     */
708
    public function setMemberOf($memberOf)
709
    {
710
        $this->_memberOf = $memberOf;
711
        return $this;
712
    }
713
714
    private $_naics;
715
716
    /**
717
     * @return string
718
     */
719
    public function getNaics()
720
    {
721
        return $this->_naics;
722
    }
723
724
    /**
725
     * The North American Industry Classification System (NAICS) code for a particular organization or business person.
726
     *
727
     * @param string $naics
728
     * @return PersonTrait
0 ignored issues
show
Comprehensibility Bug introduced by
The return type PersonTrait is a trait, and thus cannot be used for type-hinting in PHP. Maybe consider adding an interface and use that for type-hinting?

In PHP traits cannot be used for type-hinting as they do not define a well-defined structure. This is because any class that uses a trait can rename that trait’s methods.

If you would like to return an object that has a guaranteed set of methods, you could create a companion interface that lists these methods explicitly.

Loading history...
729
     */
730
    public function setNaics($naics)
731
    {
732
        $this->_naics = $naics;
733
        return $this;
734
    }
735
736
    private $_nationality;
737
738
    /**
739
     * @return Country
740
     */
741
    public function getNationality()
742
    {
743
        return $this->_nationality;
744
    }
745
746
    /**
747
     * Nationality of the person.
748
     *
749
     * @param Country $nationality
750
     * @return PersonTrait
0 ignored issues
show
Comprehensibility Bug introduced by
The return type PersonTrait is a trait, and thus cannot be used for type-hinting in PHP. Maybe consider adding an interface and use that for type-hinting?

In PHP traits cannot be used for type-hinting as they do not define a well-defined structure. This is because any class that uses a trait can rename that trait’s methods.

If you would like to return an object that has a guaranteed set of methods, you could create a companion interface that lists these methods explicitly.

Loading history...
751
     */
752
    public function setNationality(Country $nationality)
753
    {
754
        $this->_nationality = $nationality;
755
        return $this;
756
    }
757
758
    private $_parent;
759
760
    /**
761
     * @return Person
762
     */
763
    public function getParent()
764
    {
765
        return $this->_parent;
766
    }
767
768
    /**
769
     * A parent of this person. Supersedes parents.
770
     *
771
     * @param Person $parent
772
     * @return PersonTrait
0 ignored issues
show
Comprehensibility Bug introduced by
The return type PersonTrait is a trait, and thus cannot be used for type-hinting in PHP. Maybe consider adding an interface and use that for type-hinting?

In PHP traits cannot be used for type-hinting as they do not define a well-defined structure. This is because any class that uses a trait can rename that trait’s methods.

If you would like to return an object that has a guaranteed set of methods, you could create a companion interface that lists these methods explicitly.

Loading history...
773
     */
774
    public function setParent(Person $parent)
775
    {
776
        $this->_parent = $parent;
777
        return $this;
778
    }
779
780
    private $_performerIn;
781
782
    /**
783
     * @return Event
784
     */
785
    public function getPerformerIn()
786
    {
787
        return $this->_performerIn;
788
    }
789
790
    /**
791
     * Event that this person is a performer or participant in.
792
     *
793
     * @param Event $performerIn
794
     * @return PersonTrait
0 ignored issues
show
Comprehensibility Bug introduced by
The return type PersonTrait is a trait, and thus cannot be used for type-hinting in PHP. Maybe consider adding an interface and use that for type-hinting?

In PHP traits cannot be used for type-hinting as they do not define a well-defined structure. This is because any class that uses a trait can rename that trait’s methods.

If you would like to return an object that has a guaranteed set of methods, you could create a companion interface that lists these methods explicitly.

Loading history...
795
     */
796
    public function setPerformerIn(Event $performerIn)
797
    {
798
        $this->_performerIn = $performerIn;
799
        return $this;
800
    }
801
802
    private $_publishingPrinciples;
803
804
    /**
805
     * @return CreativeWork|URL
806
     */
807
    public function getPublishingPrinciples()
808
    {
809
        return $this->_publishingPrinciples;
810
    }
811
812
    /**
813
     * The publishingPrinciples property indicates (typically via URL) a document describing the editorial principles
814
     * of an Organization (or individual e.g. a Person writing a blog) that relate to their activities as a publisher,
815
     * e.g. ethics or diversity policies. When applied to a CreativeWork (e.g. NewsArticle) the principles are those
816
     * of the party primarily responsible for the creation of the CreativeWork.
817
     *
818
     * While such policies are most typically expressed in natural language, sometimes related information
819
     * (e.g. indicating a funder) can be expressed using schema.org terminology.
820
     *
821
     * @param CreativeWork|URL $publishingPrinciples
822
     * @return PersonTrait
0 ignored issues
show
Comprehensibility Bug introduced by
The return type PersonTrait is a trait, and thus cannot be used for type-hinting in PHP. Maybe consider adding an interface and use that for type-hinting?

In PHP traits cannot be used for type-hinting as they do not define a well-defined structure. This is because any class that uses a trait can rename that trait’s methods.

If you would like to return an object that has a guaranteed set of methods, you could create a companion interface that lists these methods explicitly.

Loading history...
823
     */
824
    public function setPublishingPrinciples($publishingPrinciples)
825
    {
826
        $this->_publishingPrinciples = $publishingPrinciples;
827
        return $this;
828
    }
829
830
    private $_relatedTo;
831
832
    /**
833
     * @return Person
834
     */
835
    public function getRelatedTo()
836
    {
837
        return $this->_relatedTo;
838
    }
839
840
    /**
841
     * The most generic familial relation.
842
     *
843
     * @param Person $relatedTo
844
     * @return PersonTrait
0 ignored issues
show
Comprehensibility Bug introduced by
The return type PersonTrait is a trait, and thus cannot be used for type-hinting in PHP. Maybe consider adding an interface and use that for type-hinting?

In PHP traits cannot be used for type-hinting as they do not define a well-defined structure. This is because any class that uses a trait can rename that trait’s methods.

If you would like to return an object that has a guaranteed set of methods, you could create a companion interface that lists these methods explicitly.

Loading history...
845
     */
846
    public function setRelatedTo(Person $relatedTo)
847
    {
848
        $this->_relatedTo = $relatedTo;
849
        return $this;
850
    }
851
852
    private $_sibling;
853
854
    /**
855
     * @return Person
856
     */
857
    public function getSibling()
858
    {
859
        return $this->_sibling;
860
    }
861
862
    /**
863
     * A sibling of the person. Supersedes siblings.
864
     *
865
     * @param Person $sibling
866
     * @return PersonTrait
0 ignored issues
show
Comprehensibility Bug introduced by
The return type PersonTrait is a trait, and thus cannot be used for type-hinting in PHP. Maybe consider adding an interface and use that for type-hinting?

In PHP traits cannot be used for type-hinting as they do not define a well-defined structure. This is because any class that uses a trait can rename that trait’s methods.

If you would like to return an object that has a guaranteed set of methods, you could create a companion interface that lists these methods explicitly.

Loading history...
867
     */
868
    public function setSibling(Person $sibling)
869
    {
870
        $this->_sibling = $sibling;
871
        return $this;
872
    }
873
874
    private $_sponsor;
875
876
    /**
877
     * @return Organization|Person
878
     */
879
    public function getSponsor()
880
    {
881
        return $this->_sponsor;
882
    }
883
884
    /**
885
     * A person or organization that supports a thing through a pledge, promise, or financial contribution.
886
     * e.g. a sponsor of a Medical Study or a corporate sponsor of an event.
887
     *
888
     * @param Organization|Person $sponsor
889
     * @return PersonTrait
0 ignored issues
show
Comprehensibility Bug introduced by
The return type PersonTrait is a trait, and thus cannot be used for type-hinting in PHP. Maybe consider adding an interface and use that for type-hinting?

In PHP traits cannot be used for type-hinting as they do not define a well-defined structure. This is because any class that uses a trait can rename that trait’s methods.

If you would like to return an object that has a guaranteed set of methods, you could create a companion interface that lists these methods explicitly.

Loading history...
890
     */
891 View Code Duplication
    public function setSponsor($sponsor)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
892
    {
893
        ObjectHelper::isInstanceOf($sponsor, [Organization::class, PersonInterface::class]);
0 ignored issues
show
Documentation introduced by
$sponsor is of type object<luya\web\jsonld\O...luya\web\jsonld\Person>, but the function expects a string.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
894
        
895
        $this->_sponsor = $sponsor;
896
        return $this;
897
    }
898
899
    private $_spouse;
900
901
    /**
902
     * @return Person
903
     */
904
    public function getSpouse()
905
    {
906
        return $this->_spouse;
907
    }
908
909
    /**
910
     * The person's spouse.
911
     *
912
     * @param Person $spouse
913
     * @return PersonTrait
0 ignored issues
show
Comprehensibility Bug introduced by
The return type PersonTrait is a trait, and thus cannot be used for type-hinting in PHP. Maybe consider adding an interface and use that for type-hinting?

In PHP traits cannot be used for type-hinting as they do not define a well-defined structure. This is because any class that uses a trait can rename that trait’s methods.

If you would like to return an object that has a guaranteed set of methods, you could create a companion interface that lists these methods explicitly.

Loading history...
914
     */
915
    public function setSpouse(Person $spouse)
916
    {
917
        $this->_spouse = $spouse;
918
        return $this;
919
    }
920
921
    private $_taxID;
922
923
    /**
924
     * @return string
925
     */
926
    public function getTaxID()
927
    {
928
        return $this->_taxID;
929
    }
930
931
    /**
932
     * The Tax / Fiscal ID of the organization or person, e.g. the TIN in the US or the CIF/NIF in Spain.
933
     *
934
     * @param string $taxID
935
     * @return PersonTrait
0 ignored issues
show
Comprehensibility Bug introduced by
The return type PersonTrait is a trait, and thus cannot be used for type-hinting in PHP. Maybe consider adding an interface and use that for type-hinting?

In PHP traits cannot be used for type-hinting as they do not define a well-defined structure. This is because any class that uses a trait can rename that trait’s methods.

If you would like to return an object that has a guaranteed set of methods, you could create a companion interface that lists these methods explicitly.

Loading history...
936
     */
937
    public function setTaxID($taxID)
938
    {
939
        $this->_taxID = $taxID;
940
        return $this;
941
    }
942
943
    private $_telephone;
944
945
    /**
946
     * @return string
947
     */
948
    public function getTelephone()
949
    {
950
        return $this->_telephone;
951
    }
952
953
    /**
954
     * The telephone number.
955
     *
956
     * @param string $telephone
957
     * @return PersonTrait
0 ignored issues
show
Comprehensibility Bug introduced by
The return type PersonTrait is a trait, and thus cannot be used for type-hinting in PHP. Maybe consider adding an interface and use that for type-hinting?

In PHP traits cannot be used for type-hinting as they do not define a well-defined structure. This is because any class that uses a trait can rename that trait’s methods.

If you would like to return an object that has a guaranteed set of methods, you could create a companion interface that lists these methods explicitly.

Loading history...
958
     */
959
    public function setTelephone($telephone)
960
    {
961
        $this->_telephone = $telephone;
962
        return $this;
963
    }
964
965
    private $_vatID;
966
967
    /**
968
     * @return string
969
     */
970
    public function getVatID()
971
    {
972
        return $this->_vatID;
973
    }
974
975
    /**
976
     * The Value-added Tax ID of the organization or person.
977
     *
978
     * @param string $vatID
979
     * @return PersonTrait
0 ignored issues
show
Comprehensibility Bug introduced by
The return type PersonTrait is a trait, and thus cannot be used for type-hinting in PHP. Maybe consider adding an interface and use that for type-hinting?

In PHP traits cannot be used for type-hinting as they do not define a well-defined structure. This is because any class that uses a trait can rename that trait’s methods.

If you would like to return an object that has a guaranteed set of methods, you could create a companion interface that lists these methods explicitly.

Loading history...
980
     */
981
    public function setVatID($vatID)
982
    {
983
        $this->_vatID = $vatID;
984
        return $this;
985
    }
986
987
    private $_workLocation;
988
989
    /**
990
     * @return ContactPoint|Place
991
     */
992
    public function getWorkLocation()
993
    {
994
        return $this->_workLocation;
995
    }
996
997
    /**
998
     * A contact location for a person's place of work.
999
     *
1000
     * @param ContactPoint|Place $workLocation
1001
     * @return PersonTrait
0 ignored issues
show
Comprehensibility Bug introduced by
The return type PersonTrait is a trait, and thus cannot be used for type-hinting in PHP. Maybe consider adding an interface and use that for type-hinting?

In PHP traits cannot be used for type-hinting as they do not define a well-defined structure. This is because any class that uses a trait can rename that trait’s methods.

If you would like to return an object that has a guaranteed set of methods, you could create a companion interface that lists these methods explicitly.

Loading history...
1002
     */
1003
    public function setWorkLocation($workLocation)
1004
    {
1005
        $this->_workLocation = $workLocation;
1006
        return $this;
1007
    }
1008
1009
    private $_worksFor;
1010
1011
    /**
1012
     * @return Organization
1013
     */
1014
    public function getWorksFor()
1015
    {
1016
        return $this->_worksFor;
1017
    }
1018
1019
    /**
1020
     * Organizations that the person works for.
1021
     *
1022
     * @param Organization $worksFor
1023
     * @return PersonTrait
0 ignored issues
show
Comprehensibility Bug introduced by
The return type PersonTrait is a trait, and thus cannot be used for type-hinting in PHP. Maybe consider adding an interface and use that for type-hinting?

In PHP traits cannot be used for type-hinting as they do not define a well-defined structure. This is because any class that uses a trait can rename that trait’s methods.

If you would like to return an object that has a guaranteed set of methods, you could create a companion interface that lists these methods explicitly.

Loading history...
1024
     */
1025
    public function setWorksFor(Organization $worksFor)
1026
    {
1027
        $this->_worksFor = $worksFor;
1028
        return $this;
1029
    }
1030
}
1031