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