Skip to content

Commit e0ff330

Browse files
committed
enabled chaining by changing return types to in Page
1 parent d4dbb9e commit e0ff330

File tree

1 file changed

+52
-13
lines changed

1 file changed

+52
-13
lines changed

src/Entities/Page.php

Lines changed: 52 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -154,125 +154,164 @@ private function fillTitle(): void
154154
/**
155155
* @param $propertyTitle
156156
* @param $property
157+
* @return Page
157158
*/
158-
public function set(string $propertyTitle, Property $property): void
159+
public function set(string $propertyTitle, Property $property): Page
159160
{
160161
$property->setTitle($propertyTitle);
161162
$this->properties->add($property);
162163

163164
if ($property instanceof Title) {
164165
$this->title = $property->getPlainText();
165166
}
167+
168+
return $this;
166169
}
167170

168171
/**
169172
* @param $propertyTitle
170173
* @param $number
174+
* @return Page
171175
*/
172-
public function setNumber(string $propertyTitle, float $number): void
176+
public function setNumber(string $propertyTitle, float $number): Page
173177
{
174178
$this->set($propertyTitle, Number::value($number));
179+
180+
return $this;
175181
}
176182

177183
/**
178184
* @param $propertyTitle
179185
* @param $text
186+
* @return Page
180187
*/
181-
public function setTitle(string $propertyTitle, string $text): void
188+
public function setTitle(string $propertyTitle, string $text): Page
182189
{
183190
$this->set($propertyTitle, Title::value($text));
191+
192+
return $this;
184193
}
185194

186195
/**
187196
* @param $propertyTitle
188197
* @param $text
198+
* @return Page
189199
*/
190-
public function setText(string $propertyTitle, string $text): void
200+
public function setText(string $propertyTitle, string $text): Page
191201
{
192202
$this->set($propertyTitle, Text::value($text));
203+
204+
return $this;
193205
}
194206

195207
/**
196208
* @param $propertyTitle
197209
* @param $name
210+
* @return Page
198211
*/
199-
public function setSelect(string $propertyTitle, string $name): void
212+
public function setSelect(string $propertyTitle, string $name): Page
200213
{
201214
$this->set($propertyTitle, Select::value($name));
215+
216+
return $this;
202217
}
203218

204219
/**
205220
* @param $propertyTitle
206221
* @param $url
222+
* @return Page
207223
*/
208-
public function setUrl(string $propertyTitle, string $url): void
224+
public function setUrl(string $propertyTitle, string $url): Page
209225
{
210226
$this->set($propertyTitle, Url::value($url));
227+
228+
return $this;
211229
}
212230

213231
/**
214232
* @param $propertyTitle
215233
* @param $phoneNumber
234+
* @return Page
216235
*/
217-
public function setPhoneNumber(string $propertyTitle, string $phoneNumber): void
236+
public function setPhoneNumber(string $propertyTitle, string $phoneNumber): Page
218237
{
219238
$this->set($propertyTitle, PhoneNumber::value($phoneNumber));
239+
240+
return $this;
220241
}
221242

222243
/**
223244
* @param $propertyTitle
224245
* @param $email
246+
* @return Page
225247
*/
226-
public function setEmail(string $propertyTitle, string $email): void
248+
public function setEmail(string $propertyTitle, string $email): Page
227249
{
228250
$this->set($propertyTitle, Email::value($email));
251+
252+
return $this;
229253
}
230254

231255
/**
232256
* @param $propertyTitle
233257
* @param $names
258+
* @return Page
234259
*/
235-
public function setMultiSelect(string $propertyTitle, array $names): void
260+
public function setMultiSelect(string $propertyTitle, array $names): Page
236261
{
237262
$this->set($propertyTitle, MultiSelect::value($names));
263+
264+
return $this;
238265
}
239266

240267
/**
241268
* @param $propertyTitle
242269
* @param $checked
270+
* @return Page
243271
*/
244-
public function setCheckbox(string $propertyTitle, bool $checked): void
272+
public function setCheckbox(string $propertyTitle, bool $checked): Page
245273
{
246274
$this->set($propertyTitle, Checkbox::value($checked));
275+
276+
return $this;
247277
}
248278

249279

250280
/**
251281
* @param $propertyTitle
252282
* @param $start
253283
* @param $end
284+
* @return Page
254285
*/
255-
public function setDate(string $propertyTitle, ?DateTime $start, ?DateTime $end = null): void
286+
public function setDate(string $propertyTitle, ?DateTime $start, ?DateTime $end = null): Page
256287
{
257288
$this->set($propertyTitle, Date::value($start, $end));
289+
290+
return $this;
258291
}
259292

260293
/**
261294
* @param $propertyTitle
262295
* @param $relationIds
296+
* @return Page
263297
*/
264-
public function setRelation(string $propertyTitle, array $relationIds): void
298+
public function setRelation(string $propertyTitle, array $relationIds): Page
265299
{
266300
$this->set($propertyTitle, Relation::value($relationIds));
301+
302+
return $this;
267303
}
268304

269305
/**
270306
* @param $propertyTitle
271307
* @param $userIds
308+
* @return Page
272309
*/
273-
public function setPeople(string $propertyTitle, array $userIds): void
310+
public function setPeople(string $propertyTitle, array $userIds): Page
274311
{
275312
$this->set($propertyTitle, People::value($userIds));
313+
314+
return $this;
276315
}
277316

278317

0 commit comments

Comments
 (0)