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

EventTrait   C

Complexity

Total Complexity 54

Size/Duplication

Total Lines 630
Duplicated Lines 8.89 %

Coupling/Cohesion

Components 8
Dependencies 1

Importance

Changes 0
Metric Value
wmc 54
lcom 8
cbo 1
dl 56
loc 630
rs 6.4499
c 0
b 0
f 0

54 Methods

Rating   Name   Duplication   Size   Complexity  
A getAbout() 0 4 1
A setAbout() 0 5 1
A getActor() 0 4 1
A setActor() 0 5 1
A getAttendee() 0 4 1
A setAttendee() 7 7 1
A getComposer() 0 4 1
A setComposer() 7 7 1
A getContributor() 0 4 1
A setContributor() 7 7 1
A getDirector() 0 4 1
A setDirector() 0 5 1
A getDoorTime() 0 4 1
A setDoorTime() 0 5 1
A getDuration() 0 4 1
A setDuration() 0 5 1
A getEndDate() 0 4 1
A setEndDate() 0 5 1
A getFunder() 0 4 1
A setFunder() 7 7 1
A getInLanguage() 0 4 1
A setInLanguage() 0 5 1
A isAccessibleForFree() 0 4 1
A setIsAccessibleForFree() 0 5 1
A getLocation() 0 4 1
A setLocation() 0 5 1
A getMaximumAttendeeCapacity() 0 4 1
A setMaximumAttendeeCapacity() 0 4 1
A getOrganizer() 0 4 1
A setOrganizer() 7 7 1
A getPerformer() 0 4 1
A setPerformer() 7 7 1
A getPreviousStartDate() 0 4 1
A setPreviousStartDate() 0 5 1
A getRecordedIn() 0 4 1
A setRecordedIn() 0 5 1
A getRemainingAttendeeCapacity() 0 4 1
A setRemainingAttendeeCapacity() 0 5 1
A getSponsor() 0 4 1
A setSponsor() 7 7 1
A getStartDate() 0 4 1
A setStartDate() 0 5 1
A getSubEvent() 0 4 1
A setSubEvent() 0 4 1
A getSuperEvent() 0 4 1
A setSuperEvent() 0 5 1
A getTranslator() 0 4 1
A setTranslator() 7 7 1
A getTypicalAgeRange() 0 4 1
A setTypicalAgeRange() 0 5 1
A getWorkFeatured() 0 4 1
A setWorkFeatured() 0 5 1
A getWorkPerformed() 0 4 1
A setWorkPerformed() 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 EventTrait 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 EventTrait, 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 - Event trait
9
 *
10
 * @see http://schema.org/Event
11
 *
12
 * @author Alex Schmid
13
 * @since 1.0.0
14
 */
15
trait EventTrait
16
{
17
    private $_about;
18
19
    /**
20
     * @return Thing
21
     */
22
    public function getAbout()
23
    {
24
        return $this->_about;
25
    }
26
27
    /**
28
     * The subject matter of the content.
29
     * Inverse property: subjectOf.
30
     *
31
     * @param Thing $about
32
     * @return EventTrait
0 ignored issues
show
Comprehensibility Bug introduced by
The return type EventTrait 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...
33
     */
34
    public function setAbout($about)
35
    {
36
        $this->_about = $about;
37
        return $this;
38
    }
39
40
    private $_actor;
41
42
    /**
43
     * @return Person
44
     */
45
    public function getActor()
46
    {
47
        return $this->_actor;
48
    }
49
50
    /**
51
     * An actor, e.g. in tv, radio, movie, video games etc., or in an event.
52
     * Actors can be associated with individual items or with a series, episode, clip. Supersedes actors.
53
     *
54
     * @param Person $actor
55
     * @return EventTrait
0 ignored issues
show
Comprehensibility Bug introduced by
The return type EventTrait 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...
56
     */
57
    public function setActor($actor)
58
    {
59
        $this->_actor = $actor;
60
        return $this;
61
    }
62
63
    private $_attendee;
64
65
    /**
66
     * @return Organization|Person
67
     */
68
    public function getAttendee()
69
    {
70
        return $this->_attendee;
71
    }
72
73
    /**
74
     * A person or organization attending the event. Supersedes attendees.
75
     *
76
     * @param Organization|Person $attendee
77
     * @return EventTrait
0 ignored issues
show
Comprehensibility Bug introduced by
The return type EventTrait 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...
78
     */
79 View Code Duplication
    public function setAttendee($attendee)
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...
80
    {
81
        ObjectHelper::isInstanceOf($attendee, [Organization::class, PersonInterface::class]);
0 ignored issues
show
Documentation introduced by
$attendee 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...
82
        
83
        $this->_attendee = $attendee;
84
        return $this;
85
    }
86
87
    private $_composer;
88
89
    /**
90
     * @return Organization|Person
91
     */
92
    public function getComposer()
93
    {
94
        return $this->_composer;
95
    }
96
97
    /**
98
     * The person or organization who wrote a composition, or who is the composer of a work performed at some event.
99
     *
100
     * @param Organization|Person $composer
101
     * @return EventTrait
0 ignored issues
show
Comprehensibility Bug introduced by
The return type EventTrait 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...
102
     */
103 View Code Duplication
    public function setComposer($composer)
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...
104
    {
105
        ObjectHelper::isInstanceOf($author, [Organization::class, PersonInterface::class]);
0 ignored issues
show
Bug introduced by
The variable $author does not exist. Did you forget to declare it?

This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.

Loading history...
106
        
107
        $this->_composer = $composer;
108
        return $this;
109
    }
110
111
    private $_contributor;
112
113
    /**
114
     * @return Organization|Person
115
     */
116
    public function getContributor()
117
    {
118
        return $this->_contributor;
119
    }
120
121
    /**
122
     * A secondary contributor to the CreativeWork or Event.
123
     *
124
     * @param Organization|Person $contributor
125
     * @return EventTrait
0 ignored issues
show
Comprehensibility Bug introduced by
The return type EventTrait 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...
126
     */
127 View Code Duplication
    public function setContributor($contributor)
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...
128
    {
129
        ObjectHelper::isInstanceOf($contributor, [Organization::class, PersonInterface::class]);
0 ignored issues
show
Documentation introduced by
$contributor 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...
130
        
131
        $this->_contributor = $contributor;
132
        return $this;
133
    }
134
135
    private $_director;
136
137
    /**
138
     * @return Person
139
     */
140
    public function getDirector()
141
    {
142
        return $this->_director;
143
    }
144
145
    /**
146
     * A director of e.g. tv, radio, movie, video gaming etc. content, or of an event.
147
     * Directors can be associated with individual items or with a series, episode, clip.
148
     * Supersedes directors.
149
     *
150
     * @param Person $director
151
     * @return EventTrait
0 ignored issues
show
Comprehensibility Bug introduced by
The return type EventTrait 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...
152
     */
153
    public function setDirector($director)
154
    {
155
        $this->_director = $director;
156
        return $this;
157
    }
158
159
    private $_doorTime;
160
161
    /**
162
     * @return DateTime
163
     */
164
    public function getDoorTime()
165
    {
166
        return $this->_doorTime;
167
    }
168
169
    /**
170
     * The time admission will commence.
171
     *
172
     * @param DateTime $doorTime
173
     * @return EventTrait
0 ignored issues
show
Comprehensibility Bug introduced by
The return type EventTrait 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...
174
     */
175
    public function setDoorTime($doorTime)
176
    {
177
        $this->_doorTime = $doorTime;
178
        return $this;
179
    }
180
181
    private $_duration;
182
183
    /**
184
     * @return Duration
185
     */
186
    public function getDuration()
187
    {
188
        return $this->_duration;
189
    }
190
191
    /**
192
     * The duration of the item (movie, audio recording, event, etc.) in ISO 8601 date format.
193
     *
194
     * @param Duration $duration
195
     * @return EventTrait
0 ignored issues
show
Comprehensibility Bug introduced by
The return type EventTrait 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...
196
     */
197
    public function setDuration($duration)
198
    {
199
        $this->_duration = $duration;
200
        return $this;
201
    }
202
203
    private $_endDate;
204
205
    /**
206
     * @return Date|DateTime
207
     */
208
    public function getEndDate()
209
    {
210
        return $this->_endDate;
211
    }
212
213
    /**
214
     * The end date and time of the item (in ISO 8601 date format).
215
     *
216
     * @param Date|DateTime $endDate
217
     * @return EventTrait
0 ignored issues
show
Comprehensibility Bug introduced by
The return type EventTrait 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...
218
     */
219
    public function setEndDate($endDate)
220
    {
221
        $this->_endDate = $endDate;
222
        return $this;
223
    }
224
225
    private $_funder;
226
227
    /**
228
     * @return Organization|Person
229
     */
230
    public function getFunder()
231
    {
232
        return $this->_funder;
233
    }
234
235
    /**
236
     * A person or organization that supports (sponsors) something through some kind of financial contribution.
237
     *
238
     * @param Organization|Person $funder
239
     * @return EventTrait
0 ignored issues
show
Comprehensibility Bug introduced by
The return type EventTrait 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...
240
     */
241 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...
242
    {
243
        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...
244
        
245
        $this->_funder = $funder;
246
        return $this;
247
    }
248
249
    private $_inLanguage;
250
251
    /**
252
     * @return Language|Text
253
     */
254
    public function getInLanguage()
255
    {
256
        return $this->_inLanguage;
257
    }
258
259
    /**
260
     * The language of the content or performance or used in an action.
261
     * Please use one of the language codes from the IETF BCP 47 standard. See also availableLanguage.
262
     * Supersedes language.
263
     *
264
     * @param Language|Text $inLanguage
265
     * @return EventTrait
0 ignored issues
show
Comprehensibility Bug introduced by
The return type EventTrait 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...
266
     */
267
    public function setInLanguage($inLanguage)
268
    {
269
        $this->_inLanguage = $inLanguage;
270
        return $this;
271
    }
272
273
    private $_isAccessibleForFree;
274
275
    /**
276
     * @return bool
277
     */
278
    public function isAccessibleForFree()
279
    {
280
        return $this->_isAccessibleForFree;
281
    }
282
283
    /**
284
     * A flag to signal that the item, event, or place is accessible for free. Supersedes free.
285
     *
286
     * @param bool $isAccessibleForFree
287
     * @return EventTrait
0 ignored issues
show
Comprehensibility Bug introduced by
The return type EventTrait 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...
288
     */
289
    public function setIsAccessibleForFree($isAccessibleForFree)
290
    {
291
        $this->_isAccessibleForFree = $isAccessibleForFree;
292
        return $this;
293
    }
294
295
    private $_location;
296
297
    /**
298
     * @return Place|PostalAddress|string
299
     */
300
    public function getLocation()
301
    {
302
        return $this->_location;
303
    }
304
305
    /**
306
     * The location of for example where the event is happening, an organization is located,
307
     * or where an action takes place.
308
     *
309
     * @param Place|PostalAddress|string $location
310
     * @return EventTrait
0 ignored issues
show
Comprehensibility Bug introduced by
The return type EventTrait 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...
311
     */
312
    public function setLocation($location)
313
    {
314
        $this->_location = $location;
315
        return $this;
316
    }
317
318
    private $_maximumAttendeeCapacity;
319
320
    /**
321
     * @return int
322
     */
323
    public function getMaximumAttendeeCapacity()
324
    {
325
        return $this->_maximumAttendeeCapacity;
326
    }
327
328
    /**
329
     * The total number of individuals that may attend an event or venue.
330
     *
331
     * @param int $maximumAttendeeCapacity
332
     */
333
    public function setMaximumAttendeeCapacity($maximumAttendeeCapacity)
334
    {
335
        $this->_maximumAttendeeCapacity = $maximumAttendeeCapacity;
336
    }
337
338
    private $_organizer;
339
340
    /**
341
     * @return Organization|Person
342
     */
343
    public function getOrganizer()
344
    {
345
        return $this->_organizer;
346
    }
347
348
    /**
349
     * An organizer of an Event.
350
     *
351
     * @param Organization|Person $organizer
352
     * @return EventTrait
0 ignored issues
show
Comprehensibility Bug introduced by
The return type EventTrait 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...
353
     */
354 View Code Duplication
    public function setOrganizer($organizer)
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...
355
    {
356
        ObjectHelper::isInstanceOf($organizer, [Organization::class, PersonInterface::class]);
0 ignored issues
show
Documentation introduced by
$organizer 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...
357
        
358
        $this->_organizer = $organizer;
359
        return $this;
360
    }
361
362
    private $_performer;
363
364
    /**
365
     * @return Organization|Person
366
     */
367
    public function getPerformer()
368
    {
369
        return $this->_performer;
370
    }
371
372
    /**
373
     * A performer at the event—for example, a presenter, musician, musical group or actor.
374
     * Supersedes performers.
375
     *
376
     * @param Organization|Person $performer
377
     * @return EventTrait
0 ignored issues
show
Comprehensibility Bug introduced by
The return type EventTrait 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...
378
     */
379 View Code Duplication
    public function setPerformer($performer)
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...
380
    {
381
        ObjectHelper::isInstanceOf($performer, [Organization::class, PersonInterface::class]);
0 ignored issues
show
Documentation introduced by
$performer 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...
382
        
383
        $this->_performer = $performer;
384
        return $this;
385
    }
386
387
    private $_previousStartDate;
388
389
    /**
390
     * @return string
391
     */
392
    public function getPreviousStartDate()
393
    {
394
        return $this->_previousStartDate;
395
    }
396
397
    /**
398
     * Used in conjunction with eventStatus for rescheduled or cancelled events.
399
     * This property contains the previously scheduled start date.
400
     * For rescheduled events, the startDate property should be used for the newly scheduled start date.
401
     * In the (rare) case of an event that has been postponed and rescheduled multiple times,
402
     * this field may be repeated.
403
     *
404
     * @param DateValue $previousStartDate
405
     * @return EventTrait
0 ignored issues
show
Comprehensibility Bug introduced by
The return type EventTrait 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...
406
     */
407
    public function setPreviousStartDate(DateValue $previousStartDate)
408
    {
409
        $this->_previousStartDate = $previousStartDate;
410
        return $this;
411
    }
412
413
    private $_recordedIn;
414
415
    /**
416
     * @return CreativeWork
417
     */
418
    public function getRecordedIn()
419
    {
420
        return $this->_recordedIn;
421
    }
422
423
    /**
424
     * The CreativeWork that captured all or part of this Event.
425
     * Inverse property: recordedAt
426
     *
427
     * @param CreativeWork $recordedIn
428
     * @return EventTrait
0 ignored issues
show
Comprehensibility Bug introduced by
The return type EventTrait 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...
429
     */
430
    public function setRecordedIn(CreativeWork $recordedIn)
431
    {
432
        $this->_recordedIn = $recordedIn;
433
        return $this;
434
    }
435
436
    private $_remainingAttendeeCapacity;
437
438
    /**
439
     * @return int
440
     */
441
    public function getRemainingAttendeeCapacity()
442
    {
443
        return $this->_remainingAttendeeCapacity;
444
    }
445
446
    /**
447
     * The number of attendee places for an event that remain unallocated.
448
     *
449
     * @param int $remainingAttendeeCapacity
450
     * @return EventTrait
0 ignored issues
show
Comprehensibility Bug introduced by
The return type EventTrait 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...
451
     */
452
    public function setRemainingAttendeeCapacity($remainingAttendeeCapacity)
453
    {
454
        $this->_remainingAttendeeCapacity = $remainingAttendeeCapacity;
455
        return $this;
456
    }
457
458
    private $_sponsor;
459
460
    /**
461
     * @return Organization|Person
462
     */
463
    public function getSponsor()
464
    {
465
        return $this->_sponsor;
466
    }
467
468
    /**
469
     * A person or organization that supports a thing through a pledge, promise, or financial contribution.
470
     * e.g. a sponsor of a Medical Study or a corporate sponsor of an event.
471
     *
472
     * @param Organization|Person $sponsor
473
     * @return EventTrait
0 ignored issues
show
Comprehensibility Bug introduced by
The return type EventTrait 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...
474
     */
475 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...
476
    {
477
        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...
478
        
479
        $this->_sponsor = $sponsor;
480
        return $this;
481
    }
482
483
    private $_startDate;
484
485
    /**
486
     * @return Date|DateTime
487
     */
488
    public function getStartDate()
489
    {
490
        return $this->_startDate;
491
    }
492
493
    /**
494
     * The start date and time of the item (in ISO 8601 date format).
495
     *
496
     * @param DateTimeValue $startDate
497
     * @return EventTrait
0 ignored issues
show
Comprehensibility Bug introduced by
The return type EventTrait 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...
498
     */
499
    public function setStartDate(DateTimeValue $startDate)
500
    {
501
        $this->_startDate = $startDate;
502
        return $this;
503
    }
504
505
    private $_subEvent;
506
507
    /**
508
     * @return Event
509
     */
510
    public function getSubEvent()
511
    {
512
        return $this->_subEvent;
513
    }
514
515
    /**
516
     * An Event that is part of this event.
517
     * For example, a conference event includes many presentations, each of which is a subEvent of the conference.
518
     * Supersedes subEvents.
519
     * Inverse property: superEvent.
520
     *
521
     * @param Event $subEvent
522
     */
523
    public function setSubEvent(Event $subEvent)
524
    {
525
        $this->_subEvent = $subEvent;
526
    }
527
528
    private $_superEvent;
529
530
    /**
531
     * @return Event
532
     */
533
    public function getSuperEvent()
534
    {
535
        return $this->_superEvent;
536
    }
537
538
    /**
539
     * An event that this event is a part of.
540
     * For example, a collection of individual music performances might each have a music festival as their superEvent.
541
     * Inverse property: subEvent.
542
     *
543
     * @param Event $superEvent
544
     * @return EventTrait
0 ignored issues
show
Comprehensibility Bug introduced by
The return type EventTrait 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...
545
     */
546
    public function setSuperEvent(Event $superEvent)
547
    {
548
        $this->_superEvent = $superEvent;
549
        return $this;
550
    }
551
552
    private $_translator;
553
554
    /**
555
     * @return Organization|Person
556
     */
557
    public function getTranslator()
558
    {
559
        return $this->_translator;
560
    }
561
562
    /**
563
     * Organization or person who adapts a creative work to different languages, regional differences
564
     * and technical requirements of a target market, or that translates during some event.
565
     *
566
     * @param Organization|Person $translator
567
     * @return EventTrait
0 ignored issues
show
Comprehensibility Bug introduced by
The return type EventTrait 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...
568
     */
569 View Code Duplication
    public function setTranslator($translator)
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...
570
    {
571
        ObjectHelper::isInstanceOf($translator, [Organization::class, PersonInterface::class]);
0 ignored issues
show
Documentation introduced by
$translator 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...
572
        
573
        $this->_translator = $translator;
574
        return $this;
575
    }
576
577
    private $_typicalAgeRange;
578
579
    /**
580
     * @return string
581
     */
582
    public function getTypicalAgeRange()
583
    {
584
        return $this->_typicalAgeRange;
585
    }
586
587
    /**
588
     * The typical expected age range, e.g. '7-9', '11-'.
589
     *
590
     * @param string $typicalAgeRange
591
     * @return EventTrait
0 ignored issues
show
Comprehensibility Bug introduced by
The return type EventTrait 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...
592
     */
593
    public function setTypicalAgeRange($typicalAgeRange)
594
    {
595
        $this->_typicalAgeRange = $typicalAgeRange;
596
        return $this;
597
    }
598
599
    private $_workFeatured;
600
601
    /**
602
     * @return CreativeWork
603
     */
604
    public function getWorkFeatured()
605
    {
606
        return $this->_workFeatured;
607
    }
608
609
    /**
610
     * A work featured in some event, e.g. exhibited in an ExhibitionEvent.
611
     * Specific subproperties are available for workPerformed (e.g. a play),
612
     * or a workPresented (a Movie at a ScreeningEvent).
613
     *
614
     * @param CreativeWork $workFeatured
615
     * @return EventTrait
0 ignored issues
show
Comprehensibility Bug introduced by
The return type EventTrait 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...
616
     */
617
    public function setWorkFeatured(CreativeWork $workFeatured)
618
    {
619
        $this->_workFeatured = $workFeatured;
620
        return $this;
621
    }
622
623
    private $_workPerformed;
624
625
    /**
626
     * @return CreativeWork
627
     */
628
    public function getWorkPerformed()
629
    {
630
        return $this->_workPerformed;
631
    }
632
633
    /**
634
     * A work performed in some event, for example a play performed in a TheaterEvent.
635
     *
636
     * @param CreativeWork $workPerformed
637
     * @return EventTrait
0 ignored issues
show
Comprehensibility Bug introduced by
The return type EventTrait 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...
638
     */
639
    public function setWorkPerformed(CreativeWork $workPerformed)
640
    {
641
        $this->_workPerformed = $workPerformed;
642
        return $this;
643
    }
644
}
645