CancelAction   A
last analyzed

Complexity

Total Complexity 24

Size/Duplication

Total Lines 382
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 24
lcom 1
cbo 1
dl 382
loc 382
rs 10
c 0
b 0
f 0

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