Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
Invitation.php
1<?php
2
4
7use \Bitrix\Main\Type\DateTime;
8
9final class Invitation implements Arrayable
10{
11 private ?Sender $sender = null;
12 private int $receiverId = 0;
13 private int $spaceId = 0;
14 private ?Datetime $inviteDate = null;
15
16 public function setSender(Sender $sender): self
17 {
18 $this->sender = $sender;
19
20 return $this;
21 }
22
23 public function setReceiverId(int $receiverId): self
24 {
25 $this->receiverId = $receiverId;
26
27 return $this;
28 }
29
30 public function setInviteDate(?DateTime $inviteDate): self
31 {
32 $this->inviteDate = $inviteDate;
33
34 return $this;
35 }
36
37 public function setSpaceId(int $spaceId): self
38 {
39 $this->spaceId = $spaceId;
40
41 return $this;
42 }
43
44 public function getSpaceId(): int
45 {
46 return $this->spaceId;
47 }
48
49 private function getMessage(): string
50 {
51 return Loc::getMessage(
52 'SOCIALNETWORK_SPACES_LIST_INVITATION_MESSAGE',
53 ['#NAME#' => $this->sender->getName()]
54 );
55 }
56
57 public function toArray(): array
58 {
59 return [
60 'sender' => $this->sender->toArray(),
61 'receiverId' => $this->receiverId,
62 'invitationDate' => $this->inviteDate,
63 'invitationDateTimestamp' => $this->inviteDate?->getTimestamp(),
64 'spaceId' => $this->spaceId,
65 'message' => $this->getMessage(),
66 ];
67 }
68}
static getMessage($code, $replace=null, $language=null)
Definition loc.php:29