OrderStatus   A
last analyzed

Complexity

Total Complexity 12

Size/Duplication

Total Lines 245
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 12
lcom 1
cbo 1
dl 245
loc 245
rs 10
c 0
b 0
f 0

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