GeoCircle   A
last analyzed

Complexity

Total Complexity 22

Size/Duplication

Total Lines 342
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 22
lcom 1
cbo 1
dl 342
loc 342
rs 10
c 0
b 0
f 0

22 Methods

Rating   Name   Duplication   Size   Complexity  
A additionalType() 4 4 1
A address() 4 4 1
A addressCountry() 4 4 1
A alternateName() 4 4 1
A box() 4 4 1
A circle() 4 4 1
A description() 4 4 1
A disambiguatingDescription() 4 4 1
A elevation() 4 4 1
A geoMidpoint() 4 4 1
A geoRadius() 4 4 1
A identifier() 4 4 1
A image() 4 4 1
A line() 4 4 1
A mainEntityOfPage() 4 4 1
A name() 4 4 1
A polygon() 4 4 1
A postalCode() 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\GeoCircleContract;
6
use \Spatie\SchemaOrg\Contracts\GeoShapeContract;
7
use \Spatie\SchemaOrg\Contracts\IntangibleContract;
8
use \Spatie\SchemaOrg\Contracts\StructuredValueContract;
9
use \Spatie\SchemaOrg\Contracts\ThingContract;
10
11
/**
12
 * A GeoCircle is a GeoShape representing a circular geographic area. As it is a
13
 * GeoShape
14
 *           it provides the simple textual property 'circle', but also allows
15
 * the combination of postalCode alongside geoRadius.
16
 *           The center of the circle can be indicated via the 'geoMidpoint'
17
 * property, or more approximately using 'address', 'postalCode'.
18
 *
19
 * @see http://schema.org/GeoCircle
20
 *
21
 */
22 View Code Duplication
class GeoCircle extends BaseType implements GeoCircleContract, GeoShapeContract, IntangibleContract, StructuredValueContract, 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...
23
{
24
    /**
25
     * An additional type for the item, typically used for adding more specific
26
     * types from external vocabularies in microdata syntax. This is a
27
     * relationship between something and a class that the thing is in. In RDFa
28
     * syntax, it is better to use the native RDFa syntax - the 'typeof'
29
     * attribute - for multiple types. Schema.org tools may have only weaker
30
     * understanding of extra types, in particular those defined externally.
31
     *
32
     * @param string|string[] $additionalType
33
     *
34
     * @return static
35
     *
36
     * @see http://schema.org/additionalType
37
     */
38
    public function additionalType($additionalType)
39
    {
40
        return $this->setProperty('additionalType', $additionalType);
41
    }
42
43
    /**
44
     * Physical address of the item.
45
     *
46
     * @param \Spatie\SchemaOrg\Contracts\PostalAddressContract|\Spatie\SchemaOrg\Contracts\PostalAddressContract[]|string|string[] $address
47
     *
48
     * @return static
49
     *
50
     * @see http://schema.org/address
51
     */
52
    public function address($address)
53
    {
54
        return $this->setProperty('address', $address);
55
    }
56
57
    /**
58
     * The country. For example, USA. You can also provide the two-letter [ISO
59
     * 3166-1 alpha-2 country code](http://en.wikipedia.org/wiki/ISO_3166-1).
60
     *
61
     * @param \Spatie\SchemaOrg\Contracts\CountryContract|\Spatie\SchemaOrg\Contracts\CountryContract[]|string|string[] $addressCountry
62
     *
63
     * @return static
64
     *
65
     * @see http://schema.org/addressCountry
66
     */
67
    public function addressCountry($addressCountry)
68
    {
69
        return $this->setProperty('addressCountry', $addressCountry);
70
    }
71
72
    /**
73
     * An alias for the item.
74
     *
75
     * @param string|string[] $alternateName
76
     *
77
     * @return static
78
     *
79
     * @see http://schema.org/alternateName
80
     */
81
    public function alternateName($alternateName)
82
    {
83
        return $this->setProperty('alternateName', $alternateName);
84
    }
85
86
    /**
87
     * A box is the area enclosed by the rectangle formed by two points. The
88
     * first point is the lower corner, the second point is the upper corner. A
89
     * box is expressed as two points separated by a space character.
90
     *
91
     * @param string|string[] $box
92
     *
93
     * @return static
94
     *
95
     * @see http://schema.org/box
96
     */
97
    public function box($box)
98
    {
99
        return $this->setProperty('box', $box);
100
    }
101
102
    /**
103
     * A circle is the circular region of a specified radius centered at a
104
     * specified latitude and longitude. A circle is expressed as a pair
105
     * followed by a radius in meters.
106
     *
107
     * @param string|string[] $circle
108
     *
109
     * @return static
110
     *
111
     * @see http://schema.org/circle
112
     */
113
    public function circle($circle)
114
    {
115
        return $this->setProperty('circle', $circle);
116
    }
117
118
    /**
119
     * A description of the item.
120
     *
121
     * @param string|string[] $description
122
     *
123
     * @return static
124
     *
125
     * @see http://schema.org/description
126
     */
127
    public function description($description)
128
    {
129
        return $this->setProperty('description', $description);
130
    }
131
132
    /**
133
     * A sub property of description. A short description of the item used to
134
     * disambiguate from other, similar items. Information from other properties
135
     * (in particular, name) may be necessary for the description to be useful
136
     * for disambiguation.
137
     *
138
     * @param string|string[] $disambiguatingDescription
139
     *
140
     * @return static
141
     *
142
     * @see http://schema.org/disambiguatingDescription
143
     */
144
    public function disambiguatingDescription($disambiguatingDescription)
145
    {
146
        return $this->setProperty('disambiguatingDescription', $disambiguatingDescription);
147
    }
148
149
    /**
150
     * The elevation of a location ([WGS
151
     * 84](https://en.wikipedia.org/wiki/World_Geodetic_System)). Values may be
152
     * of the form 'NUMBER UNIT_OF_MEASUREMENT' (e.g., '1,000 m', '3,200 ft')
153
     * while numbers alone should be assumed to be a value in meters.
154
     *
155
     * @param float|float[]|int|int[]|string|string[] $elevation
156
     *
157
     * @return static
158
     *
159
     * @see http://schema.org/elevation
160
     */
161
    public function elevation($elevation)
162
    {
163
        return $this->setProperty('elevation', $elevation);
164
    }
165
166
    /**
167
     * Indicates the GeoCoordinates at the centre of a GeoShape e.g. GeoCircle.
168
     *
169
     * @param \Spatie\SchemaOrg\Contracts\GeoCoordinatesContract|\Spatie\SchemaOrg\Contracts\GeoCoordinatesContract[] $geoMidpoint
170
     *
171
     * @return static
172
     *
173
     * @see http://schema.org/geoMidpoint
174
     */
175
    public function geoMidpoint($geoMidpoint)
176
    {
177
        return $this->setProperty('geoMidpoint', $geoMidpoint);
178
    }
179
180
    /**
181
     * Indicates the approximate radius of a GeoCircle (metres unless indicated
182
     * otherwise via Distance notation).
183
     *
184
     * @param \Spatie\SchemaOrg\Contracts\DistanceContract|\Spatie\SchemaOrg\Contracts\DistanceContract[]|float|float[]|int|int[]|string|string[] $geoRadius
185
     *
186
     * @return static
187
     *
188
     * @see http://schema.org/geoRadius
189
     */
190
    public function geoRadius($geoRadius)
191
    {
192
        return $this->setProperty('geoRadius', $geoRadius);
193
    }
194
195
    /**
196
     * The identifier property represents any kind of identifier for any kind of
197
     * [[Thing]], such as ISBNs, GTIN codes, UUIDs etc. Schema.org provides
198
     * dedicated properties for representing many of these, either as textual
199
     * strings or as URL (URI) links. See [background
200
     * notes](/docs/datamodel.html#identifierBg) for more details.
201
     *
202
     * @param \Spatie\SchemaOrg\Contracts\PropertyValueContract|\Spatie\SchemaOrg\Contracts\PropertyValueContract[]|string|string[] $identifier
203
     *
204
     * @return static
205
     *
206
     * @see http://schema.org/identifier
207
     */
208
    public function identifier($identifier)
209
    {
210
        return $this->setProperty('identifier', $identifier);
211
    }
212
213
    /**
214
     * An image of the item. This can be a [[URL]] or a fully described
215
     * [[ImageObject]].
216
     *
217
     * @param \Spatie\SchemaOrg\Contracts\ImageObjectContract|\Spatie\SchemaOrg\Contracts\ImageObjectContract[]|string|string[] $image
218
     *
219
     * @return static
220
     *
221
     * @see http://schema.org/image
222
     */
223
    public function image($image)
224
    {
225
        return $this->setProperty('image', $image);
226
    }
227
228
    /**
229
     * A line is a point-to-point path consisting of two or more points. A line
230
     * is expressed as a series of two or more point objects separated by space.
231
     *
232
     * @param string|string[] $line
233
     *
234
     * @return static
235
     *
236
     * @see http://schema.org/line
237
     */
238
    public function line($line)
239
    {
240
        return $this->setProperty('line', $line);
241
    }
242
243
    /**
244
     * Indicates a page (or other CreativeWork) for which this thing is the main
245
     * entity being described. See [background
246
     * notes](/docs/datamodel.html#mainEntityBackground) for details.
247
     *
248
     * @param \Spatie\SchemaOrg\Contracts\CreativeWorkContract|\Spatie\SchemaOrg\Contracts\CreativeWorkContract[]|string|string[] $mainEntityOfPage
249
     *
250
     * @return static
251
     *
252
     * @see http://schema.org/mainEntityOfPage
253
     */
254
    public function mainEntityOfPage($mainEntityOfPage)
255
    {
256
        return $this->setProperty('mainEntityOfPage', $mainEntityOfPage);
257
    }
258
259
    /**
260
     * The name of the item.
261
     *
262
     * @param string|string[] $name
263
     *
264
     * @return static
265
     *
266
     * @see http://schema.org/name
267
     */
268
    public function name($name)
269
    {
270
        return $this->setProperty('name', $name);
271
    }
272
273
    /**
274
     * A polygon is the area enclosed by a point-to-point path for which the
275
     * starting and ending points are the same. A polygon is expressed as a
276
     * series of four or more space delimited points where the first and final
277
     * points are identical.
278
     *
279
     * @param string|string[] $polygon
280
     *
281
     * @return static
282
     *
283
     * @see http://schema.org/polygon
284
     */
285
    public function polygon($polygon)
286
    {
287
        return $this->setProperty('polygon', $polygon);
288
    }
289
290
    /**
291
     * The postal code. For example, 94043.
292
     *
293
     * @param string|string[] $postalCode
294
     *
295
     * @return static
296
     *
297
     * @see http://schema.org/postalCode
298
     */
299
    public function postalCode($postalCode)
300
    {
301
        return $this->setProperty('postalCode', $postalCode);
302
    }
303
304
    /**
305
     * Indicates a potential Action, which describes an idealized action in
306
     * which this thing would play an 'object' role.
307
     *
308
     * @param \Spatie\SchemaOrg\Contracts\ActionContract|\Spatie\SchemaOrg\Contracts\ActionContract[] $potentialAction
309
     *
310
     * @return static
311
     *
312
     * @see http://schema.org/potentialAction
313
     */
314
    public function potentialAction($potentialAction)
315
    {
316
        return $this->setProperty('potentialAction', $potentialAction);
317
    }
318
319
    /**
320
     * URL of a reference Web page that unambiguously indicates the item's
321
     * identity. E.g. the URL of the item's Wikipedia page, Wikidata entry, or
322
     * official website.
323
     *
324
     * @param string|string[] $sameAs
325
     *
326
     * @return static
327
     *
328
     * @see http://schema.org/sameAs
329
     */
330
    public function sameAs($sameAs)
331
    {
332
        return $this->setProperty('sameAs', $sameAs);
333
    }
334
335
    /**
336
     * A CreativeWork or Event about this Thing.
337
     *
338
     * @param \Spatie\SchemaOrg\Contracts\CreativeWorkContract|\Spatie\SchemaOrg\Contracts\CreativeWorkContract[]|\Spatie\SchemaOrg\Contracts\EventContract|\Spatie\SchemaOrg\Contracts\EventContract[] $subjectOf
339
     *
340
     * @return static
341
     *
342
     * @see http://schema.org/subjectOf
343
     */
344
    public function subjectOf($subjectOf)
345
    {
346
        return $this->setProperty('subjectOf', $subjectOf);
347
    }
348
349
    /**
350
     * URL of the item.
351
     *
352
     * @param string|string[] $url
353
     *
354
     * @return static
355
     *
356
     * @see http://schema.org/url
357
     */
358
    public function url($url)
359
    {
360
        return $this->setProperty('url', $url);
361
    }
362
363
}
364