Complex classes like AdministrativeArea often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use AdministrativeArea, and based on these observations, apply Extract Interface, too.
1 | <?php |
||
16 | class AdministrativeArea extends BaseType implements AdministrativeAreaContract, PlaceContract, ThingContract |
||
17 | { |
||
18 | /** |
||
19 | * A property-value pair representing an additional characteristics of the |
||
20 | * entitity, e.g. a product feature or another characteristic for which |
||
21 | * there is no matching property in schema.org. |
||
22 | * |
||
23 | * Note: Publishers should be aware that applications designed to use |
||
24 | * specific schema.org properties (e.g. http://schema.org/width, |
||
25 | * http://schema.org/color, http://schema.org/gtin13, ...) will typically |
||
26 | * expect such data to be provided using those properties, rather than using |
||
27 | * the generic property/value mechanism. |
||
28 | * |
||
29 | * @param \Spatie\SchemaOrg\Contracts\PropertyValueContract|\Spatie\SchemaOrg\Contracts\PropertyValueContract[] $additionalProperty |
||
30 | * |
||
31 | * @return static |
||
32 | * |
||
33 | * @see http://schema.org/additionalProperty |
||
34 | */ |
||
35 | public function additionalProperty($additionalProperty) |
||
39 | |||
40 | /** |
||
41 | * An additional type for the item, typically used for adding more specific |
||
42 | * types from external vocabularies in microdata syntax. This is a |
||
43 | * relationship between something and a class that the thing is in. In RDFa |
||
44 | * syntax, it is better to use the native RDFa syntax - the 'typeof' |
||
45 | * attribute - for multiple types. Schema.org tools may have only weaker |
||
46 | * understanding of extra types, in particular those defined externally. |
||
47 | * |
||
48 | * @param string|string[] $additionalType |
||
49 | * |
||
50 | * @return static |
||
51 | * |
||
52 | * @see http://schema.org/additionalType |
||
53 | */ |
||
54 | public function additionalType($additionalType) |
||
58 | |||
59 | /** |
||
60 | * Physical address of the item. |
||
61 | * |
||
62 | * @param \Spatie\SchemaOrg\Contracts\PostalAddressContract|\Spatie\SchemaOrg\Contracts\PostalAddressContract[]|string|string[] $address |
||
63 | * |
||
64 | * @return static |
||
65 | * |
||
66 | * @see http://schema.org/address |
||
67 | */ |
||
68 | public function address($address) |
||
72 | |||
73 | /** |
||
74 | * The overall rating, based on a collection of reviews or ratings, of the |
||
75 | * item. |
||
76 | * |
||
77 | * @param \Spatie\SchemaOrg\Contracts\AggregateRatingContract|\Spatie\SchemaOrg\Contracts\AggregateRatingContract[] $aggregateRating |
||
78 | * |
||
79 | * @return static |
||
80 | * |
||
81 | * @see http://schema.org/aggregateRating |
||
82 | */ |
||
83 | public function aggregateRating($aggregateRating) |
||
87 | |||
88 | /** |
||
89 | * An alias for the item. |
||
90 | * |
||
91 | * @param string|string[] $alternateName |
||
92 | * |
||
93 | * @return static |
||
94 | * |
||
95 | * @see http://schema.org/alternateName |
||
96 | */ |
||
97 | public function alternateName($alternateName) |
||
101 | |||
102 | /** |
||
103 | * An amenity feature (e.g. a characteristic or service) of the |
||
104 | * Accommodation. This generic property does not make a statement about |
||
105 | * whether the feature is included in an offer for the main accommodation or |
||
106 | * available at extra costs. |
||
107 | * |
||
108 | * @param \Spatie\SchemaOrg\Contracts\LocationFeatureSpecificationContract|\Spatie\SchemaOrg\Contracts\LocationFeatureSpecificationContract[] $amenityFeature |
||
109 | * |
||
110 | * @return static |
||
111 | * |
||
112 | * @see http://schema.org/amenityFeature |
||
113 | */ |
||
114 | public function amenityFeature($amenityFeature) |
||
118 | |||
119 | /** |
||
120 | * A short textual code (also called "store code") that uniquely identifies |
||
121 | * a place of business. The code is typically assigned by the |
||
122 | * parentOrganization and used in structured URLs. |
||
123 | * |
||
124 | * For example, in the URL |
||
125 | * http://www.starbucks.co.uk/store-locator/etc/detail/3047 the code "3047" |
||
126 | * is a branchCode for a particular branch. |
||
127 | * |
||
128 | * @param string|string[] $branchCode |
||
129 | * |
||
130 | * @return static |
||
131 | * |
||
132 | * @see http://schema.org/branchCode |
||
133 | */ |
||
134 | public function branchCode($branchCode) |
||
138 | |||
139 | /** |
||
140 | * The basic containment relation between a place and one that contains it. |
||
141 | * |
||
142 | * @param \Spatie\SchemaOrg\Contracts\PlaceContract|\Spatie\SchemaOrg\Contracts\PlaceContract[] $containedIn |
||
143 | * |
||
144 | * @return static |
||
145 | * |
||
146 | * @see http://schema.org/containedIn |
||
147 | */ |
||
148 | public function containedIn($containedIn) |
||
152 | |||
153 | /** |
||
154 | * The basic containment relation between a place and one that contains it. |
||
155 | * |
||
156 | * @param \Spatie\SchemaOrg\Contracts\PlaceContract|\Spatie\SchemaOrg\Contracts\PlaceContract[] $containedInPlace |
||
157 | * |
||
158 | * @return static |
||
159 | * |
||
160 | * @see http://schema.org/containedInPlace |
||
161 | */ |
||
162 | public function containedInPlace($containedInPlace) |
||
166 | |||
167 | /** |
||
168 | * The basic containment relation between a place and another that it |
||
169 | * contains. |
||
170 | * |
||
171 | * @param \Spatie\SchemaOrg\Contracts\PlaceContract|\Spatie\SchemaOrg\Contracts\PlaceContract[] $containsPlace |
||
172 | * |
||
173 | * @return static |
||
174 | * |
||
175 | * @see http://schema.org/containsPlace |
||
176 | */ |
||
177 | public function containsPlace($containsPlace) |
||
181 | |||
182 | /** |
||
183 | * A description of the item. |
||
184 | * |
||
185 | * @param string|string[] $description |
||
186 | * |
||
187 | * @return static |
||
188 | * |
||
189 | * @see http://schema.org/description |
||
190 | */ |
||
191 | public function description($description) |
||
195 | |||
196 | /** |
||
197 | * A sub property of description. A short description of the item used to |
||
198 | * disambiguate from other, similar items. Information from other properties |
||
199 | * (in particular, name) may be necessary for the description to be useful |
||
200 | * for disambiguation. |
||
201 | * |
||
202 | * @param string|string[] $disambiguatingDescription |
||
203 | * |
||
204 | * @return static |
||
205 | * |
||
206 | * @see http://schema.org/disambiguatingDescription |
||
207 | */ |
||
208 | public function disambiguatingDescription($disambiguatingDescription) |
||
212 | |||
213 | /** |
||
214 | * Upcoming or past event associated with this place, organization, or |
||
215 | * action. |
||
216 | * |
||
217 | * @param \Spatie\SchemaOrg\Contracts\EventContract|\Spatie\SchemaOrg\Contracts\EventContract[] $event |
||
218 | * |
||
219 | * @return static |
||
220 | * |
||
221 | * @see http://schema.org/event |
||
222 | */ |
||
223 | public function event($event) |
||
227 | |||
228 | /** |
||
229 | * Upcoming or past events associated with this place or organization. |
||
230 | * |
||
231 | * @param \Spatie\SchemaOrg\Contracts\EventContract|\Spatie\SchemaOrg\Contracts\EventContract[] $events |
||
232 | * |
||
233 | * @return static |
||
234 | * |
||
235 | * @see http://schema.org/events |
||
236 | */ |
||
237 | public function events($events) |
||
241 | |||
242 | /** |
||
243 | * The fax number. |
||
244 | * |
||
245 | * @param string|string[] $faxNumber |
||
246 | * |
||
247 | * @return static |
||
248 | * |
||
249 | * @see http://schema.org/faxNumber |
||
250 | */ |
||
251 | public function faxNumber($faxNumber) |
||
255 | |||
256 | /** |
||
257 | * The geo coordinates of the place. |
||
258 | * |
||
259 | * @param \Spatie\SchemaOrg\Contracts\GeoCoordinatesContract|\Spatie\SchemaOrg\Contracts\GeoCoordinatesContract[]|\Spatie\SchemaOrg\Contracts\GeoShapeContract|\Spatie\SchemaOrg\Contracts\GeoShapeContract[] $geo |
||
260 | * |
||
261 | * @return static |
||
262 | * |
||
263 | * @see http://schema.org/geo |
||
264 | */ |
||
265 | public function geo($geo) |
||
269 | |||
270 | /** |
||
271 | * The [Global Location Number](http://www.gs1.org/gln) (GLN, sometimes also |
||
272 | * referred to as International Location Number or ILN) of the respective |
||
273 | * organization, person, or place. The GLN is a 13-digit number used to |
||
274 | * identify parties and physical locations. |
||
275 | * |
||
276 | * @param string|string[] $globalLocationNumber |
||
277 | * |
||
278 | * @return static |
||
279 | * |
||
280 | * @see http://schema.org/globalLocationNumber |
||
281 | */ |
||
282 | public function globalLocationNumber($globalLocationNumber) |
||
286 | |||
287 | /** |
||
288 | * A URL to a map of the place. |
||
289 | * |
||
290 | * @param \Spatie\SchemaOrg\Contracts\MapContract|\Spatie\SchemaOrg\Contracts\MapContract[]|string|string[] $hasMap |
||
291 | * |
||
292 | * @return static |
||
293 | * |
||
294 | * @see http://schema.org/hasMap |
||
295 | */ |
||
296 | public function hasMap($hasMap) |
||
300 | |||
301 | /** |
||
302 | * The identifier property represents any kind of identifier for any kind of |
||
303 | * [[Thing]], such as ISBNs, GTIN codes, UUIDs etc. Schema.org provides |
||
304 | * dedicated properties for representing many of these, either as textual |
||
305 | * strings or as URL (URI) links. See [background |
||
306 | * notes](/docs/datamodel.html#identifierBg) for more details. |
||
307 | * |
||
308 | * @param \Spatie\SchemaOrg\Contracts\PropertyValueContract|\Spatie\SchemaOrg\Contracts\PropertyValueContract[]|string|string[] $identifier |
||
309 | * |
||
310 | * @return static |
||
311 | * |
||
312 | * @see http://schema.org/identifier |
||
313 | */ |
||
314 | public function identifier($identifier) |
||
318 | |||
319 | /** |
||
320 | * An image of the item. This can be a [[URL]] or a fully described |
||
321 | * [[ImageObject]]. |
||
322 | * |
||
323 | * @param \Spatie\SchemaOrg\Contracts\ImageObjectContract|\Spatie\SchemaOrg\Contracts\ImageObjectContract[]|string|string[] $image |
||
324 | * |
||
325 | * @return static |
||
326 | * |
||
327 | * @see http://schema.org/image |
||
328 | */ |
||
329 | public function image($image) |
||
333 | |||
334 | /** |
||
335 | * A flag to signal that the item, event, or place is accessible for free. |
||
336 | * |
||
337 | * @param bool|bool[] $isAccessibleForFree |
||
338 | * |
||
339 | * @return static |
||
340 | * |
||
341 | * @see http://schema.org/isAccessibleForFree |
||
342 | */ |
||
343 | public function isAccessibleForFree($isAccessibleForFree) |
||
347 | |||
348 | /** |
||
349 | * The International Standard of Industrial Classification of All Economic |
||
350 | * Activities (ISIC), Revision 4 code for a particular organization, |
||
351 | * business person, or place. |
||
352 | * |
||
353 | * @param string|string[] $isicV4 |
||
354 | * |
||
355 | * @return static |
||
356 | * |
||
357 | * @see http://schema.org/isicV4 |
||
358 | */ |
||
359 | public function isicV4($isicV4) |
||
363 | |||
364 | /** |
||
365 | * The latitude of a location. For example ```37.42242``` ([WGS |
||
366 | * 84](https://en.wikipedia.org/wiki/World_Geodetic_System)). |
||
367 | * |
||
368 | * @param float|float[]|int|int[]|string|string[] $latitude |
||
369 | * |
||
370 | * @return static |
||
371 | * |
||
372 | * @see http://schema.org/latitude |
||
373 | */ |
||
374 | public function latitude($latitude) |
||
378 | |||
379 | /** |
||
380 | * An associated logo. |
||
381 | * |
||
382 | * @param \Spatie\SchemaOrg\Contracts\ImageObjectContract|\Spatie\SchemaOrg\Contracts\ImageObjectContract[]|string|string[] $logo |
||
383 | * |
||
384 | * @return static |
||
385 | * |
||
386 | * @see http://schema.org/logo |
||
387 | */ |
||
388 | public function logo($logo) |
||
392 | |||
393 | /** |
||
394 | * The longitude of a location. For example ```-122.08585``` ([WGS |
||
395 | * 84](https://en.wikipedia.org/wiki/World_Geodetic_System)). |
||
396 | * |
||
397 | * @param float|float[]|int|int[]|string|string[] $longitude |
||
398 | * |
||
399 | * @return static |
||
400 | * |
||
401 | * @see http://schema.org/longitude |
||
402 | */ |
||
403 | public function longitude($longitude) |
||
407 | |||
408 | /** |
||
409 | * Indicates a page (or other CreativeWork) for which this thing is the main |
||
410 | * entity being described. See [background |
||
411 | * notes](/docs/datamodel.html#mainEntityBackground) for details. |
||
412 | * |
||
413 | * @param \Spatie\SchemaOrg\Contracts\CreativeWorkContract|\Spatie\SchemaOrg\Contracts\CreativeWorkContract[]|string|string[] $mainEntityOfPage |
||
414 | * |
||
415 | * @return static |
||
416 | * |
||
417 | * @see http://schema.org/mainEntityOfPage |
||
418 | */ |
||
419 | public function mainEntityOfPage($mainEntityOfPage) |
||
423 | |||
424 | /** |
||
425 | * A URL to a map of the place. |
||
426 | * |
||
427 | * @param string|string[] $map |
||
428 | * |
||
429 | * @return static |
||
430 | * |
||
431 | * @see http://schema.org/map |
||
432 | */ |
||
433 | public function map($map) |
||
437 | |||
438 | /** |
||
439 | * A URL to a map of the place. |
||
440 | * |
||
441 | * @param string|string[] $maps |
||
442 | * |
||
443 | * @return static |
||
444 | * |
||
445 | * @see http://schema.org/maps |
||
446 | */ |
||
447 | public function maps($maps) |
||
451 | |||
452 | /** |
||
453 | * The total number of individuals that may attend an event or venue. |
||
454 | * |
||
455 | * @param int|int[] $maximumAttendeeCapacity |
||
456 | * |
||
457 | * @return static |
||
458 | * |
||
459 | * @see http://schema.org/maximumAttendeeCapacity |
||
460 | */ |
||
461 | public function maximumAttendeeCapacity($maximumAttendeeCapacity) |
||
465 | |||
466 | /** |
||
467 | * The name of the item. |
||
468 | * |
||
469 | * @param string|string[] $name |
||
470 | * |
||
471 | * @return static |
||
472 | * |
||
473 | * @see http://schema.org/name |
||
474 | */ |
||
475 | public function name($name) |
||
479 | |||
480 | /** |
||
481 | * The opening hours of a certain place. |
||
482 | * |
||
483 | * @param \Spatie\SchemaOrg\Contracts\OpeningHoursSpecificationContract|\Spatie\SchemaOrg\Contracts\OpeningHoursSpecificationContract[] $openingHoursSpecification |
||
484 | * |
||
485 | * @return static |
||
486 | * |
||
487 | * @see http://schema.org/openingHoursSpecification |
||
488 | */ |
||
489 | public function openingHoursSpecification($openingHoursSpecification) |
||
493 | |||
494 | /** |
||
495 | * A photograph of this place. |
||
496 | * |
||
497 | * @param \Spatie\SchemaOrg\Contracts\ImageObjectContract|\Spatie\SchemaOrg\Contracts\ImageObjectContract[]|\Spatie\SchemaOrg\Contracts\PhotographContract|\Spatie\SchemaOrg\Contracts\PhotographContract[] $photo |
||
498 | * |
||
499 | * @return static |
||
500 | * |
||
501 | * @see http://schema.org/photo |
||
502 | */ |
||
503 | public function photo($photo) |
||
507 | |||
508 | /** |
||
509 | * Photographs of this place. |
||
510 | * |
||
511 | * @param \Spatie\SchemaOrg\Contracts\ImageObjectContract|\Spatie\SchemaOrg\Contracts\ImageObjectContract[]|\Spatie\SchemaOrg\Contracts\PhotographContract|\Spatie\SchemaOrg\Contracts\PhotographContract[] $photos |
||
512 | * |
||
513 | * @return static |
||
514 | * |
||
515 | * @see http://schema.org/photos |
||
516 | */ |
||
517 | public function photos($photos) |
||
521 | |||
522 | /** |
||
523 | * Indicates a potential Action, which describes an idealized action in |
||
524 | * which this thing would play an 'object' role. |
||
525 | * |
||
526 | * @param \Spatie\SchemaOrg\Contracts\ActionContract|\Spatie\SchemaOrg\Contracts\ActionContract[] $potentialAction |
||
527 | * |
||
528 | * @return static |
||
529 | * |
||
530 | * @see http://schema.org/potentialAction |
||
531 | */ |
||
532 | public function potentialAction($potentialAction) |
||
536 | |||
537 | /** |
||
538 | * A flag to signal that the [[Place]] is open to public visitors. If this |
||
539 | * property is omitted there is no assumed default boolean value |
||
540 | * |
||
541 | * @param bool|bool[] $publicAccess |
||
542 | * |
||
543 | * @return static |
||
544 | * |
||
545 | * @see http://schema.org/publicAccess |
||
546 | */ |
||
547 | public function publicAccess($publicAccess) |
||
551 | |||
552 | /** |
||
553 | * A review of the item. |
||
554 | * |
||
555 | * @param \Spatie\SchemaOrg\Contracts\ReviewContract|\Spatie\SchemaOrg\Contracts\ReviewContract[] $review |
||
556 | * |
||
557 | * @return static |
||
558 | * |
||
559 | * @see http://schema.org/review |
||
560 | */ |
||
561 | public function review($review) |
||
565 | |||
566 | /** |
||
567 | * Review of the item. |
||
568 | * |
||
569 | * @param \Spatie\SchemaOrg\Contracts\ReviewContract|\Spatie\SchemaOrg\Contracts\ReviewContract[] $reviews |
||
570 | * |
||
571 | * @return static |
||
572 | * |
||
573 | * @see http://schema.org/reviews |
||
574 | */ |
||
575 | public function reviews($reviews) |
||
579 | |||
580 | /** |
||
581 | * URL of a reference Web page that unambiguously indicates the item's |
||
582 | * identity. E.g. the URL of the item's Wikipedia page, Wikidata entry, or |
||
583 | * official website. |
||
584 | * |
||
585 | * @param string|string[] $sameAs |
||
586 | * |
||
587 | * @return static |
||
588 | * |
||
589 | * @see http://schema.org/sameAs |
||
590 | */ |
||
591 | public function sameAs($sameAs) |
||
595 | |||
596 | /** |
||
597 | * A slogan or motto associated with the item. |
||
598 | * |
||
599 | * @param string|string[] $slogan |
||
600 | * |
||
601 | * @return static |
||
602 | * |
||
603 | * @see http://schema.org/slogan |
||
604 | */ |
||
605 | public function slogan($slogan) |
||
609 | |||
610 | /** |
||
611 | * Indicates whether it is allowed to smoke in the place, e.g. in the |
||
612 | * restaurant, hotel or hotel room. |
||
613 | * |
||
614 | * @param bool|bool[] $smokingAllowed |
||
615 | * |
||
616 | * @return static |
||
617 | * |
||
618 | * @see http://schema.org/smokingAllowed |
||
619 | */ |
||
620 | public function smokingAllowed($smokingAllowed) |
||
624 | |||
625 | /** |
||
626 | * The special opening hours of a certain place. |
||
627 | * |
||
628 | * Use this to explicitly override general opening hours brought in scope by |
||
629 | * [[openingHoursSpecification]] or [[openingHours]]. |
||
630 | * |
||
631 | * @param \Spatie\SchemaOrg\Contracts\OpeningHoursSpecificationContract|\Spatie\SchemaOrg\Contracts\OpeningHoursSpecificationContract[] $specialOpeningHoursSpecification |
||
632 | * |
||
633 | * @return static |
||
634 | * |
||
635 | * @see http://schema.org/specialOpeningHoursSpecification |
||
636 | */ |
||
637 | public function specialOpeningHoursSpecification($specialOpeningHoursSpecification) |
||
641 | |||
642 | /** |
||
643 | * A CreativeWork or Event about this Thing. |
||
644 | * |
||
645 | * @param \Spatie\SchemaOrg\Contracts\CreativeWorkContract|\Spatie\SchemaOrg\Contracts\CreativeWorkContract[]|\Spatie\SchemaOrg\Contracts\EventContract|\Spatie\SchemaOrg\Contracts\EventContract[] $subjectOf |
||
646 | * |
||
647 | * @return static |
||
648 | * |
||
649 | * @see http://schema.org/subjectOf |
||
650 | */ |
||
651 | public function subjectOf($subjectOf) |
||
655 | |||
656 | /** |
||
657 | * The telephone number. |
||
658 | * |
||
659 | * @param string|string[] $telephone |
||
660 | * |
||
661 | * @return static |
||
662 | * |
||
663 | * @see http://schema.org/telephone |
||
664 | */ |
||
665 | public function telephone($telephone) |
||
669 | |||
670 | /** |
||
671 | * URL of the item. |
||
672 | * |
||
673 | * @param string|string[] $url |
||
674 | * |
||
675 | * @return static |
||
676 | * |
||
677 | * @see http://schema.org/url |
||
678 | */ |
||
679 | public function url($url) |
||
683 | |||
684 | } |
||
685 |