Complex classes like PlaceTrait 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 PlaceTrait, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 13 | trait PlaceTrait |
||
| 14 | { |
||
| 15 | /** |
||
| 16 | * A property-value pair representing an additional characteristics of the entitity, |
||
| 17 | * e.g. a product feature or another characteristic for which there is no matching property in schema.org. |
||
| 18 | * Note: Publishers should be aware that applications designed to use specific schema.org properties |
||
| 19 | * (e.g. http://schema.org/width, http://schema.org/color, http://schema.org/gtin13, ...) will typically expect |
||
| 20 | * such data to be provided using those properties, rather than using the generic |
||
| 21 | * |
||
| 22 | * @var PropertyValue |
||
| 23 | */ |
||
| 24 | private $_additionalProperty; |
||
| 25 | |||
| 26 | /** |
||
| 27 | * @return PropertyValue |
||
| 28 | */ |
||
| 29 | public function getAdditionalProperty() |
||
| 33 | |||
| 34 | /** |
||
| 35 | * @param PropertyValue $additionalProperty |
||
| 36 | * @return PlaceTrait |
||
|
|
|||
| 37 | */ |
||
| 38 | public function setAdditionalProperty($additionalProperty) |
||
| 43 | |||
| 44 | /** |
||
| 45 | * Physical address of the item. |
||
| 46 | * |
||
| 47 | * @var PostalAddress|string |
||
| 48 | */ |
||
| 49 | private $_address; |
||
| 50 | |||
| 51 | /** |
||
| 52 | * @return PostalAddress|string |
||
| 53 | */ |
||
| 54 | public function getAddress() |
||
| 58 | |||
| 59 | /** |
||
| 60 | * @param PostalAddress|string $address |
||
| 61 | * @return PlaceTrait |
||
| 62 | */ |
||
| 63 | public function setAddress($address) |
||
| 68 | |||
| 69 | /** |
||
| 70 | * The overall rating, based on a collection of reviews or ratings, of the item. |
||
| 71 | * |
||
| 72 | * @var AggregateRating |
||
| 73 | */ |
||
| 74 | private $_aggregateRating; |
||
| 75 | |||
| 76 | /** |
||
| 77 | * @return AggregateRating |
||
| 78 | */ |
||
| 79 | public function getAggregateRating() |
||
| 83 | |||
| 84 | /** |
||
| 85 | * @param AggregateRating $aggregateRating |
||
| 86 | * @return PlaceTrait |
||
| 87 | */ |
||
| 88 | public function setAggregateRating($aggregateRating) |
||
| 93 | |||
| 94 | /** |
||
| 95 | * An amenity feature (e.g. a characteristic or service) of the Accommodation. |
||
| 96 | * This generic property does not make a statement about whether the feature is included in an offer |
||
| 97 | * for the main accommodation or available at extra costs. |
||
| 98 | * |
||
| 99 | * @var LocationFeatureSpecification |
||
| 100 | */ |
||
| 101 | private $_amenityFeature; |
||
| 102 | |||
| 103 | /** |
||
| 104 | * @return LocationFeatureSpecification |
||
| 105 | */ |
||
| 106 | public function getAmenityFeature() |
||
| 110 | |||
| 111 | /** |
||
| 112 | * @param LocationFeatureSpecification $amenityFeature |
||
| 113 | * @return PlaceTrait |
||
| 114 | */ |
||
| 115 | public function setAmenityFeature($amenityFeature) |
||
| 120 | |||
| 121 | /** |
||
| 122 | * A short textual code (also called "store code") that uniquely identifies a place of business. |
||
| 123 | * The code is typically assigned by the parentOrganization and used in structured URLs. |
||
| 124 | * For example, in the URL http://www.starbucks.co.uk/store-locator/etc/detail/3047 |
||
| 125 | * the code "3047" is a branchCode for a particular branch. |
||
| 126 | * |
||
| 127 | * @var string |
||
| 128 | */ |
||
| 129 | private $_branchCode; |
||
| 130 | |||
| 131 | /** |
||
| 132 | * @return string |
||
| 133 | */ |
||
| 134 | public function getBranchCode() |
||
| 138 | |||
| 139 | /** |
||
| 140 | * @param string $branchCode |
||
| 141 | * @return PlaceTrait |
||
| 142 | */ |
||
| 143 | public function setBranchCode($branchCode) |
||
| 148 | |||
| 149 | /** |
||
| 150 | * The basic containment relation between a place and one that contains it. |
||
| 151 | * Supersedes containedIn. |
||
| 152 | * Inverse property: containsPlace. |
||
| 153 | * |
||
| 154 | * @var Place |
||
| 155 | */ |
||
| 156 | private $_containedInPlace; |
||
| 157 | |||
| 158 | /** |
||
| 159 | * @return Place |
||
| 160 | */ |
||
| 161 | public function getContainedInPlace() |
||
| 165 | |||
| 166 | /** |
||
| 167 | * @param Place $containedInPlace |
||
| 168 | * @return PlaceTrait |
||
| 169 | */ |
||
| 170 | public function setContainedInPlace($containedInPlace) |
||
| 175 | |||
| 176 | /** |
||
| 177 | * The basic containment relation between a place and another that it contains. |
||
| 178 | * Inverse property: containedInPlace. |
||
| 179 | * |
||
| 180 | * @var Place |
||
| 181 | */ |
||
| 182 | private $_containsPlace; |
||
| 183 | |||
| 184 | /** |
||
| 185 | * @return Place |
||
| 186 | */ |
||
| 187 | public function getContainsPlace() |
||
| 191 | |||
| 192 | /** |
||
| 193 | * @param Place $containsPlace |
||
| 194 | * @return PlaceTrait |
||
| 195 | */ |
||
| 196 | public function setContainsPlace($containsPlace) |
||
| 201 | |||
| 202 | /** |
||
| 203 | * Upcoming or past event associated with this place, organization, or action. |
||
| 204 | * Supersedes events. |
||
| 205 | * |
||
| 206 | * @var Event |
||
| 207 | */ |
||
| 208 | private $_event; |
||
| 209 | |||
| 210 | /** |
||
| 211 | * @return Event |
||
| 212 | */ |
||
| 213 | public function getEvent() |
||
| 217 | |||
| 218 | /** |
||
| 219 | * @param Event $event |
||
| 220 | * @return PlaceTrait |
||
| 221 | */ |
||
| 222 | public function setEvent($event) |
||
| 227 | |||
| 228 | /** |
||
| 229 | * The fax number. |
||
| 230 | * |
||
| 231 | * @var string |
||
| 232 | */ |
||
| 233 | private $_faxNumber; |
||
| 234 | |||
| 235 | /** |
||
| 236 | * @return string |
||
| 237 | */ |
||
| 238 | public function getFaxNumber() |
||
| 242 | |||
| 243 | /** |
||
| 244 | * @param string $faxNumber |
||
| 245 | * @return PlaceTrait |
||
| 246 | */ |
||
| 247 | public function setFaxNumber($faxNumber) |
||
| 252 | |||
| 253 | /** |
||
| 254 | * The geo coordinates of the place. |
||
| 255 | * |
||
| 256 | * @var GeoCoordinates|GeoShape |
||
| 257 | */ |
||
| 258 | private $_geo; |
||
| 259 | |||
| 260 | /** |
||
| 261 | * @return GeoCoordinates|GeoShape |
||
| 262 | */ |
||
| 263 | public function getGeo() |
||
| 267 | |||
| 268 | /** |
||
| 269 | * @param GeoCoordinates|GeoShape $geo |
||
| 270 | * @return PlaceTrait |
||
| 271 | */ |
||
| 272 | public function setGeo($geo) |
||
| 277 | |||
| 278 | /** |
||
| 279 | * Represents a relationship between two geometries (or the places they represent), relating a containing geometry |
||
| 280 | * to a contained geometry. "a contains b iff no points of b lie in the exterior of a, and at least one point |
||
| 281 | * of the interior of b lies in the interior of a". As defined in DE-9IM. |
||
| 282 | * |
||
| 283 | * @var |
||
| 284 | */ |
||
| 285 | private $_geospatiallyContains; |
||
| 286 | |||
| 287 | /** |
||
| 288 | * @return mixed |
||
| 289 | */ |
||
| 290 | public function getGeospatiallyContains() |
||
| 294 | |||
| 295 | /** |
||
| 296 | * @param mixed $geospatiallyContains |
||
| 297 | * @return PlaceTrait |
||
| 298 | */ |
||
| 299 | public function setGeospatiallyContains($geospatiallyContains) |
||
| 304 | |||
| 305 | /** |
||
| 306 | * Represents a relationship between two geometries (or the places they represent), |
||
| 307 | * relating a geometry to another that covers it. As defined in DE-9IM. |
||
| 308 | * |
||
| 309 | * @var |
||
| 310 | */ |
||
| 311 | private $_geospatiallyCoveredBy; |
||
| 312 | |||
| 313 | /** |
||
| 314 | * @return mixed |
||
| 315 | */ |
||
| 316 | public function getGeospatiallyCoveredBy() |
||
| 320 | |||
| 321 | /** |
||
| 322 | * @param mixed $geospatiallyCoveredBy |
||
| 323 | * @return PlaceTrait |
||
| 324 | */ |
||
| 325 | public function setGeospatiallyCoveredBy($geospatiallyCoveredBy) |
||
| 330 | |||
| 331 | /** |
||
| 332 | * Represents a relationship between two geometries (or the places they represent), relating a covering geometry |
||
| 333 | * to a covered geometry. "Every point of b is a point of (the interior or boundary of) a". As defined in DE-9IM. |
||
| 334 | * |
||
| 335 | * @var GeospatialGeometry|Place |
||
| 336 | */ |
||
| 337 | private $_geospatiallyCovers; |
||
| 338 | |||
| 339 | /** |
||
| 340 | * @return GeospatialGeometry|Place |
||
| 341 | */ |
||
| 342 | public function getGeospatiallyCovers() |
||
| 346 | |||
| 347 | /** |
||
| 348 | * @param GeospatialGeometry|Place $geospatiallyCovers |
||
| 349 | * @return PlaceTrait |
||
| 350 | */ |
||
| 351 | public function setGeospatiallyCovers($geospatiallyCovers) |
||
| 356 | |||
| 357 | /** |
||
| 358 | * Represents a relationship between two geometries (or the places they represent), relating a geometry to another |
||
| 359 | * that crosses it: "a crosses b: they have some but not all interior points in common, and the dimension of the |
||
| 360 | * intersection is less than that of at least one of them". As defined in DE-9IM. |
||
| 361 | * |
||
| 362 | * @var GeospatialGeometry|Place |
||
| 363 | */ |
||
| 364 | private $_geospatiallyCrosses; |
||
| 365 | |||
| 366 | /** |
||
| 367 | * @return GeospatialGeometry|Place |
||
| 368 | */ |
||
| 369 | public function getGeospatiallyCrosses() |
||
| 373 | |||
| 374 | /** |
||
| 375 | * @param GeospatialGeometry|Place $geospatiallyCrosses |
||
| 376 | * @return PlaceTrait |
||
| 377 | */ |
||
| 378 | public function setGeospatiallyCrosses($geospatiallyCrosses) |
||
| 383 | |||
| 384 | /** |
||
| 385 | * Represents spatial relations in which two geometries (or the places they represent) are topologically disjoint: |
||
| 386 | * they have no point in common. They form a set of disconnected geometries." |
||
| 387 | * (a symmetric relationship, as defined in DE-9IM) |
||
| 388 | * |
||
| 389 | * @var GeospatialGeometry|Place |
||
| 390 | */ |
||
| 391 | private $_geospatiallyDisjoint; |
||
| 392 | |||
| 393 | /** |
||
| 394 | * @return GeospatialGeometry|Place |
||
| 395 | */ |
||
| 396 | public function getGeospatiallyDisjoint() |
||
| 400 | |||
| 401 | /** |
||
| 402 | * @param GeospatialGeometry|Place $geospatiallyDisjoint |
||
| 403 | * @return PlaceTrait |
||
| 404 | */ |
||
| 405 | public function setGeospatiallyDisjoint($geospatiallyDisjoint) |
||
| 410 | |||
| 411 | /** |
||
| 412 | * Represents spatial relations in which two geometries (or the places they represent) are topologically equal, |
||
| 413 | * as defined in DE-9IM. "Two geometries are topologically equal if their interiors intersect and no part |
||
| 414 | * of the interior or boundary of one geometry intersects the exterior of the other" (a symmetric relationship) |
||
| 415 | * |
||
| 416 | * @var GeospatialGeometry|Place |
||
| 417 | */ |
||
| 418 | private $_geospatiallyEquals; |
||
| 419 | |||
| 420 | /** |
||
| 421 | * @return GeospatialGeometry|Place |
||
| 422 | */ |
||
| 423 | public function getGeospatiallyEquals() |
||
| 427 | |||
| 428 | /** |
||
| 429 | * @param GeospatialGeometry|Place $geospatiallyEquals |
||
| 430 | * @return PlaceTrait |
||
| 431 | */ |
||
| 432 | public function setGeospatiallyEquals($geospatiallyEquals) |
||
| 437 | |||
| 438 | /** |
||
| 439 | * Represents spatial relations in which two geometries (or the places they represent) have at least one point |
||
| 440 | * in common. As defined in DE-9IM. |
||
| 441 | * |
||
| 442 | * @var GeospatialGeometry|Place |
||
| 443 | */ |
||
| 444 | private $_geospatiallyIntersects; |
||
| 445 | |||
| 446 | /** |
||
| 447 | * @return GeospatialGeometry|Place |
||
| 448 | */ |
||
| 449 | public function getGeospatiallyIntersects() |
||
| 453 | |||
| 454 | /** |
||
| 455 | * @param mixed $geospatiallyIntersects |
||
| 456 | * @return PlaceTrait |
||
| 457 | */ |
||
| 458 | public function setGeospatiallyIntersects($geospatiallyIntersects) |
||
| 463 | |||
| 464 | /** |
||
| 465 | * Represents a relationship between two geometries (or the places they represent), relating a geometry |
||
| 466 | * to another that geospatially overlaps it, i.e. they have some but not all points in common. As defined in DE-9IM. |
||
| 467 | * |
||
| 468 | * @var GeospatialGeometry|Place |
||
| 469 | */ |
||
| 470 | private $_geospatiallyOverlaps; |
||
| 471 | |||
| 472 | /** |
||
| 473 | * @return GeospatialGeometry|Place |
||
| 474 | */ |
||
| 475 | public function getGeospatiallyOverlaps() |
||
| 479 | |||
| 480 | /** |
||
| 481 | * @param GeospatialGeometry|Place $geospatiallyOverlaps |
||
| 482 | * @return PlaceTrait |
||
| 483 | */ |
||
| 484 | public function setGeospatiallyOverlaps($geospatiallyOverlaps) |
||
| 489 | |||
| 490 | /** |
||
| 491 | * Represents spatial relations in which two geometries (or the places they represent) touch: they have |
||
| 492 | * at least one boundary point in common, but no interior points." (a symmetric relationship, as defined in DE-9IM ) |
||
| 493 | * |
||
| 494 | * @var GeospatialGeometry|Place |
||
| 495 | */ |
||
| 496 | private $_geospatiallyTouches; |
||
| 497 | |||
| 498 | /** |
||
| 499 | * @return GeospatialGeometry|Place |
||
| 500 | */ |
||
| 501 | public function getGeospatiallyTouches() |
||
| 505 | |||
| 506 | /** |
||
| 507 | * @param GeospatialGeometry|Place $geospatiallyTouches |
||
| 508 | * @return PlaceTrait |
||
| 509 | */ |
||
| 510 | public function setGeospatiallyTouches($geospatiallyTouches) |
||
| 515 | |||
| 516 | /** |
||
| 517 | * Represents a relationship between two geometries (or the places they represent), relating a geometry to one |
||
| 518 | * that contains it, i.e. it is inside (i.e. within) its interior. As defined in DE-9IM. |
||
| 519 | * |
||
| 520 | * @var GeospatialGeometry|Place |
||
| 521 | */ |
||
| 522 | private $_geospatiallyWithin; |
||
| 523 | |||
| 524 | /** |
||
| 525 | * @return GeospatialGeometry|Place |
||
| 526 | */ |
||
| 527 | public function getGeospatiallyWithin() |
||
| 531 | |||
| 532 | /** |
||
| 533 | * @param GeospatialGeometry|Place $geospatiallyWithin |
||
| 534 | * @return PlaceTrait |
||
| 535 | */ |
||
| 536 | public function setGeospatiallyWithin($geospatiallyWithin) |
||
| 541 | |||
| 542 | /** |
||
| 543 | * The Global Location Number (GLN, sometimes also referred to as International Location Number or ILN) |
||
| 544 | * of the respective organization, person, or place. The GLN is a 13-digit number used to identify parties |
||
| 545 | * and physical locations. |
||
| 546 | * |
||
| 547 | * @var string |
||
| 548 | */ |
||
| 549 | private $_globalLocationNumber; |
||
| 550 | |||
| 551 | /** |
||
| 552 | * @return string |
||
| 553 | */ |
||
| 554 | public function getGlobalLocationNumber() |
||
| 558 | |||
| 559 | /** |
||
| 560 | * @param string $globalLocationNumber |
||
| 561 | * @return PlaceTrait |
||
| 562 | */ |
||
| 563 | public function setGlobalLocationNumber($globalLocationNumber) |
||
| 568 | |||
| 569 | /** |
||
| 570 | * A URL to a map of the place. |
||
| 571 | * Supersedes map, maps. |
||
| 572 | * |
||
| 573 | * @var Map, URL |
||
| 574 | */ |
||
| 575 | private $_hasMap; |
||
| 576 | |||
| 577 | /** |
||
| 578 | * @return Map |
||
| 579 | */ |
||
| 580 | public function getHasMap() |
||
| 584 | |||
| 585 | /** |
||
| 586 | * @param Map $hasMap |
||
| 587 | * @return PlaceTrait |
||
| 588 | */ |
||
| 589 | public function setHasMap($hasMap) |
||
| 594 | |||
| 595 | /** |
||
| 596 | * A flag to signal that the item, event, or place is accessible for free. |
||
| 597 | * Supersedes free. |
||
| 598 | * |
||
| 599 | * @var Boolean |
||
| 600 | */ |
||
| 601 | private $_isAccessibleForFree; |
||
| 602 | |||
| 603 | /** |
||
| 604 | * @return bool |
||
| 605 | */ |
||
| 606 | public function isAccessibleForFree() |
||
| 610 | |||
| 611 | /** |
||
| 612 | * @param bool $isAccessibleForFree |
||
| 613 | * @return PlaceTrait |
||
| 614 | */ |
||
| 615 | public function setIsAccessibleForFree($isAccessibleForFree) |
||
| 620 | |||
| 621 | /** |
||
| 622 | * The International Standard of Industrial Classification of All Economic Activities (ISIC), |
||
| 623 | * Revision 4 code for a particular organization, business person, or place. |
||
| 624 | * |
||
| 625 | * @var string |
||
| 626 | */ |
||
| 627 | private $_isicV4; |
||
| 628 | |||
| 629 | /** |
||
| 630 | * @return string |
||
| 631 | */ |
||
| 632 | public function getIsicV4() |
||
| 636 | |||
| 637 | /** |
||
| 638 | * @param string $isicV4 |
||
| 639 | * @return PlaceTrait |
||
| 640 | */ |
||
| 641 | public function setIsicV4($isicV4) |
||
| 646 | |||
| 647 | /** |
||
| 648 | * An associated logo. |
||
| 649 | * |
||
| 650 | * @var ImageObject|URL |
||
| 651 | */ |
||
| 652 | private $_logo; |
||
| 653 | |||
| 654 | /** |
||
| 655 | * @return ImageObject|URL |
||
| 656 | */ |
||
| 657 | public function getLogo() |
||
| 661 | |||
| 662 | /** |
||
| 663 | * @param ImageObject|URL $logo |
||
| 664 | * @return PlaceTrait |
||
| 665 | */ |
||
| 666 | public function setLogo($logo) |
||
| 671 | |||
| 672 | /** |
||
| 673 | * The total number of individuals that may attend an event or venue. |
||
| 674 | * |
||
| 675 | * @var Integer |
||
| 676 | */ |
||
| 677 | private $_maximumAttendeeCapacity; |
||
| 678 | |||
| 679 | /** |
||
| 680 | * @return int |
||
| 681 | */ |
||
| 682 | public function getMaximumAttendeeCapacity() |
||
| 686 | |||
| 687 | /** |
||
| 688 | * @param int $maximumAttendeeCapacity |
||
| 689 | * @return PlaceTrait |
||
| 690 | */ |
||
| 691 | public function setMaximumAttendeeCapacity($maximumAttendeeCapacity) |
||
| 696 | |||
| 697 | /** |
||
| 698 | * The opening hours of a certain place. |
||
| 699 | * |
||
| 700 | * @var OpeningHoursSpecification |
||
| 701 | */ |
||
| 702 | private $_openingHoursSpecification; |
||
| 703 | |||
| 704 | /** |
||
| 705 | * @return OpeningHoursSpecification |
||
| 706 | */ |
||
| 707 | public function getOpeningHoursSpecification() |
||
| 711 | |||
| 712 | /** |
||
| 713 | * @param OpeningHoursSpecification $openingHoursSpecification |
||
| 714 | * @return PlaceTrait |
||
| 715 | */ |
||
| 716 | public function setOpeningHoursSpecification($openingHoursSpecification) |
||
| 721 | |||
| 722 | /** |
||
| 723 | * A photograph of this place. Supersedes photos. |
||
| 724 | * |
||
| 725 | * @var ImageObject|Photograph |
||
| 726 | */ |
||
| 727 | private $_photo; |
||
| 728 | |||
| 729 | /** |
||
| 730 | * @return ImageObject|Photograph |
||
| 731 | */ |
||
| 732 | public function getPhoto() |
||
| 736 | |||
| 737 | /** |
||
| 738 | * @param ImageObject|Photograph $photo |
||
| 739 | * @return PlaceTrait |
||
| 740 | */ |
||
| 741 | public function setPhoto($photo) |
||
| 746 | |||
| 747 | /** |
||
| 748 | * A flag to signal that the Place is open to public visitors. |
||
| 749 | * If this property is omitted there is no assumed default boolean value |
||
| 750 | * |
||
| 751 | * @var Boolean |
||
| 752 | */ |
||
| 753 | private $_publicAccess; |
||
| 754 | |||
| 755 | /** |
||
| 756 | * @return bool |
||
| 757 | */ |
||
| 758 | public function isPublicAccess() |
||
| 762 | |||
| 763 | /** |
||
| 764 | * @param bool $publicAccess |
||
| 765 | * @return PlaceTrait |
||
| 766 | */ |
||
| 767 | public function setPublicAccess($publicAccess) |
||
| 772 | |||
| 773 | /** |
||
| 774 | * A review of the item. Supersedes reviews. |
||
| 775 | * |
||
| 776 | * @var Review |
||
| 777 | */ |
||
| 778 | private $_review; |
||
| 779 | |||
| 780 | /** |
||
| 781 | * @return Review |
||
| 782 | */ |
||
| 783 | public function getReview() |
||
| 787 | |||
| 788 | /** |
||
| 789 | * @param Review $review |
||
| 790 | * @return PlaceTrait |
||
| 791 | */ |
||
| 792 | public function setReview($review) |
||
| 797 | |||
| 798 | /** |
||
| 799 | * Indicates whether it is allowed to smoke in the place, e.g. in the restaurant, hotel or hotel room. |
||
| 800 | * |
||
| 801 | * @var Boolean |
||
| 802 | */ |
||
| 803 | private $_smokingAllowed; |
||
| 804 | |||
| 805 | /** |
||
| 806 | * @return bool |
||
| 807 | */ |
||
| 808 | public function isSmokingAllowed() |
||
| 812 | |||
| 813 | /** |
||
| 814 | * @param bool $smokingAllowed |
||
| 815 | * @return PlaceTrait |
||
| 816 | */ |
||
| 817 | public function setSmokingAllowed($smokingAllowed) |
||
| 822 | |||
| 823 | /** |
||
| 824 | * The special opening hours of a certain place. |
||
| 825 | * Use this to explicitly override general opening hours brought in scope by |
||
| 826 | * openingHoursSpecification or openingHours. |
||
| 827 | * |
||
| 828 | * @var OpeningHoursSpecification |
||
| 829 | */ |
||
| 830 | private $_specialOpeningHoursSpecification; |
||
| 831 | |||
| 832 | /** |
||
| 833 | * @return OpeningHoursSpecification |
||
| 834 | */ |
||
| 835 | public function getSpecialOpeningHoursSpecification() |
||
| 839 | |||
| 840 | /** |
||
| 841 | * @param OpeningHoursSpecification $specialOpeningHoursSpecification |
||
| 842 | * @return PlaceTrait |
||
| 843 | */ |
||
| 844 | public function setSpecialOpeningHoursSpecification($specialOpeningHoursSpecification) |
||
| 849 | |||
| 850 | /** |
||
| 851 | * The telephone number. |
||
| 852 | * |
||
| 853 | * @var string |
||
| 854 | */ |
||
| 855 | private $_telephone; |
||
| 856 | |||
| 857 | /** |
||
| 858 | * @return string |
||
| 859 | */ |
||
| 860 | public function getTelephone() |
||
| 864 | |||
| 865 | /** |
||
| 866 | * @param string $telephone |
||
| 867 | * @return PlaceTrait |
||
| 868 | */ |
||
| 869 | public function setTelephone($telephone) |
||
| 874 | } |
In PHP traits cannot be used for type-hinting as they do not define a well-defined structure. This is because any class that uses a trait can rename that trait’s methods.
If you would like to return an object that has a guaranteed set of methods, you could create a companion interface that lists these methods explicitly.