Total Complexity | 7 |
Total Lines | 82 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
11 | class MessageBuilder |
||
12 | { |
||
13 | private string $type = 'DEFAULT'; |
||
14 | private string $object; |
||
15 | private string $message; |
||
16 | private $sender; |
||
17 | private $recipient; |
||
18 | |||
19 | private MessageRepository $messageRepository; |
||
20 | |||
21 | /** |
||
22 | * Message constructor. |
||
23 | * @param MessageRepository $messageRepository |
||
24 | */ |
||
25 | public function __construct(MessageRepository $messageRepository) |
||
26 | { |
||
27 | $this->messageRepository = $messageRepository; |
||
28 | } |
||
29 | |||
30 | /** |
||
31 | * @param string $type |
||
32 | * @return MessageBuilder |
||
33 | */ |
||
34 | public function setType(string $type): MessageBuilder |
||
35 | { |
||
36 | $this->type = $type; |
||
37 | return $this; |
||
38 | } |
||
39 | |||
40 | /** |
||
41 | * @param string $object |
||
42 | * @return MessageBuilder |
||
43 | */ |
||
44 | public function setObject(string $object): MessageBuilder |
||
45 | { |
||
46 | $this->object = $object; |
||
47 | return $this; |
||
48 | } |
||
49 | |||
50 | /** |
||
51 | * @param string $message |
||
52 | * @return MessageBuilder |
||
53 | */ |
||
54 | public function setMessage(string $message): MessageBuilder |
||
55 | { |
||
56 | $this->message = $message; |
||
57 | return $this; |
||
58 | } |
||
59 | |||
60 | /** |
||
61 | * @param $sender |
||
62 | * @return MessageBuilder |
||
63 | */ |
||
64 | public function setSender($sender): MessageBuilder |
||
65 | { |
||
66 | $this->sender = $sender; |
||
67 | return $this; |
||
68 | } |
||
69 | |||
70 | /** |
||
71 | * @param $recipient |
||
72 | * @return MessageBuilder |
||
73 | */ |
||
74 | public function setRecipient($recipient): MessageBuilder |
||
75 | { |
||
76 | $this->recipient = $recipient; |
||
77 | return $this; |
||
78 | } |
||
79 | |||
80 | public function send() |
||
93 | } |
||
94 | } |
||
95 |