Skip to content

Commit 29657c9

Browse files
committed
ISSUE-345: return self after set
1 parent e748570 commit 29657c9

23 files changed

+183
-92
lines changed

config/repositories.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ services:
1111
arguments:
1212
- PhpList\Core\Domain\Model\Identity\AdministratorToken
1313

14-
PhpList\Core\Domain\Repository\Messaging\SubscriberListRepository:
14+
PhpList\Core\Domain\Repository\Subscription\SubscriberListRepository:
1515
parent: PhpList\Core\Domain\Repository
1616
arguments:
17-
- PhpList\Core\Domain\Model\Messaging\SubscriberList
17+
- PhpList\Core\Domain\Model\Subscription\SubscriberList
1818

1919
PhpList\Core\Domain\Repository\Subscription\SubscriberRepository:
2020
parent: PhpList\Core\Domain\Repository

src/Domain/Model/Identity/AdminAttribute.php

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,33 +86,45 @@ public function getTableName(): ?string
8686
return $this->tableName;
8787
}
8888

89-
public function setName(string $name): void
89+
public function setName(string $name): self
9090
{
9191
$this->name = $name;
92+
93+
return $this;
9294
}
9395

94-
public function setType(?string $type): void
96+
public function setType(?string $type): self
9597
{
9698
$this->type = $type;
99+
100+
return $this;
97101
}
98102

99-
public function setListOrder(?int $listOrder): void
103+
public function setListOrder(?int $listOrder): self
100104
{
101105
$this->listOrder = $listOrder;
106+
107+
return $this;
102108
}
103109

104-
public function setDefaultValue(?string $defaultValue): void
110+
public function setDefaultValue(?string $defaultValue): self
105111
{
106112
$this->defaultValue = $defaultValue;
113+
114+
return $this;
107115
}
108116

109-
public function setRequired(?bool $required): void
117+
public function setRequired(?bool $required): self
110118
{
111119
$this->required = $required;
120+
121+
return $this;
112122
}
113123

114-
public function setTableName(?string $tableName): void
124+
public function setTableName(?string $tableName): self
115125
{
116126
$this->tableName = $tableName;
127+
128+
return $this;
117129
}
118130
}

src/Domain/Model/Identity/AdminAttributeRelation.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,10 @@ public function getValue(): ?string
4646
return $this->value;
4747
}
4848

49-
public function setValue(?string $value): void
49+
public function setValue(?string $value): self
5050
{
5151
$this->value = $value;
52+
53+
return $this;
5254
}
5355
}

src/Domain/Model/Identity/Administrator.php

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
* selected lists (as the owner), send campaigns to these lists and edit subscribers.
2121
*
2222
* @author Oliver Klee <[email protected]>
23+
* @author Tatevik Grigoryan <[email protected]>
2324
*/
2425
#[ORM\Entity(repositoryClass: AdministratorRepository::class)]
2526
#[ORM\Table(name: 'phplist_admin')]
@@ -76,75 +77,91 @@ public function getLoginName(): string
7677
return $this->loginName;
7778
}
7879

79-
public function setLoginName(string $loginName): void
80+
public function setLoginName(string $loginName): self
8081
{
8182
$this->loginName = $loginName;
83+
84+
return $this;
8285
}
8386

8487
public function getEmailAddress(): string
8588
{
8689
return $this->emailAddress;
8790
}
8891

89-
public function setEmailAddress(string $emailAddress): void
92+
public function setEmailAddress(string $emailAddress): self
9093
{
9194
$this->emailAddress = $emailAddress;
95+
96+
return $this;
9297
}
9398

9499
public function getPasswordHash(): string
95100
{
96101
return $this->passwordHash;
97102
}
98103

99-
public function setPasswordHash(string $passwordHash): void
104+
public function setPasswordHash(string $passwordHash): self
100105
{
101106
$this->passwordHash = $passwordHash;
102107
$this->setPasswordChangeDate(new DateTime());
108+
109+
return $this;
103110
}
104111

105112
public function getPasswordChangeDate(): ?DateTime
106113
{
107114
return $this->passwordChangeDate;
108115
}
109116

110-
private function setPasswordChangeDate(DateTime $changeDate): void
117+
private function setPasswordChangeDate(DateTime $changeDate): self
111118
{
112119
$this->passwordChangeDate = $changeDate;
120+
121+
return $this;
113122
}
114123

115124
public function isDisabled(): bool
116125
{
117126
return $this->disabled;
118127
}
119128

120-
public function setDisabled(bool $disabled): void
129+
public function setDisabled(bool $disabled): self
121130
{
122131
$this->disabled = $disabled;
132+
133+
return $this;
123134
}
124135

125136
public function isSuperUser(): bool
126137
{
127138
return $this->superUser;
128139
}
129140

130-
public function setSuperUser(bool $superUser): void
141+
public function setSuperUser(bool $superUser): self
131142
{
132143
$this->superUser = $superUser;
144+
145+
return $this;
133146
}
134147

135-
public function setNameLc(string $nameLc): void
148+
public function setNameLc(string $nameLc): self
136149
{
137150
$this->namelc = $nameLc;
151+
152+
return $this;
138153
}
139154

140155
public function getNameLc(): string
141156
{
142157
return $this->namelc;
143158
}
144159

145-
public function setPrivileges(string $privileges): void
160+
public function setPrivileges(string $privileges): self
146161
{
147162
$this->privileges = $privileges;
163+
164+
return $this;
148165
}
149166

150167
public function getPrivileges(): string

src/Domain/Model/Identity/AdministratorToken.php

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,11 @@ public function getCreationDate(): ?DateTime
6363
return $date;
6464
}
6565

66-
private function setCreationDate(DateTime $creationDate): void
66+
private function setCreationDate(DateTime $creationDate): self
6767
{
6868
$this->creationDate = $creationDate->getTimestamp();
69+
70+
return $this;
6971
}
7072

7173
#[ORM\PrePersist]
@@ -79,39 +81,48 @@ public function getExpiry(): DateTime
7981
return $this->expiry;
8082
}
8183

82-
private function setExpiry(DateTime $expiry): void
84+
private function setExpiry(DateTime $expiry): self
8385
{
8486
$this->expiry = $expiry;
87+
88+
return $this;
8589
}
8690

87-
public function generateExpiry(): void
91+
public function generateExpiry(): self
8892
{
8993
$this->setExpiry(new DateTime(static::DEFAULT_EXPIRY));
94+
95+
return $this;
9096
}
9197

9298
public function getKey(): string
9399
{
94100
return $this->key;
95101
}
96102

97-
public function setKey(string $key): void
103+
public function setKey(string $key): self
98104
{
99105
$this->key = $key;
106+
107+
return $this;
100108
}
101109

102-
public function generateKey(): void
110+
public function generateKey(): self
103111
{
104112
$key = md5(random_bytes(256));
105113
$this->setKey($key);
114+
115+
return $this;
106116
}
107117

108118
public function getAdministrator(): Administrator|Proxy|null
109119
{
110120
return $this->administrator;
111121
}
112122

113-
public function setAdministrator(Administrator $administrator): void
123+
public function setAdministrator(Administrator $administrator): self
114124
{
115125
$this->administrator = $administrator;
126+
return $this;
116127
}
117128
}

src/Domain/Model/Messaging/Attachment.php

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,48 +50,53 @@ public function getFilename(): ?string
5050
return $this->filename;
5151
}
5252

53-
public function setFilename(?string $filename): void
53+
public function setFilename(?string $filename): self
5454
{
5555
$this->filename = $filename;
56+
return $this;
5657
}
5758

5859
public function getRemoteFile(): ?string
5960
{
6061
return $this->remoteFile;
6162
}
6263

63-
public function setRemoteFile(?string $remoteFile): void
64+
public function setRemoteFile(?string $remoteFile): self
6465
{
6566
$this->remoteFile = $remoteFile;
67+
return $this;
6668
}
6769

6870
public function getMimeType(): ?string
6971
{
7072
return $this->mimeType;
7173
}
7274

73-
public function setMimeType(?string $mimeType): void
75+
public function setMimeType(?string $mimeType): self
7476
{
7577
$this->mimeType = $mimeType;
78+
return $this;
7679
}
7780

7881
public function getDescription(): ?string
7982
{
8083
return $this->description;
8184
}
8285

83-
public function setDescription(?string $description): void
86+
public function setDescription(?string $description): self
8487
{
8588
$this->description = $description;
89+
return $this;
8690
}
8791

8892
public function getSize(): ?int
8993
{
9094
return $this->size;
9195
}
9296

93-
public function setSize(?int $size): void
97+
public function setSize(?int $size): self
9498
{
9599
$this->size = $size;
100+
return $this;
96101
}
97102
}

src/Domain/Model/Messaging/Bounce.php

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,48 +58,53 @@ public function getDate(): ?DateTime
5858
return $this->date;
5959
}
6060

61-
public function setDate(?DateTime $date): void
61+
public function setDate(?DateTime $date): self
6262
{
6363
$this->date = $date;
64+
return $this;
6465
}
6566

6667
public function getHeader(): ?string
6768
{
6869
return $this->header;
6970
}
7071

71-
public function setHeader(?string $header): void
72+
public function setHeader(?string $header): self
7273
{
7374
$this->header = $header;
75+
return $this;
7476
}
7577

7678
public function getData(): ?string
7779
{
7880
return $this->data;
7981
}
8082

81-
public function setData(?string $data): void
83+
public function setData(?string $data): self
8284
{
8385
$this->data = $data;
86+
return $this;
8487
}
8588

8689
public function getStatus(): ?string
8790
{
8891
return $this->status;
8992
}
9093

91-
public function setStatus(?string $status): void
94+
public function setStatus(?string $status): self
9295
{
9396
$this->status = $status;
97+
return $this;
9498
}
9599

96100
public function getComment(): ?string
97101
{
98102
return $this->comment;
99103
}
100104

101-
public function setComment(?string $comment): void
105+
public function setComment(?string $comment): self
102106
{
103107
$this->comment = $comment;
108+
return $this;
104109
}
105110
}

0 commit comments

Comments
 (0)