‪TYPO3CMS  ‪main
Person.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
19 
22 
27 {
28  protected string ‪$firstname = '';
29 
30  protected string ‪$lastname = '';
31 
32  protected string ‪$email = '';
33 
34  protected ‪Enum\Salutation ‪$salutation = Enum\Salutation::NONE;
35 
40 
45 
46  public function ‪__construct(string ‪$firstname = '', string ‪$lastname = '', string ‪$email = '')
47  {
48  $this->‪setFirstname($firstname);
49  $this->‪setLastname($lastname);
50  $this->‪setEmail($email);
51 
52  $this->tags = new ‪ObjectStorage();
53  $this->tagsSpecial = new ‪ObjectStorage();
54  }
55 
56  public function ‪setFirstname(string ‪$firstname): void
57  {
58  $this->firstname = ‪$firstname;
59  }
60 
61  public function ‪getFirstname(): string
62  {
63  return ‪$this->firstname;
64  }
65 
66  public function ‪setLastname(string ‪$lastname): void
67  {
68  $this->lastname = ‪$lastname;
69  }
70 
71  public function ‪getLastname(): string
72  {
73  return ‪$this->lastname;
74  }
75 
76  public function ‪getFullName(): string
77  {
78  return $this->firstname . ' ' . ‪$this->lastname;
79  }
80 
81  public function ‪setEmail(string ‪$email): void
82  {
83  $this->email = ‪$email;
84  }
85 
86  public function ‪getEmail(): string
87  {
88  return ‪$this->email;
89  }
90 
91  public function ‪getSalutation(): Enum\‪Salutation
92  {
93  return ‪$this->salutation;
94  }
95 
96  public function ‪setSalutation(Enum\‪Salutation ‪$salutation): void
97  {
98  $this->salutation = ‪$salutation;
99  }
100 
104  public function ‪getTags(): ‪ObjectStorage
105  {
106  return ‪$this->tags;
107  }
108 
112  public function ‪setTags(‪ObjectStorage ‪$tags): void
113  {
114  $this->tags = ‪$tags;
115  }
116 
117  public function ‪addTag(‪Tag $tag): void
118  {
119  $this->tags->attach($tag);
120  }
121 
122  public function ‪removeTag(‪Tag $tag): void
123  {
124  $this->tags->detach($tag);
125  }
126 
131  {
132  return ‪$this->tagsSpecial;
133  }
134 
139  {
140  $this->tagsSpecial = ‪$tagsSpecial;
141  }
142 
143  public function ‪addTagSpecial(‪Tag $tag): void
144  {
145  $this->tagsSpecial->attach($tag);
146  }
147 
148  public function ‪removeTagSpecial(‪Tag $tag): void
149  {
150  $this->tagsSpecial->detach($tag);
151  }
152 }
‪TYPO3Tests\BlogExample\Domain\Model\Person\__construct
‪__construct(string $firstname='', string $lastname='', string $email='')
Definition: Person.php:46
‪TYPO3Tests\BlogExample\Domain\Model\Person\getTags
‪ObjectStorage< Tag > getTags()
Definition: Person.php:104
‪TYPO3Tests\BlogExample\Domain\Model\Tag
Definition: Tag.php:26
‪TYPO3Tests\BlogExample\Domain\Model\Person\getLastname
‪getLastname()
Definition: Person.php:71
‪TYPO3Tests\BlogExample\Domain\Model\Person\$tags
‪ObjectStorage $tags
Definition: Person.php:39
‪TYPO3Tests\BlogExample\Domain\Model\Person\getFullName
‪getFullName()
Definition: Person.php:76
‪TYPO3Tests\BlogExample\Domain\Model\Person\setFirstname
‪setFirstname(string $firstname)
Definition: Person.php:56
‪TYPO3Tests\BlogExample\Domain\Model\Person\setEmail
‪setEmail(string $email)
Definition: Person.php:81
‪TYPO3Tests\BlogExample\Domain\Model\Enum\Salutation
‪Salutation
Definition: Salutation.php:21
‪TYPO3Tests\BlogExample\Domain\Model\Person\$firstname
‪string $firstname
Definition: Person.php:28
‪TYPO3Tests\BlogExample\Domain\Model\Person\setTagsSpecial
‪setTagsSpecial(ObjectStorage $tagsSpecial)
Definition: Person.php:138
‪TYPO3\CMS\Extbase\DomainObject\AbstractEntity
Definition: AbstractEntity.php:22
‪TYPO3Tests\BlogExample\Domain\Model\Person\$lastname
‪string $lastname
Definition: Person.php:30
‪TYPO3Tests\BlogExample\Domain\Model\Person\addTag
‪addTag(Tag $tag)
Definition: Person.php:117
‪TYPO3\CMS\Extbase\Persistence\ObjectStorage
Definition: ObjectStorage.php:34
‪TYPO3Tests\BlogExample\Domain\Model\Person\addTagSpecial
‪addTagSpecial(Tag $tag)
Definition: Person.php:143
‪TYPO3Tests\BlogExample\Domain\Model\Person\setLastname
‪setLastname(string $lastname)
Definition: Person.php:66
‪TYPO3Tests\BlogExample\Domain\Model\Person\removeTag
‪removeTag(Tag $tag)
Definition: Person.php:122
‪TYPO3Tests\BlogExample\Domain\Model\Person\setTags
‪setTags(ObjectStorage $tags)
Definition: Person.php:112
‪TYPO3Tests\BlogExample\Domain\Model\Person\$salutation
‪Enum Salutation $salutation
Definition: Person.php:34
‪TYPO3Tests\BlogExample\Domain\Model\Person\getEmail
‪getEmail()
Definition: Person.php:86
‪TYPO3Tests\BlogExample\Domain\Model
Definition: Administrator.php:18
‪TYPO3Tests\BlogExample\Domain\Model\Person\setSalutation
‪setSalutation(Enum\Salutation $salutation)
Definition: Person.php:96
‪TYPO3Tests\BlogExample\Domain\Model\Person
Definition: Person.php:27
‪TYPO3Tests\BlogExample\Domain\Model\Person\getTagsSpecial
‪ObjectStorage< Tag > getTagsSpecial()
Definition: Person.php:130
‪TYPO3Tests\BlogExample\Domain\Model\Person\$email
‪string $email
Definition: Person.php:32
‪TYPO3Tests\BlogExample\Domain\Model\Person\$tagsSpecial
‪ObjectStorage $tagsSpecial
Definition: Person.php:44
‪TYPO3Tests\BlogExample\Domain\Model\Person\getSalutation
‪getSalutation()
Definition: Person.php:91
‪TYPO3Tests\BlogExample\Domain\Model\Person\getFirstname
‪getFirstname()
Definition: Person.php:61
‪TYPO3Tests\BlogExample\Domain\Model\Person\removeTagSpecial
‪removeTagSpecial(Tag $tag)
Definition: Person.php:148