HowToItem   A
last analyzed

Complexity

Total Complexity 17

Size/Duplication

Total Lines 260
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 17
lcom 1
cbo 1
dl 260
loc 260
rs 10
c 0
b 0
f 0

17 Methods

Rating   Name   Duplication   Size   Complexity  
A additionalType() 4 4 1
A alternateName() 4 4 1
A description() 4 4 1
A disambiguatingDescription() 4 4 1
A identifier() 4 4 1
A image() 4 4 1
A item() 4 4 1
A mainEntityOfPage() 4 4 1
A name() 4 4 1
A nextItem() 4 4 1
A position() 4 4 1
A potentialAction() 4 4 1
A previousItem() 4 4 1
A requiredQuantity() 4 4 1
A sameAs() 4 4 1
A subjectOf() 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\HowToItemContract;
6
use \Spatie\SchemaOrg\Contracts\IntangibleContract;
7
use \Spatie\SchemaOrg\Contracts\ListItemContract;
8
use \Spatie\SchemaOrg\Contracts\ThingContract;
9
10
/**
11
 * An item used as either a tool or supply when performing the instructions for
12
 * how to to achieve a result.
13
 *
14
 * @see http://schema.org/HowToItem
15
 *
16
 */
17 View Code Duplication
class HowToItem extends BaseType implements HowToItemContract, IntangibleContract, ListItemContract, 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
     * An additional type for the item, typically used for adding more specific
21
     * types from external vocabularies in microdata syntax. This is a
22
     * relationship between something and a class that the thing is in. In RDFa
23
     * syntax, it is better to use the native RDFa syntax - the 'typeof'
24
     * attribute - for multiple types. Schema.org tools may have only weaker
25
     * understanding of extra types, in particular those defined externally.
26
     *
27
     * @param string|string[] $additionalType
28
     *
29
     * @return static
30
     *
31
     * @see http://schema.org/additionalType
32
     */
33
    public function additionalType($additionalType)
34
    {
35
        return $this->setProperty('additionalType', $additionalType);
36
    }
37
38
    /**
39
     * An alias for the item.
40
     *
41
     * @param string|string[] $alternateName
42
     *
43
     * @return static
44
     *
45
     * @see http://schema.org/alternateName
46
     */
47
    public function alternateName($alternateName)
48
    {
49
        return $this->setProperty('alternateName', $alternateName);
50
    }
51
52
    /**
53
     * A description of the item.
54
     *
55
     * @param string|string[] $description
56
     *
57
     * @return static
58
     *
59
     * @see http://schema.org/description
60
     */
61
    public function description($description)
62
    {
63
        return $this->setProperty('description', $description);
64
    }
65
66
    /**
67
     * A sub property of description. A short description of the item used to
68
     * disambiguate from other, similar items. Information from other properties
69
     * (in particular, name) may be necessary for the description to be useful
70
     * for disambiguation.
71
     *
72
     * @param string|string[] $disambiguatingDescription
73
     *
74
     * @return static
75
     *
76
     * @see http://schema.org/disambiguatingDescription
77
     */
78
    public function disambiguatingDescription($disambiguatingDescription)
79
    {
80
        return $this->setProperty('disambiguatingDescription', $disambiguatingDescription);
81
    }
82
83
    /**
84
     * The identifier property represents any kind of identifier for any kind of
85
     * [[Thing]], such as ISBNs, GTIN codes, UUIDs etc. Schema.org provides
86
     * dedicated properties for representing many of these, either as textual
87
     * strings or as URL (URI) links. See [background
88
     * notes](/docs/datamodel.html#identifierBg) for more details.
89
     *
90
     * @param \Spatie\SchemaOrg\Contracts\PropertyValueContract|\Spatie\SchemaOrg\Contracts\PropertyValueContract[]|string|string[] $identifier
91
     *
92
     * @return static
93
     *
94
     * @see http://schema.org/identifier
95
     */
96
    public function identifier($identifier)
97
    {
98
        return $this->setProperty('identifier', $identifier);
99
    }
100
101
    /**
102
     * An image of the item. This can be a [[URL]] or a fully described
103
     * [[ImageObject]].
104
     *
105
     * @param \Spatie\SchemaOrg\Contracts\ImageObjectContract|\Spatie\SchemaOrg\Contracts\ImageObjectContract[]|string|string[] $image
106
     *
107
     * @return static
108
     *
109
     * @see http://schema.org/image
110
     */
111
    public function image($image)
112
    {
113
        return $this->setProperty('image', $image);
114
    }
115
116
    /**
117
     * An entity represented by an entry in a list or data feed (e.g. an
118
     * 'artist' in a list of 'artists')’.
119
     *
120
     * @param \Spatie\SchemaOrg\Contracts\ThingContract|\Spatie\SchemaOrg\Contracts\ThingContract[] $item
121
     *
122
     * @return static
123
     *
124
     * @see http://schema.org/item
125
     */
126
    public function item($item)
127
    {
128
        return $this->setProperty('item', $item);
129
    }
130
131
    /**
132
     * Indicates a page (or other CreativeWork) for which this thing is the main
133
     * entity being described. See [background
134
     * notes](/docs/datamodel.html#mainEntityBackground) for details.
135
     *
136
     * @param \Spatie\SchemaOrg\Contracts\CreativeWorkContract|\Spatie\SchemaOrg\Contracts\CreativeWorkContract[]|string|string[] $mainEntityOfPage
137
     *
138
     * @return static
139
     *
140
     * @see http://schema.org/mainEntityOfPage
141
     */
142
    public function mainEntityOfPage($mainEntityOfPage)
143
    {
144
        return $this->setProperty('mainEntityOfPage', $mainEntityOfPage);
145
    }
146
147
    /**
148
     * The name of the item.
149
     *
150
     * @param string|string[] $name
151
     *
152
     * @return static
153
     *
154
     * @see http://schema.org/name
155
     */
156
    public function name($name)
157
    {
158
        return $this->setProperty('name', $name);
159
    }
160
161
    /**
162
     * A link to the ListItem that follows the current one.
163
     *
164
     * @param \Spatie\SchemaOrg\Contracts\ListItemContract|\Spatie\SchemaOrg\Contracts\ListItemContract[] $nextItem
165
     *
166
     * @return static
167
     *
168
     * @see http://schema.org/nextItem
169
     */
170
    public function nextItem($nextItem)
171
    {
172
        return $this->setProperty('nextItem', $nextItem);
173
    }
174
175
    /**
176
     * The position of an item in a series or sequence of items.
177
     *
178
     * @param int|int[]|string|string[] $position
179
     *
180
     * @return static
181
     *
182
     * @see http://schema.org/position
183
     */
184
    public function position($position)
185
    {
186
        return $this->setProperty('position', $position);
187
    }
188
189
    /**
190
     * Indicates a potential Action, which describes an idealized action in
191
     * which this thing would play an 'object' role.
192
     *
193
     * @param \Spatie\SchemaOrg\Contracts\ActionContract|\Spatie\SchemaOrg\Contracts\ActionContract[] $potentialAction
194
     *
195
     * @return static
196
     *
197
     * @see http://schema.org/potentialAction
198
     */
199
    public function potentialAction($potentialAction)
200
    {
201
        return $this->setProperty('potentialAction', $potentialAction);
202
    }
203
204
    /**
205
     * A link to the ListItem that preceeds the current one.
206
     *
207
     * @param \Spatie\SchemaOrg\Contracts\ListItemContract|\Spatie\SchemaOrg\Contracts\ListItemContract[] $previousItem
208
     *
209
     * @return static
210
     *
211
     * @see http://schema.org/previousItem
212
     */
213
    public function previousItem($previousItem)
214
    {
215
        return $this->setProperty('previousItem', $previousItem);
216
    }
217
218
    /**
219
     * The required quantity of the item(s).
220
     *
221
     * @param \Spatie\SchemaOrg\Contracts\QuantitativeValueContract|\Spatie\SchemaOrg\Contracts\QuantitativeValueContract[]|float|float[]|int|int[]|string|string[] $requiredQuantity
222
     *
223
     * @return static
224
     *
225
     * @see http://schema.org/requiredQuantity
226
     */
227
    public function requiredQuantity($requiredQuantity)
228
    {
229
        return $this->setProperty('requiredQuantity', $requiredQuantity);
230
    }
231
232
    /**
233
     * URL of a reference Web page that unambiguously indicates the item's
234
     * identity. E.g. the URL of the item's Wikipedia page, Wikidata entry, or
235
     * official website.
236
     *
237
     * @param string|string[] $sameAs
238
     *
239
     * @return static
240
     *
241
     * @see http://schema.org/sameAs
242
     */
243
    public function sameAs($sameAs)
244
    {
245
        return $this->setProperty('sameAs', $sameAs);
246
    }
247
248
    /**
249
     * A CreativeWork or Event about this Thing.
250
     *
251
     * @param \Spatie\SchemaOrg\Contracts\CreativeWorkContract|\Spatie\SchemaOrg\Contracts\CreativeWorkContract[]|\Spatie\SchemaOrg\Contracts\EventContract|\Spatie\SchemaOrg\Contracts\EventContract[] $subjectOf
252
     *
253
     * @return static
254
     *
255
     * @see http://schema.org/subjectOf
256
     */
257
    public function subjectOf($subjectOf)
258
    {
259
        return $this->setProperty('subjectOf', $subjectOf);
260
    }
261
262
    /**
263
     * URL of the item.
264
     *
265
     * @param string|string[] $url
266
     *
267
     * @return static
268
     *
269
     * @see http://schema.org/url
270
     */
271
    public function url($url)
272
    {
273
        return $this->setProperty('url', $url);
274
    }
275
276
}
277