Complex classes like PersonTrait 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 PersonTrait, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 13 | trait PersonTrait |
||
| 14 | { |
||
| 15 | use ThingTrait { |
||
| 16 | fields as thingFields; |
||
| 17 | } |
||
| 18 | |||
| 19 | /** |
||
| 20 | * An additional name for a Person, can be used for a middle name. |
||
| 21 | * |
||
| 22 | * @var string |
||
| 23 | */ |
||
| 24 | private $_additionalName; |
||
| 25 | |||
| 26 | /** |
||
| 27 | * @return string |
||
| 28 | */ |
||
| 29 | public function getAdditionalName() |
||
| 33 | |||
| 34 | /** |
||
| 35 | * @param string $additionalName |
||
| 36 | * @return PersonTrait |
||
|
|
|||
| 37 | */ |
||
| 38 | public function setAdditionalName(string $additionalName) |
||
| 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 PersonTrait |
||
| 62 | */ |
||
| 63 | public function setAddress($address) |
||
| 68 | |||
| 69 | /** |
||
| 70 | * An organization that this person is affiliated with. For example, a school/university, a club, or a team. |
||
| 71 | * |
||
| 72 | * @var Organization |
||
| 73 | */ |
||
| 74 | private $_affiliation; |
||
| 75 | |||
| 76 | /** |
||
| 77 | * @return Organization |
||
| 78 | */ |
||
| 79 | public function getAffiliation() |
||
| 83 | |||
| 84 | /** |
||
| 85 | * @param Organization $affiliation |
||
| 86 | * @return PersonTrait |
||
| 87 | */ |
||
| 88 | public function setAffiliation(Organization $affiliation) |
||
| 93 | |||
| 94 | /** |
||
| 95 | * An organization that the person is an alumni of. |
||
| 96 | * |
||
| 97 | * @var EducationalOrganization|Organization |
||
| 98 | */ |
||
| 99 | private $_alumniOf; |
||
| 100 | |||
| 101 | /** |
||
| 102 | * @return EducationalOrganization|Organization |
||
| 103 | */ |
||
| 104 | public function getAlumniOf() |
||
| 108 | |||
| 109 | /** |
||
| 110 | * @param EducationalOrganization|Organization $alumniOf |
||
| 111 | * @return PersonTrait |
||
| 112 | */ |
||
| 113 | public function setAlumniOf($alumniOf) |
||
| 118 | |||
| 119 | /** |
||
| 120 | * An award won by or for this item. |
||
| 121 | * Supersedes awards. |
||
| 122 | * |
||
| 123 | * @var string |
||
| 124 | */ |
||
| 125 | private $_award; |
||
| 126 | |||
| 127 | /** |
||
| 128 | * @return string |
||
| 129 | */ |
||
| 130 | public function getAward() |
||
| 134 | |||
| 135 | /** |
||
| 136 | * @param string $award |
||
| 137 | * @return PersonTrait |
||
| 138 | */ |
||
| 139 | public function setAward(string $award) |
||
| 144 | |||
| 145 | /** |
||
| 146 | * Date of birth. |
||
| 147 | * |
||
| 148 | * @var Date |
||
| 149 | */ |
||
| 150 | private $_birthDate; |
||
| 151 | |||
| 152 | /** |
||
| 153 | * @return Date |
||
| 154 | */ |
||
| 155 | public function getBirthDate() |
||
| 159 | |||
| 160 | /** |
||
| 161 | * @param Date $birthDate |
||
| 162 | * @return PersonTrait |
||
| 163 | */ |
||
| 164 | public function setBirthDate(Date $birthDate) |
||
| 169 | |||
| 170 | /** |
||
| 171 | * The place where the person was born. |
||
| 172 | * |
||
| 173 | * @var Place |
||
| 174 | */ |
||
| 175 | private $_birthPlace; |
||
| 176 | |||
| 177 | /** |
||
| 178 | * @return Place |
||
| 179 | */ |
||
| 180 | public function getBirthPlace() |
||
| 184 | |||
| 185 | /** |
||
| 186 | * @param Place $birthPlace |
||
| 187 | * @return PersonTrait |
||
| 188 | */ |
||
| 189 | public function setBirthPlace(Place $birthPlace) |
||
| 194 | |||
| 195 | /** |
||
| 196 | * The brand(s) associated with a product or service, or the brand(s) maintained by an organization or business person. |
||
| 197 | * |
||
| 198 | * @var Brand|Organization |
||
| 199 | */ |
||
| 200 | private $_brand; |
||
| 201 | |||
| 202 | /** |
||
| 203 | * @return Brand|Organization |
||
| 204 | */ |
||
| 205 | public function getBrand() |
||
| 209 | |||
| 210 | /** |
||
| 211 | * @param Brand|Organization $brand |
||
| 212 | * @return PersonTrait |
||
| 213 | */ |
||
| 214 | public function setBrand($brand) |
||
| 219 | |||
| 220 | /** |
||
| 221 | * A child of the person. |
||
| 222 | * |
||
| 223 | * @var Person |
||
| 224 | */ |
||
| 225 | private $_children; |
||
| 226 | |||
| 227 | /** |
||
| 228 | * @return Person |
||
| 229 | */ |
||
| 230 | public function getChildren() |
||
| 234 | |||
| 235 | /** |
||
| 236 | * @param Person $children |
||
| 237 | * @return PersonTrait |
||
| 238 | */ |
||
| 239 | public function setChildren(Person $children) |
||
| 244 | |||
| 245 | /** |
||
| 246 | * A colleague of the person. |
||
| 247 | * Supersedes colleagues. |
||
| 248 | * |
||
| 249 | * @var Person |
||
| 250 | */ |
||
| 251 | private $_colleague; |
||
| 252 | |||
| 253 | /** |
||
| 254 | * @return Person |
||
| 255 | */ |
||
| 256 | public function getColleague() |
||
| 260 | |||
| 261 | /** |
||
| 262 | * @param Person $colleague |
||
| 263 | * @return PersonTrait |
||
| 264 | */ |
||
| 265 | public function setColleague(Person $colleague) |
||
| 270 | |||
| 271 | /** |
||
| 272 | * A contact point for a person or organization. |
||
| 273 | * Supersedes contactPoints. |
||
| 274 | * |
||
| 275 | * @var ContactPoint |
||
| 276 | */ |
||
| 277 | private $_contactPoint; |
||
| 278 | |||
| 279 | /** |
||
| 280 | * @return ContactPoint |
||
| 281 | */ |
||
| 282 | public function getContactPoint() |
||
| 286 | |||
| 287 | /** |
||
| 288 | * @param ContactPoint $contactPoint |
||
| 289 | * @return PersonTrait |
||
| 290 | */ |
||
| 291 | public function setContactPoint(ContactPoint $contactPoint) |
||
| 296 | |||
| 297 | /** |
||
| 298 | * Date of death. |
||
| 299 | * |
||
| 300 | * @var Date |
||
| 301 | */ |
||
| 302 | private $_deathDate; |
||
| 303 | |||
| 304 | /** |
||
| 305 | * @return Date |
||
| 306 | */ |
||
| 307 | public function getDeathDate() |
||
| 311 | |||
| 312 | /** |
||
| 313 | * @param Date $deathDate |
||
| 314 | * @return PersonTrait |
||
| 315 | */ |
||
| 316 | public function setDeathDate(Date $deathDate) |
||
| 321 | |||
| 322 | /** |
||
| 323 | * The place where the person died. |
||
| 324 | * |
||
| 325 | * @var Place |
||
| 326 | */ |
||
| 327 | private $_deathPlace; |
||
| 328 | |||
| 329 | /** |
||
| 330 | * @return Place |
||
| 331 | */ |
||
| 332 | public function getDeathPlace() |
||
| 336 | |||
| 337 | /** |
||
| 338 | * @param Place $deathPlace |
||
| 339 | * @return PersonTrait |
||
| 340 | */ |
||
| 341 | public function setDeathPlace(Place $deathPlace) |
||
| 346 | |||
| 347 | /** |
||
| 348 | * The Dun & Bradstreet DUNS number for identifying an organization or business person. |
||
| 349 | * |
||
| 350 | * @var string |
||
| 351 | */ |
||
| 352 | private $_duns; |
||
| 353 | |||
| 354 | /** |
||
| 355 | * @return string |
||
| 356 | */ |
||
| 357 | public function getDuns() |
||
| 361 | |||
| 362 | /** |
||
| 363 | * @param string $duns |
||
| 364 | * @return PersonTrait |
||
| 365 | */ |
||
| 366 | public function setDuns(string $duns) |
||
| 371 | |||
| 372 | /** |
||
| 373 | * Email address. |
||
| 374 | * |
||
| 375 | * @var string |
||
| 376 | */ |
||
| 377 | private $_email; |
||
| 378 | |||
| 379 | /** |
||
| 380 | * @return string |
||
| 381 | */ |
||
| 382 | public function getEmail() |
||
| 386 | |||
| 387 | /** |
||
| 388 | * @param string $email |
||
| 389 | * @return PersonTrait |
||
| 390 | */ |
||
| 391 | public function setEmail(string $email) |
||
| 396 | |||
| 397 | /** |
||
| 398 | * Family name. In the U.S., the last name of an Person. |
||
| 399 | * This can be used along with givenName instead of the name property. |
||
| 400 | * |
||
| 401 | * @var string |
||
| 402 | */ |
||
| 403 | private $_familyName; |
||
| 404 | |||
| 405 | /** |
||
| 406 | * @return string |
||
| 407 | */ |
||
| 408 | public function getFamilyName() |
||
| 412 | |||
| 413 | /** |
||
| 414 | * @param string $familyName |
||
| 415 | * @return PersonTrait |
||
| 416 | */ |
||
| 417 | public function setFamilyName(string $familyName) |
||
| 422 | |||
| 423 | /** |
||
| 424 | * The fax number. |
||
| 425 | * |
||
| 426 | * @var string |
||
| 427 | */ |
||
| 428 | private $_faxNumber; |
||
| 429 | |||
| 430 | /** |
||
| 431 | * @return string |
||
| 432 | */ |
||
| 433 | public function getFaxNumber() |
||
| 437 | |||
| 438 | /** |
||
| 439 | * @param string $faxNumber |
||
| 440 | * @return PersonTrait |
||
| 441 | */ |
||
| 442 | public function setFaxNumber(string $faxNumber) |
||
| 447 | |||
| 448 | /** |
||
| 449 | * The most generic uni-directional social relation. |
||
| 450 | * |
||
| 451 | * @var Person |
||
| 452 | */ |
||
| 453 | private $_follows; |
||
| 454 | |||
| 455 | /** |
||
| 456 | * @return Person |
||
| 457 | */ |
||
| 458 | public function getFollows() |
||
| 462 | |||
| 463 | /** |
||
| 464 | * @param Person $follows |
||
| 465 | * @return PersonTrait |
||
| 466 | */ |
||
| 467 | public function setFollows(Person $follows) |
||
| 472 | |||
| 473 | /** |
||
| 474 | * A person or organization that supports (sponsors) something through some kind of financial contribution. |
||
| 475 | * |
||
| 476 | * @var Organization|Person |
||
| 477 | */ |
||
| 478 | private $_funder; |
||
| 479 | |||
| 480 | /** |
||
| 481 | * @return Organization|Person |
||
| 482 | */ |
||
| 483 | public function getFunder() |
||
| 487 | |||
| 488 | /** |
||
| 489 | * @param Organization|Person $funder |
||
| 490 | * @return PersonTrait |
||
| 491 | */ |
||
| 492 | public function setFunder($funder) |
||
| 497 | |||
| 498 | /** |
||
| 499 | * Gender of the person. While http://schema.org/Male and http://schema.org/Female may be used, |
||
| 500 | * text strings are also acceptable for people who do not identify as a binary gender. |
||
| 501 | * |
||
| 502 | * @var GenderType|string |
||
| 503 | */ |
||
| 504 | private $_gender; |
||
| 505 | |||
| 506 | /** |
||
| 507 | * @return GenderType|string |
||
| 508 | */ |
||
| 509 | public function getGender() |
||
| 513 | |||
| 514 | /** |
||
| 515 | * @param GenderType|string $gender |
||
| 516 | * @return PersonTrait |
||
| 517 | */ |
||
| 518 | public function setGender($gender) |
||
| 523 | |||
| 524 | /** |
||
| 525 | * Given name. In the U.S., the first name of a Person. |
||
| 526 | * This can be used along with familyName instead of the name property. |
||
| 527 | * |
||
| 528 | * @var string |
||
| 529 | */ |
||
| 530 | private $_givenName; |
||
| 531 | |||
| 532 | /** |
||
| 533 | * @return string |
||
| 534 | */ |
||
| 535 | public function getGivenName() |
||
| 539 | |||
| 540 | /** |
||
| 541 | * @param string $givenName |
||
| 542 | * @return PersonTrait |
||
| 543 | */ |
||
| 544 | public function setGivenName(string $givenName) |
||
| 549 | |||
| 550 | /** |
||
| 551 | * The Global Location Number (GLN, sometimes also referred to as International Location Number or ILN) |
||
| 552 | * of the respective organization, person, or place. |
||
| 553 | * The GLN is a 13-digit number used to identify parties and physical locations. |
||
| 554 | * |
||
| 555 | * @var string |
||
| 556 | */ |
||
| 557 | private $_globalLocationNumber; |
||
| 558 | |||
| 559 | /** |
||
| 560 | * @return string |
||
| 561 | */ |
||
| 562 | public function getGlobalLocationNumber() |
||
| 566 | |||
| 567 | /** |
||
| 568 | * @param string $globalLocationNumber |
||
| 569 | * @return PersonTrait |
||
| 570 | */ |
||
| 571 | public function setGlobalLocationNumber(string $globalLocationNumber) |
||
| 576 | |||
| 577 | /** |
||
| 578 | * The Person's occupation. For past professions, use Role for expressing dates. |
||
| 579 | * |
||
| 580 | * @var Occupation |
||
| 581 | */ |
||
| 582 | private $_hasOccupation; |
||
| 583 | |||
| 584 | /** |
||
| 585 | * @return Occupation |
||
| 586 | */ |
||
| 587 | public function getHasOccupation() |
||
| 591 | |||
| 592 | /** |
||
| 593 | * @param Occupation $hasOccupation |
||
| 594 | * @return PersonTrait |
||
| 595 | */ |
||
| 596 | public function setHasOccupation(Occupation $hasOccupation) |
||
| 601 | |||
| 602 | /** |
||
| 603 | * Indicates an OfferCatalog listing for this Organization, Person, or Service. |
||
| 604 | * |
||
| 605 | * @var OfferCatalog |
||
| 606 | */ |
||
| 607 | private $_hasOfferCatalog; |
||
| 608 | |||
| 609 | /** |
||
| 610 | * @return OfferCatalog |
||
| 611 | */ |
||
| 612 | public function getHasOfferCatalog() |
||
| 616 | |||
| 617 | /** |
||
| 618 | * @param OfferCatalog $hasOfferCatalog |
||
| 619 | * @return PersonTrait |
||
| 620 | */ |
||
| 621 | public function setHasOfferCatalog(OfferCatalog $hasOfferCatalog) |
||
| 626 | |||
| 627 | /** |
||
| 628 | * Points-of-Sales operated by the organization or person. |
||
| 629 | * |
||
| 630 | * @var Place |
||
| 631 | */ |
||
| 632 | private $_hasPOS; |
||
| 633 | |||
| 634 | /** |
||
| 635 | * @return Place |
||
| 636 | */ |
||
| 637 | public function getHasPOS() |
||
| 641 | |||
| 642 | /** |
||
| 643 | * @param Place $hasPOS |
||
| 644 | * @return PersonTrait |
||
| 645 | */ |
||
| 646 | public function setHasPOS(Place $hasPOS) |
||
| 651 | |||
| 652 | /** |
||
| 653 | * The height of the item. |
||
| 654 | * |
||
| 655 | * @var Distance|QuantitativeValue |
||
| 656 | */ |
||
| 657 | private $_height; |
||
| 658 | |||
| 659 | /** |
||
| 660 | * @return Distance|QuantitativeValue |
||
| 661 | */ |
||
| 662 | public function getHeight() |
||
| 666 | |||
| 667 | /** |
||
| 668 | * @param Distance|QuantitativeValue $height |
||
| 669 | * @return PersonTrait |
||
| 670 | */ |
||
| 671 | public function setHeight($height) |
||
| 676 | |||
| 677 | /** |
||
| 678 | * A contact location for a person's residence. |
||
| 679 | * |
||
| 680 | * @var ContactPoint|Place |
||
| 681 | */ |
||
| 682 | private $_homeLocation; |
||
| 683 | |||
| 684 | /** |
||
| 685 | * @return ContactPoint|Place |
||
| 686 | */ |
||
| 687 | public function getHomeLocation() |
||
| 691 | |||
| 692 | /** |
||
| 693 | * @param ContactPoint|Place $homeLocation |
||
| 694 | * @return PersonTrait |
||
| 695 | */ |
||
| 696 | public function setHomeLocation($homeLocation) |
||
| 701 | |||
| 702 | /** |
||
| 703 | * An honorific prefix preceding a Person's name such as Dr/Mrs/Mr. |
||
| 704 | * |
||
| 705 | * @var string |
||
| 706 | */ |
||
| 707 | private $_honorificPrefix; |
||
| 708 | |||
| 709 | /** |
||
| 710 | * @return string |
||
| 711 | */ |
||
| 712 | public function getHonorificPrefix() |
||
| 716 | |||
| 717 | /** |
||
| 718 | * @param string $honorificPrefix |
||
| 719 | * @return PersonTrait |
||
| 720 | */ |
||
| 721 | public function setHonorificPrefix(string $honorificPrefix) |
||
| 726 | |||
| 727 | /** |
||
| 728 | * An honorific suffix preceding a Person's name such as M.D. /PhD/MSCSW. |
||
| 729 | * |
||
| 730 | * @var string |
||
| 731 | */ |
||
| 732 | private $_honorificSuffix; |
||
| 733 | |||
| 734 | /** |
||
| 735 | * @return string |
||
| 736 | */ |
||
| 737 | public function getHonorificSuffix() |
||
| 741 | |||
| 742 | /** |
||
| 743 | * @param string $honorificSuffix |
||
| 744 | * @return PersonTrait |
||
| 745 | */ |
||
| 746 | public function setHonorificSuffix(string $honorificSuffix) |
||
| 751 | |||
| 752 | /** |
||
| 753 | * The International Standard of Industrial Classification of All Economic Activities (ISIC), |
||
| 754 | * Revision 4 code for a particular organization, business person, or place. |
||
| 755 | * |
||
| 756 | * @var string |
||
| 757 | */ |
||
| 758 | private $_isicV4; |
||
| 759 | |||
| 760 | /** |
||
| 761 | * @return string |
||
| 762 | */ |
||
| 763 | public function getIsicV4() |
||
| 767 | |||
| 768 | /** |
||
| 769 | * @param string $isicV4 |
||
| 770 | * @return PersonTrait |
||
| 771 | */ |
||
| 772 | public function setIsicV4(string $isicV4) |
||
| 777 | |||
| 778 | /** |
||
| 779 | * The job title of the person (for example, Financial Manager). |
||
| 780 | * |
||
| 781 | * @var string |
||
| 782 | */ |
||
| 783 | private $_jobTitle; |
||
| 784 | |||
| 785 | /** |
||
| 786 | * @return string |
||
| 787 | */ |
||
| 788 | public function getJobTitle() |
||
| 792 | |||
| 793 | /** |
||
| 794 | * @param string $jobTitle |
||
| 795 | * @return PersonTrait |
||
| 796 | */ |
||
| 797 | public function setJobTitle(string $jobTitle) |
||
| 802 | |||
| 803 | /** |
||
| 804 | * The most generic bi-directional social/work relation. |
||
| 805 | * |
||
| 806 | * @var Person |
||
| 807 | */ |
||
| 808 | private $_knows; |
||
| 809 | |||
| 810 | /** |
||
| 811 | * @return Person |
||
| 812 | */ |
||
| 813 | public function getKnows() |
||
| 817 | |||
| 818 | /** |
||
| 819 | * @param Person $knows |
||
| 820 | * @return PersonTrait |
||
| 821 | */ |
||
| 822 | public function setKnows(Person $knows) |
||
| 827 | |||
| 828 | /** |
||
| 829 | * A pointer to products or services offered by the organization or person. |
||
| 830 | * Inverse property: offeredBy. |
||
| 831 | * |
||
| 832 | * @var Offer |
||
| 833 | */ |
||
| 834 | private $_makesOffer; |
||
| 835 | |||
| 836 | /** |
||
| 837 | * @return Offer |
||
| 838 | */ |
||
| 839 | public function getMakesOffer() |
||
| 843 | |||
| 844 | /** |
||
| 845 | * @param Offer $makesOffer |
||
| 846 | * @return PersonTrait |
||
| 847 | */ |
||
| 848 | public function setMakesOffer(Offer $makesOffer) |
||
| 853 | |||
| 854 | /** |
||
| 855 | * An Organization (or ProgramMembership) to which this Person or Organization belongs. |
||
| 856 | * Inverse property: member. |
||
| 857 | * |
||
| 858 | * @var Organization|ProgramMembership |
||
| 859 | */ |
||
| 860 | private $_memberOf; |
||
| 861 | |||
| 862 | /** |
||
| 863 | * @return Organization|ProgramMembership |
||
| 864 | */ |
||
| 865 | public function getMemberOf() |
||
| 869 | |||
| 870 | /** |
||
| 871 | * @param Organization|ProgramMembership $memberOf |
||
| 872 | * @return PersonTrait |
||
| 873 | */ |
||
| 874 | public function setMemberOf($memberOf) |
||
| 879 | |||
| 880 | /** |
||
| 881 | * The North American Industry Classification System (NAICS) code for a particular organization or business person. |
||
| 882 | * |
||
| 883 | * @var string |
||
| 884 | */ |
||
| 885 | private $_naics; |
||
| 886 | |||
| 887 | /** |
||
| 888 | * @return string |
||
| 889 | */ |
||
| 890 | public function getNaics() |
||
| 894 | |||
| 895 | /** |
||
| 896 | * @param string $naics |
||
| 897 | * @return PersonTrait |
||
| 898 | */ |
||
| 899 | public function setNaics(string $naics) |
||
| 904 | |||
| 905 | /** |
||
| 906 | * Nationality of the person. |
||
| 907 | * |
||
| 908 | * @var Country |
||
| 909 | */ |
||
| 910 | private $_nationality; |
||
| 911 | |||
| 912 | /** |
||
| 913 | * @return Country |
||
| 914 | */ |
||
| 915 | public function getNationality() |
||
| 919 | |||
| 920 | /** |
||
| 921 | * @param Country $nationality |
||
| 922 | * @return PersonTrait |
||
| 923 | */ |
||
| 924 | public function setNationality(Country $nationality) |
||
| 929 | |||
| 930 | /** |
||
| 931 | * The total financial value of the person as calculated by subtracting assets from liabilities. |
||
| 932 | * |
||
| 933 | * @var MonetaryAmount|PriceSpecification |
||
| 934 | */ |
||
| 935 | private $_netWorth; |
||
| 936 | |||
| 937 | /** |
||
| 938 | * @return MonetaryAmount|PriceSpecification |
||
| 939 | */ |
||
| 940 | public function getNetWorth() |
||
| 944 | |||
| 945 | /** |
||
| 946 | * @param MonetaryAmount|PriceSpecification $netWorth |
||
| 947 | * @return PersonTrait |
||
| 948 | */ |
||
| 949 | public function setNetWorth($netWorth) |
||
| 954 | |||
| 955 | /** |
||
| 956 | * Products owned by the organization or person. |
||
| 957 | * |
||
| 958 | * @var OwnershipInfo|Product |
||
| 959 | */ |
||
| 960 | private $_owns; |
||
| 961 | |||
| 962 | /** |
||
| 963 | * @return OwnershipInfo|Product |
||
| 964 | */ |
||
| 965 | public function getOwns() |
||
| 969 | |||
| 970 | /** |
||
| 971 | * @param OwnershipInfo|Product $owns |
||
| 972 | * @return PersonTrait |
||
| 973 | */ |
||
| 974 | public function setOwns($owns) |
||
| 979 | |||
| 980 | /** |
||
| 981 | * A parent of this person. Supersedes parents. |
||
| 982 | * |
||
| 983 | * @var Person |
||
| 984 | */ |
||
| 985 | private $_parent; |
||
| 986 | |||
| 987 | /** |
||
| 988 | * @return Person |
||
| 989 | */ |
||
| 990 | public function getParent() |
||
| 994 | |||
| 995 | /** |
||
| 996 | * @param Person $parent |
||
| 997 | * @return PersonTrait |
||
| 998 | */ |
||
| 999 | public function setParent(Person $parent) |
||
| 1004 | |||
| 1005 | /** |
||
| 1006 | * Event that this person is a performer or participant in. |
||
| 1007 | * |
||
| 1008 | * @var Event |
||
| 1009 | */ |
||
| 1010 | private $_performerIn; |
||
| 1011 | |||
| 1012 | /** |
||
| 1013 | * @return Event |
||
| 1014 | */ |
||
| 1015 | public function getPerformerIn() |
||
| 1019 | |||
| 1020 | /** |
||
| 1021 | * @param Event $performerIn |
||
| 1022 | * @return PersonTrait |
||
| 1023 | */ |
||
| 1024 | public function setPerformerIn(Event $performerIn) |
||
| 1029 | |||
| 1030 | /** |
||
| 1031 | * The publishingPrinciples property indicates (typically via URL) a document describing the editorial principles |
||
| 1032 | * of an Organization (or individual e.g. a Person writing a blog) that relate to their activities as a publisher, |
||
| 1033 | * e.g. ethics or diversity policies. When applied to a CreativeWork (e.g. NewsArticle) the principles are those |
||
| 1034 | * of the party primarily responsible for the creation of the CreativeWork. |
||
| 1035 | * |
||
| 1036 | * While such policies are most typically expressed in natural language, sometimes related information |
||
| 1037 | * (e.g. indicating a funder) can be expressed using schema.org terminology. |
||
| 1038 | * |
||
| 1039 | * @var CreativeWork|URL |
||
| 1040 | */ |
||
| 1041 | private $_publishingPrinciples; |
||
| 1042 | |||
| 1043 | /** |
||
| 1044 | * @return CreativeWork|URL |
||
| 1045 | */ |
||
| 1046 | public function getPublishingPrinciples() |
||
| 1050 | |||
| 1051 | /** |
||
| 1052 | * @param CreativeWork|URL $publishingPrinciples |
||
| 1053 | * @return PersonTrait |
||
| 1054 | */ |
||
| 1055 | public function setPublishingPrinciples($publishingPrinciples) |
||
| 1060 | |||
| 1061 | /** |
||
| 1062 | * The most generic familial relation. |
||
| 1063 | * |
||
| 1064 | * @var Person |
||
| 1065 | */ |
||
| 1066 | private $_relatedTo; |
||
| 1067 | |||
| 1068 | /** |
||
| 1069 | * @return Person |
||
| 1070 | */ |
||
| 1071 | public function getRelatedTo() |
||
| 1075 | |||
| 1076 | /** |
||
| 1077 | * @param Person $relatedTo |
||
| 1078 | * @return PersonTrait |
||
| 1079 | */ |
||
| 1080 | public function setRelatedTo(Person $relatedTo) |
||
| 1085 | |||
| 1086 | /** |
||
| 1087 | * A pointer to products or services sought by the organization or person (demand). |
||
| 1088 | * |
||
| 1089 | * @var Demand |
||
| 1090 | */ |
||
| 1091 | private $_seeks; |
||
| 1092 | |||
| 1093 | /** |
||
| 1094 | * @return Demand |
||
| 1095 | */ |
||
| 1096 | public function getSeeks() |
||
| 1100 | |||
| 1101 | /** |
||
| 1102 | * @param Demand $seeks |
||
| 1103 | * @return PersonTrait |
||
| 1104 | */ |
||
| 1105 | public function setSeeks(Demand $seeks) |
||
| 1110 | |||
| 1111 | /** |
||
| 1112 | * A sibling of the person. Supersedes siblings. |
||
| 1113 | * |
||
| 1114 | * @var Person |
||
| 1115 | */ |
||
| 1116 | private $_sibling; |
||
| 1117 | |||
| 1118 | /** |
||
| 1119 | * @return Person |
||
| 1120 | */ |
||
| 1121 | public function getSibling() |
||
| 1125 | |||
| 1126 | /** |
||
| 1127 | * @param Person $sibling |
||
| 1128 | * @return PersonTrait |
||
| 1129 | */ |
||
| 1130 | public function setSibling(Person $sibling) |
||
| 1135 | |||
| 1136 | /** |
||
| 1137 | * A person or organization that supports a thing through a pledge, promise, or financial contribution. |
||
| 1138 | * e.g. a sponsor of a Medical Study or a corporate sponsor of an event. |
||
| 1139 | * |
||
| 1140 | * @var Organization|Person |
||
| 1141 | */ |
||
| 1142 | private $_sponsor; |
||
| 1143 | |||
| 1144 | /** |
||
| 1145 | * @return Organization|Person |
||
| 1146 | */ |
||
| 1147 | public function getSponsor() |
||
| 1151 | |||
| 1152 | /** |
||
| 1153 | * @param Organization|Person $sponsor |
||
| 1154 | * @return PersonTrait |
||
| 1155 | */ |
||
| 1156 | public function setSponsor($sponsor) |
||
| 1161 | |||
| 1162 | /** |
||
| 1163 | * The person's spouse. |
||
| 1164 | * |
||
| 1165 | * @var Person |
||
| 1166 | */ |
||
| 1167 | private $_spouse; |
||
| 1168 | |||
| 1169 | /** |
||
| 1170 | * @return Person |
||
| 1171 | */ |
||
| 1172 | public function getSpouse() |
||
| 1176 | |||
| 1177 | /** |
||
| 1178 | * @param Person $spouse |
||
| 1179 | * @return PersonTrait |
||
| 1180 | */ |
||
| 1181 | public function setSpouse(Person $spouse) |
||
| 1186 | |||
| 1187 | /** |
||
| 1188 | * The Tax / Fiscal ID of the organization or person, e.g. the TIN in the US or the CIF/NIF in Spain. |
||
| 1189 | * |
||
| 1190 | * @var string |
||
| 1191 | */ |
||
| 1192 | private $_taxID; |
||
| 1193 | |||
| 1194 | /** |
||
| 1195 | * @return string |
||
| 1196 | */ |
||
| 1197 | public function getTaxID() |
||
| 1201 | |||
| 1202 | /** |
||
| 1203 | * @param string $taxID |
||
| 1204 | * @return PersonTrait |
||
| 1205 | */ |
||
| 1206 | public function setTaxID(string $taxID) |
||
| 1211 | |||
| 1212 | /** |
||
| 1213 | * The telephone number. |
||
| 1214 | * |
||
| 1215 | * @var string |
||
| 1216 | */ |
||
| 1217 | private $_telephone; |
||
| 1218 | |||
| 1219 | /** |
||
| 1220 | * @return string |
||
| 1221 | */ |
||
| 1222 | public function getTelephone() |
||
| 1226 | |||
| 1227 | /** |
||
| 1228 | * @param string $telephone |
||
| 1229 | * @return PersonTrait |
||
| 1230 | */ |
||
| 1231 | public function setTelephone(string $telephone) |
||
| 1236 | |||
| 1237 | /** |
||
| 1238 | * The Value-added Tax ID of the organization or person. |
||
| 1239 | * |
||
| 1240 | * @var string |
||
| 1241 | */ |
||
| 1242 | private $_vatID; |
||
| 1243 | |||
| 1244 | /** |
||
| 1245 | * @return string |
||
| 1246 | */ |
||
| 1247 | public function getVatID() |
||
| 1251 | |||
| 1252 | /** |
||
| 1253 | * @param string $vatID |
||
| 1254 | * @return PersonTrait |
||
| 1255 | */ |
||
| 1256 | public function setVatID(string $vatID) |
||
| 1261 | |||
| 1262 | /** |
||
| 1263 | * The weight of the product or person. |
||
| 1264 | * |
||
| 1265 | * @var QuantitativeValue |
||
| 1266 | */ |
||
| 1267 | private $_weight; |
||
| 1268 | |||
| 1269 | /** |
||
| 1270 | * @return QuantitativeValue |
||
| 1271 | */ |
||
| 1272 | public function getWeight() |
||
| 1276 | |||
| 1277 | /** |
||
| 1278 | * @param QuantitativeValue $weight |
||
| 1279 | * @return PersonTrait |
||
| 1280 | */ |
||
| 1281 | public function setWeight(QuantitativeValue $weight) |
||
| 1286 | |||
| 1287 | /** |
||
| 1288 | * A contact location for a person's place of work. |
||
| 1289 | * |
||
| 1290 | * @var ContactPoint|Place |
||
| 1291 | */ |
||
| 1292 | private $_workLocation; |
||
| 1293 | |||
| 1294 | /** |
||
| 1295 | * @return ContactPoint|Place |
||
| 1296 | */ |
||
| 1297 | public function getWorkLocation() |
||
| 1301 | |||
| 1302 | /** |
||
| 1303 | * @param ContactPoint|Place $workLocation |
||
| 1304 | * @return PersonTrait |
||
| 1305 | */ |
||
| 1306 | public function setWorkLocation($workLocation) |
||
| 1311 | |||
| 1312 | /** |
||
| 1313 | * Organizations that the person works for. |
||
| 1314 | * |
||
| 1315 | * @var Organization |
||
| 1316 | */ |
||
| 1317 | private $_worksFor; |
||
| 1318 | |||
| 1319 | /** |
||
| 1320 | * @return Organization |
||
| 1321 | */ |
||
| 1322 | public function getWorksFor() |
||
| 1326 | |||
| 1327 | /** |
||
| 1328 | * @param Organization $worksFor |
||
| 1329 | * @return PersonTrait |
||
| 1330 | */ |
||
| 1331 | public function setWorksFor(Organization $worksFor) |
||
| 1336 | |||
| 1337 | /** |
||
| 1338 | * Return the fields |
||
| 1339 | */ |
||
| 1340 | public function fields() |
||
| 1341 | { |
||
| 1342 | return array_merge(['additionalName', 'address', 'affiliation', 'alumniOf', 'award', 'birthDate', 'birthPlace', |
||
| 1343 | 'brand', 'children', 'colleague', 'contactPoint', 'deathDate', 'deathPlace', 'duns', 'email', 'familyName', |
||
| 1344 | 'faxNumber', 'follows', 'funder', 'gender', 'givenName', 'globalLocationNumber', 'hasOccupation', |
||
| 1345 | 'hasOfferCatalog', 'hasPOS', 'height', 'homeLocation', 'honorificPrefix', 'honorificSuffix', 'isicV4', |
||
| 1346 | 'jobTitle', 'knows', 'makesOffer', 'memberOf', 'naics', 'nationality', 'netWorth', 'owns', 'parent', |
||
| 1347 | 'performerIn', 'publishingPrinciples', 'relatedTo', 'seeks', 'sibling', 'sponsor', 'spouse', 'taxID', |
||
| 1348 | 'telephone', 'vatID', 'weight', 'workLocation', 'worksFor'],$this->thingFields()); |
||
| 1349 | } |
||
| 1350 | } |
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.