LendAction   A
last analyzed

Complexity

Total Complexity 26

Size/Duplication

Total Lines 413
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 26
lcom 1
cbo 1
dl 413
loc 413
rs 10
c 0
b 0
f 0

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