ActivateAction   A
last analyzed

Complexity

Total Complexity 23

Size/Duplication

Total Lines 368
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 23
lcom 1
cbo 1
dl 368
loc 368
rs 10
c 0
b 0
f 0

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