AddAction   A
last analyzed

Complexity

Total Complexity 25

Size/Duplication

Total Lines 396
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 25
lcom 1
cbo 1
dl 396
loc 396
rs 10
c 0
b 0
f 0

25 Methods

Rating   Name   Duplication   Size   Complexity  
A actionStatus() 4 4 1
A additionalType() 4 4 1
A agent() 4 4 1
A alternateName() 4 4 1
A collection() 4 4 1
A description() 4 4 1
A disambiguatingDescription() 4 4 1
A endTime() 4 4 1
A error() 4 4 1
A identifier() 4 4 1
A image() 4 4 1
A instrument() 4 4 1
A location() 4 4 1
A mainEntityOfPage() 4 4 1
A name() 4 4 1
A object() 4 4 1
A participant() 4 4 1
A potentialAction() 4 4 1
A result() 4 4 1
A sameAs() 4 4 1
A startTime() 4 4 1
A subjectOf() 4 4 1
A target() 4 4 1
A targetCollection() 4 4 1
A url() 4 4 1

How to fix   Duplicated Code   

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:

1
<?php
2
3
namespace Spatie\SchemaOrg;
4
5
use \Spatie\SchemaOrg\Contracts\AddActionContract;
6
use \Spatie\SchemaOrg\Contracts\ActionContract;
7
use \Spatie\SchemaOrg\Contracts\ThingContract;
8
use \Spatie\SchemaOrg\Contracts\UpdateActionContract;
9
10
/**
11
 * The act of editing by adding an object to a collection.
12
 *
13
 * @see http://schema.org/AddAction
14
 *
15
 */
16 View Code Duplication
class AddAction extends BaseType implements AddActionContract, ActionContract, ThingContract, UpdateActionContract
0 ignored issues
show
Duplication introduced by
This class 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...
17
{
18
    /**
19
     * Indicates the current disposition of the Action.
20
     *
21
     * @param \Spatie\SchemaOrg\Contracts\ActionStatusTypeContract|\Spatie\SchemaOrg\Contracts\ActionStatusTypeContract[] $actionStatus
22
     *
23
     * @return static
24
     *
25
     * @see http://schema.org/actionStatus
26
     */
27
    public function actionStatus($actionStatus)
28
    {
29
        return $this->setProperty('actionStatus', $actionStatus);
30
    }
31
32
    /**
33
     * An additional type for the item, typically used for adding more specific
34
     * types from external vocabularies in microdata syntax. This is a
35
     * relationship between something and a class that the thing is in. In RDFa
36
     * syntax, it is better to use the native RDFa syntax - the 'typeof'
37
     * attribute - for multiple types. Schema.org tools may have only weaker
38
     * understanding of extra types, in particular those defined externally.
39
     *
40
     * @param string|string[] $additionalType
41
     *
42
     * @return static
43
     *
44
     * @see http://schema.org/additionalType
45
     */
46
    public function additionalType($additionalType)
47
    {
48
        return $this->setProperty('additionalType', $additionalType);
49
    }
50
51
    /**
52
     * The direct performer or driver of the action (animate or inanimate). e.g.
53
     * *John* wrote a book.
54
     *
55
     * @param \Spatie\SchemaOrg\Contracts\OrganizationContract|\Spatie\SchemaOrg\Contracts\OrganizationContract[]|\Spatie\SchemaOrg\Contracts\PersonContract|\Spatie\SchemaOrg\Contracts\PersonContract[] $agent
56
     *
57
     * @return static
58
     *
59
     * @see http://schema.org/agent
60
     */
61
    public function agent($agent)
62
    {
63
        return $this->setProperty('agent', $agent);
64
    }
65
66
    /**
67
     * An alias for the item.
68
     *
69
     * @param string|string[] $alternateName
70
     *
71
     * @return static
72
     *
73
     * @see http://schema.org/alternateName
74
     */
75
    public function alternateName($alternateName)
76
    {
77
        return $this->setProperty('alternateName', $alternateName);
78
    }
79
80
    /**
81
     * A sub property of object. The collection target of the action.
82
     *
83
     * @param \Spatie\SchemaOrg\Contracts\ThingContract|\Spatie\SchemaOrg\Contracts\ThingContract[] $collection
84
     *
85
     * @return static
86
     *
87
     * @see http://schema.org/collection
88
     */
89
    public function collection($collection)
90
    {
91
        return $this->setProperty('collection', $collection);
92
    }
93
94
    /**
95
     * A description of the item.
96
     *
97
     * @param string|string[] $description
98
     *
99
     * @return static
100
     *
101
     * @see http://schema.org/description
102
     */
103
    public function description($description)
104
    {
105
        return $this->setProperty('description', $description);
106
    }
107
108
    /**
109
     * A sub property of description. A short description of the item used to
110
     * disambiguate from other, similar items. Information from other properties
111
     * (in particular, name) may be necessary for the description to be useful
112
     * for disambiguation.
113
     *
114
     * @param string|string[] $disambiguatingDescription
115
     *
116
     * @return static
117
     *
118
     * @see http://schema.org/disambiguatingDescription
119
     */
120
    public function disambiguatingDescription($disambiguatingDescription)
121
    {
122
        return $this->setProperty('disambiguatingDescription', $disambiguatingDescription);
123
    }
124
125
    /**
126
     * The endTime of something. For a reserved event or service (e.g.
127
     * FoodEstablishmentReservation), the time that it is expected to end. For
128
     * actions that span a period of time, when the action was performed. e.g.
129
     * John wrote a book from January to *December*. For media, including audio
130
     * and video, it's the time offset of the end of a clip within a larger
131
     * file.
132
     * 
133
     * Note that Event uses startDate/endDate instead of startTime/endTime, even
134
     * when describing dates with times. This situation may be clarified in
135
     * future revisions.
136
     *
137
     * @param \DateTimeInterface|\DateTimeInterface[] $endTime
138
     *
139
     * @return static
140
     *
141
     * @see http://schema.org/endTime
142
     */
143
    public function endTime($endTime)
144
    {
145
        return $this->setProperty('endTime', $endTime);
146
    }
147
148
    /**
149
     * For failed actions, more information on the cause of the failure.
150
     *
151
     * @param \Spatie\SchemaOrg\Contracts\ThingContract|\Spatie\SchemaOrg\Contracts\ThingContract[] $error
152
     *
153
     * @return static
154
     *
155
     * @see http://schema.org/error
156
     */
157
    public function error($error)
158
    {
159
        return $this->setProperty('error', $error);
160
    }
161
162
    /**
163
     * The identifier property represents any kind of identifier for any kind of
164
     * [[Thing]], such as ISBNs, GTIN codes, UUIDs etc. Schema.org provides
165
     * dedicated properties for representing many of these, either as textual
166
     * strings or as URL (URI) links. See [background
167
     * notes](/docs/datamodel.html#identifierBg) for more details.
168
     *
169
     * @param \Spatie\SchemaOrg\Contracts\PropertyValueContract|\Spatie\SchemaOrg\Contracts\PropertyValueContract[]|string|string[] $identifier
170
     *
171
     * @return static
172
     *
173
     * @see http://schema.org/identifier
174
     */
175
    public function identifier($identifier)
176
    {
177
        return $this->setProperty('identifier', $identifier);
178
    }
179
180
    /**
181
     * An image of the item. This can be a [[URL]] or a fully described
182
     * [[ImageObject]].
183
     *
184
     * @param \Spatie\SchemaOrg\Contracts\ImageObjectContract|\Spatie\SchemaOrg\Contracts\ImageObjectContract[]|string|string[] $image
185
     *
186
     * @return static
187
     *
188
     * @see http://schema.org/image
189
     */
190
    public function image($image)
191
    {
192
        return $this->setProperty('image', $image);
193
    }
194
195
    /**
196
     * The object that helped the agent perform the action. e.g. John wrote a
197
     * book with *a pen*.
198
     *
199
     * @param \Spatie\SchemaOrg\Contracts\ThingContract|\Spatie\SchemaOrg\Contracts\ThingContract[] $instrument
200
     *
201
     * @return static
202
     *
203
     * @see http://schema.org/instrument
204
     */
205
    public function instrument($instrument)
206
    {
207
        return $this->setProperty('instrument', $instrument);
208
    }
209
210
    /**
211
     * The location of for example where the event is happening, an organization
212
     * is located, or where an action takes place.
213
     *
214
     * @param \Spatie\SchemaOrg\Contracts\PlaceContract|\Spatie\SchemaOrg\Contracts\PlaceContract[]|\Spatie\SchemaOrg\Contracts\PostalAddressContract|\Spatie\SchemaOrg\Contracts\PostalAddressContract[]|string|string[] $location
215
     *
216
     * @return static
217
     *
218
     * @see http://schema.org/location
219
     */
220
    public function location($location)
221
    {
222
        return $this->setProperty('location', $location);
223
    }
224
225
    /**
226
     * Indicates a page (or other CreativeWork) for which this thing is the main
227
     * entity being described. See [background
228
     * notes](/docs/datamodel.html#mainEntityBackground) for details.
229
     *
230
     * @param \Spatie\SchemaOrg\Contracts\CreativeWorkContract|\Spatie\SchemaOrg\Contracts\CreativeWorkContract[]|string|string[] $mainEntityOfPage
231
     *
232
     * @return static
233
     *
234
     * @see http://schema.org/mainEntityOfPage
235
     */
236
    public function mainEntityOfPage($mainEntityOfPage)
237
    {
238
        return $this->setProperty('mainEntityOfPage', $mainEntityOfPage);
239
    }
240
241
    /**
242
     * The name of the item.
243
     *
244
     * @param string|string[] $name
245
     *
246
     * @return static
247
     *
248
     * @see http://schema.org/name
249
     */
250
    public function name($name)
251
    {
252
        return $this->setProperty('name', $name);
253
    }
254
255
    /**
256
     * The object upon which the action is carried out, whose state is kept
257
     * intact or changed. Also known as the semantic roles patient, affected or
258
     * undergoer (which change their state) or theme (which doesn't). e.g. John
259
     * read *a book*.
260
     *
261
     * @param \Spatie\SchemaOrg\Contracts\ThingContract|\Spatie\SchemaOrg\Contracts\ThingContract[] $object
262
     *
263
     * @return static
264
     *
265
     * @see http://schema.org/object
266
     */
267
    public function object($object)
268
    {
269
        return $this->setProperty('object', $object);
270
    }
271
272
    /**
273
     * Other co-agents that participated in the action indirectly. e.g. John
274
     * wrote a book with *Steve*.
275
     *
276
     * @param \Spatie\SchemaOrg\Contracts\OrganizationContract|\Spatie\SchemaOrg\Contracts\OrganizationContract[]|\Spatie\SchemaOrg\Contracts\PersonContract|\Spatie\SchemaOrg\Contracts\PersonContract[] $participant
277
     *
278
     * @return static
279
     *
280
     * @see http://schema.org/participant
281
     */
282
    public function participant($participant)
283
    {
284
        return $this->setProperty('participant', $participant);
285
    }
286
287
    /**
288
     * Indicates a potential Action, which describes an idealized action in
289
     * which this thing would play an 'object' role.
290
     *
291
     * @param \Spatie\SchemaOrg\Contracts\ActionContract|\Spatie\SchemaOrg\Contracts\ActionContract[] $potentialAction
292
     *
293
     * @return static
294
     *
295
     * @see http://schema.org/potentialAction
296
     */
297
    public function potentialAction($potentialAction)
298
    {
299
        return $this->setProperty('potentialAction', $potentialAction);
300
    }
301
302
    /**
303
     * The result produced in the action. e.g. John wrote *a book*.
304
     *
305
     * @param \Spatie\SchemaOrg\Contracts\ThingContract|\Spatie\SchemaOrg\Contracts\ThingContract[] $result
306
     *
307
     * @return static
308
     *
309
     * @see http://schema.org/result
310
     */
311
    public function result($result)
312
    {
313
        return $this->setProperty('result', $result);
314
    }
315
316
    /**
317
     * URL of a reference Web page that unambiguously indicates the item's
318
     * identity. E.g. the URL of the item's Wikipedia page, Wikidata entry, or
319
     * official website.
320
     *
321
     * @param string|string[] $sameAs
322
     *
323
     * @return static
324
     *
325
     * @see http://schema.org/sameAs
326
     */
327
    public function sameAs($sameAs)
328
    {
329
        return $this->setProperty('sameAs', $sameAs);
330
    }
331
332
    /**
333
     * The startTime of something. For a reserved event or service (e.g.
334
     * FoodEstablishmentReservation), the time that it is expected to start. For
335
     * actions that span a period of time, when the action was performed. e.g.
336
     * John wrote a book from *January* to December. For media, including audio
337
     * and video, it's the time offset of the start of a clip within a larger
338
     * file.
339
     * 
340
     * Note that Event uses startDate/endDate instead of startTime/endTime, even
341
     * when describing dates with times. This situation may be clarified in
342
     * future revisions.
343
     *
344
     * @param \DateTimeInterface|\DateTimeInterface[] $startTime
345
     *
346
     * @return static
347
     *
348
     * @see http://schema.org/startTime
349
     */
350
    public function startTime($startTime)
351
    {
352
        return $this->setProperty('startTime', $startTime);
353
    }
354
355
    /**
356
     * A CreativeWork or Event about this Thing.
357
     *
358
     * @param \Spatie\SchemaOrg\Contracts\CreativeWorkContract|\Spatie\SchemaOrg\Contracts\CreativeWorkContract[]|\Spatie\SchemaOrg\Contracts\EventContract|\Spatie\SchemaOrg\Contracts\EventContract[] $subjectOf
359
     *
360
     * @return static
361
     *
362
     * @see http://schema.org/subjectOf
363
     */
364
    public function subjectOf($subjectOf)
365
    {
366
        return $this->setProperty('subjectOf', $subjectOf);
367
    }
368
369
    /**
370
     * Indicates a target EntryPoint for an Action.
371
     *
372
     * @param \Spatie\SchemaOrg\Contracts\EntryPointContract|\Spatie\SchemaOrg\Contracts\EntryPointContract[] $target
373
     *
374
     * @return static
375
     *
376
     * @see http://schema.org/target
377
     */
378
    public function target($target)
379
    {
380
        return $this->setProperty('target', $target);
381
    }
382
383
    /**
384
     * A sub property of object. The collection target of the action.
385
     *
386
     * @param \Spatie\SchemaOrg\Contracts\ThingContract|\Spatie\SchemaOrg\Contracts\ThingContract[] $targetCollection
387
     *
388
     * @return static
389
     *
390
     * @see http://schema.org/targetCollection
391
     */
392
    public function targetCollection($targetCollection)
393
    {
394
        return $this->setProperty('targetCollection', $targetCollection);
395
    }
396
397
    /**
398
     * URL of the item.
399
     *
400
     * @param string|string[] $url
401
     *
402
     * @return static
403
     *
404
     * @see http://schema.org/url
405
     */
406
    public function url($url)
407
    {
408
        return $this->setProperty('url', $url);
409
    }
410
411
}
412